:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #eef2f0;
  --surface-warm: #fff8ed;
  --ink: #182320;
  --muted: #61706b;
  --line: #d6dedb;
  --line-strong: #b7c4bf;
  --green: #12665a;
  --green-dark: #0c473f;
  --green-soft: #dff2eb;
  --coral: #c84f2d;
  --coral-dark: #a63c20;
  --blue: #315b91;
  --blue-soft: #e7eef8;
  --yellow: #9a6800;
  --yellow-soft: #fff1c9;
  --red: #9b2f2a;
  --red-soft: #fbe8e6;
  --shadow: 0 18px 48px rgba(24, 35, 32, 0.14);
  --radius: 6px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

body.has-drawer {
  overflow: hidden;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
a[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

a {
  color: var(--blue);
}

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

h1,
h2,
h3,
strong {
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(49, 91, 145, 0.32);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(300px, 1fr);
  align-items: center;
  gap: 20px;
  min-height: 68px;
  padding: 0 24px;
  color: #fff;
  background: var(--green-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  color: #fff;
  background: var(--coral);
  font-size: 17px;
  font-weight: 800;
}

.topbar h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.topbar p {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.topbar__actions,
.compact-actions,
.quick-actions,
.email-actions,
.voice-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.topbar__actions {
  justify-content: flex-end;
}

.view-tabs {
  display: flex;
  align-items: stretch;
  align-self: stretch;
}

.view-tab {
  position: relative;
  min-width: 92px;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  font-weight: 650;
}

.view-tab::after {
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 3px;
  content: "";
  background: transparent;
}

.view-tab:hover,
.view-tab.is-active {
  color: #fff;
}

.view-tab.is-active::after {
  background: #ffb193;
}

.count-badge,
.button-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 5px;
  border-radius: 10px;
  color: var(--green-dark);
  background: #fff;
  font-size: 11px;
  line-height: 1;
}

.button-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  border: 2px solid var(--green-dark);
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.text-button,
.inside-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  white-space: nowrap;
  text-decoration: none;
}

.icon-button {
  position: relative;
  width: 38px;
  min-width: 38px;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.icon-button--light {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.icon-button--light:hover {
  background: var(--surface-soft);
}

.primary-button {
  padding: 0 15px;
  color: #fff;
  background: var(--coral);
  font-weight: 720;
}

.primary-button:hover {
  background: var(--coral-dark);
}

.secondary-button,
.danger-button {
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-weight: 630;
}

.secondary-button:hover {
  color: var(--green-dark);
  border-color: var(--green);
  background: #f7fbf9;
}

.danger-button {
  color: var(--red);
  border-color: #e1aaa6;
}

.danger-button:hover {
  background: var(--red-soft);
}

.text-button {
  min-height: 28px;
  padding: 0 6px;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.text-button:hover {
  text-decoration: underline;
}

.inside-button {
  width: 38px;
  min-width: 38px;
  color: var(--muted);
  background: transparent;
}

.view {
  min-height: calc(100vh - 68px);
}

.search-band {
  padding: 22px max(24px, calc((100vw - 1480px) / 2));
  background: #e8efec;
  border-bottom: 1px solid var(--line);
}

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

.section-heading h2 {
  margin-bottom: 3px;
  font-size: 18px;
  line-height: 1.25;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.source-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 150px auto;
  align-items: end;
  gap: 12px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea,
.filters input,
.filters select,
.filter-search {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 450;
}

.field input,
.field select,
.filters input,
.filters select {
  height: 40px;
  padding: 0 11px;
}

.field textarea {
  padding: 10px 11px;
  line-height: 1.5;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filters input:focus,
.filters select:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(49, 91, 145, 0.12);
}

.input-with-action {
  display: grid;
  grid-template-columns: 1fr 40px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.input-with-action input {
  border: 0;
  border-radius: 0;
}

.input-with-action input:focus {
  outline: 0;
}

.input-with-action:focus-within {
  border-color: var(--blue);
  outline: 3px solid rgba(49, 91, 145, 0.12);
}

.search-submit {
  min-width: 116px;
  height: 40px;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.search-submit.is-loading .spinner {
  display: block;
}

.search-submit.is-loading .search-button-icon {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sector-picker {
  margin-top: 14px;
}

.sector-picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sector-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.sector-option,
.toggle-control {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.sector-option:has(input:checked) {
  color: var(--green-dark);
  border-color: #6ca99e;
  background: var(--green-soft);
  font-weight: 650;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--green);
}

.metrics-band {
  display: grid;
  grid-template-columns: repeat(8, minmax(110px, 1fr));
  max-width: 1480px;
  margin: 0 auto;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.metric {
  min-width: 0;
  padding: 15px 14px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 23px;
  line-height: 1.15;
}

.metric--rate strong {
  color: var(--blue);
}

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

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(5, minmax(140px, 0.8fr));
  gap: 8px;
  padding: 0 16px 14px;
}

.filters select,
.filter-search {
  height: 38px;
}

.filter-search {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  padding-left: 8px;
}

.filter-search .icon {
  color: var(--muted);
}

.filter-search input {
  height: 36px;
  padding-left: 0;
  border: 0;
  background: transparent;
}

.filter-search input:focus {
  outline: 0;
}

.filter-search:focus-within {
  border-color: var(--blue);
  outline: 3px solid rgba(49, 91, 145, 0.12);
}

.list-toolbar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px 10px;
}

.list-toolbar > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.list-toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.table-shell {
  position: relative;
  overflow: auto;
  min-height: 320px;
  max-height: calc(100vh - 355px);
  margin: 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #e7ecea;
}

th {
  position: sticky;
  z-index: 2;
  top: 0;
  color: #53635e;
  background: #f1f5f3;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

tbody tr {
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: #f8fbfa;
}

tbody tr.is-selected {
  background: #edf7f3;
}

tbody tr.is-blocked {
  background: #fcf4f3;
  opacity: 0.78;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.check-column {
  width: 40px;
  text-align: center;
}

.actions-column {
  width: 130px;
}

.score-pill {
  display: inline-grid;
  width: 48px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #a8d4c7;
  font-size: 16px;
  font-weight: 780;
}

.score-pill[data-priority="critical"] {
  color: #81221b;
  background: #ffe2dd;
  border-color: #e8a69e;
}

.score-pill[data-priority="medium"] {
  color: #674600;
  background: var(--yellow-soft);
  border-color: #e4ca7a;
}

.score-pill[data-priority="low"],
.score-pill[data-priority="none"] {
  color: #5d6865;
  background: #eef1f0;
  border-color: #ccd5d1;
}

.score-caption {
  display: block;
  width: 84px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.business-cell {
  display: grid;
  max-width: 280px;
  gap: 4px;
}

.business-link {
  padding: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-weight: 750;
}

.business-link:hover {
  color: var(--blue);
  text-decoration: underline;
}

.cell-meta,
.cell-note {
  color: var(--muted);
  font-size: 12px;
}

.cell-note {
  max-width: 260px;
  line-height: 1.35;
}

.web-state,
.crm-state,
.contact-chip,
.source-chip,
.live-state {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.web-state[data-state="confirmed_missing"],
.web-state[data-state="likely_missing"] {
  color: #8b2d19;
  background: #ffebe5;
}

.web-state[data-state="social_only"] {
  color: #654600;
  background: var(--yellow-soft);
}

.web-state[data-state="found"] {
  color: var(--green-dark);
  background: var(--green-soft);
}

.web-state[data-state="deficient"] {
  color: #6f2e71;
  background: #f5e8f6;
}

.web-state[data-state="pending"],
.web-state[data-state="insufficient"] {
  color: #53605c;
  background: #edf1f0;
}

.crm-state {
  color: #264f83;
  background: var(--blue-soft);
}

.contact-stack {
  display: grid;
  gap: 4px;
}

.contact-chip {
  width: fit-content;
  max-width: 240px;
  overflow: hidden;
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-chip--phone {
  color: #254f81;
  background: var(--blue-soft);
}

.contact-chip--empty {
  color: var(--muted);
  background: #eef1f0;
}

.row-actions {
  display: flex;
  gap: 5px;
}

.row-action {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}

.row-action:hover {
  color: var(--green-dark);
  border-color: var(--green);
  background: #f4faf7;
}

.row-action .icon {
  width: 16px;
  height: 16px;
}

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

.empty-state__icon {
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  fill: none;
  stroke: #7b8d87;
  stroke-width: 1.5;
}

.empty-state strong {
  color: var(--ink);
  font-size: 16px;
}

.empty-state p {
  margin: 5px 0 0;
}

.secondary-view {
  width: min(1120px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 26px 0 50px;
}

.followup-list,
.activity-list,
.timeline {
  display: grid;
  gap: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.followup-item,
.activity-item,
.timeline-item {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) minmax(260px, 1.4fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.followup-item:last-child,
.activity-item:last-child,
.timeline-item:last-child {
  border-bottom: 0;
}

.followup-item.is-overdue {
  box-shadow: inset 4px 0 var(--coral);
}

.item-time {
  color: var(--muted);
  font-size: 12px;
}

.drawer-backdrop {
  position: fixed;
  z-index: 70;
  inset: 0;
  background: rgba(11, 24, 21, 0.42);
}

.lead-drawer {
  position: fixed;
  z-index: 80;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  width: min(760px, 92vw);
  grid-template-rows: auto auto auto 1fr;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.drawer-eyebrow {
  color: var(--green);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.drawer-header h2 {
  margin: 3px 0;
  font-size: 22px;
}

.drawer-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.drawer-score {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  color: #fff;
  background: var(--green-dark);
}

.score-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.score-block strong {
  flex: 0 0 auto;
  min-width: 55px;
  font-size: 31px;
  line-height: 1;
}

.score-block span {
  font-size: 11px;
  font-weight: 650;
}

.drawer-score p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.drawer-tab {
  min-height: 43px;
  color: var(--muted);
  background: #f4f7f6;
  border-right: 1px solid var(--line);
  font-size: 12px;
  font-weight: 680;
}

.drawer-tab:last-child {
  border-right: 0;
}

.drawer-tab.is-active {
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: inset 0 -3px var(--green);
}

.drawer-content {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer-panel {
  min-height: 100%;
  padding: 20px 22px 90px;
}

.diagnosis-band {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px 18px;
  margin: -20px -22px 18px;
  padding: 16px 22px;
  background: var(--surface-warm);
  border-bottom: 1px solid #ecd7ab;
}

.diagnosis-band > div,
.diagnosis-band label {
  display: grid;
  gap: 3px;
}

.diagnosis-band span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.diagnosis-band strong {
  color: var(--yellow);
}

.diagnosis-band p {
  grid-column: 1 / -1;
  margin: 0;
  color: #6e6040;
  font-size: 12px;
}

progress {
  width: 100%;
  height: 9px;
  margin-top: 5px;
  accent-color: var(--yellow);
}

.quick-actions {
  flex-wrap: wrap;
  margin-bottom: 19px;
}

.form-section {
  padding: 19px 0;
  border-top: 1px solid var(--line);
}

.form-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.form-section h3,
.live-call h3 {
  margin-bottom: 13px;
  font-size: 14px;
}

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

.field--wide {
  grid-column: 1 / -1;
}

.sticky-form-actions {
  position: sticky;
  bottom: -90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px -22px -90px;
  padding: 13px 22px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
}

.panel-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-toolbar--call {
  grid-template-columns: 1fr auto;
}

.align-end {
  align-self: end;
}

.subject-options {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.subject-option {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.subject-option:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.drawer-panel[data-drawer-panel="email"] > .field {
  margin-bottom: 13px;
}

.email-editor,
.call-script {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px !important;
}

.email-actions {
  flex-wrap: wrap;
  margin-top: 16px;
}

.integration-status {
  min-height: 42px;
  margin-top: 15px;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border-left: 3px solid var(--line-strong);
  font-size: 12px;
}

.integration-status.is-ready {
  color: var(--green-dark);
  border-left-color: var(--green);
  background: var(--green-soft);
}

.integration-status.is-error {
  color: var(--red);
  border-left-color: var(--red);
  background: var(--red-soft);
}

.voice-toolbar {
  flex-wrap: wrap;
  margin: 12px 0 18px;
}

.voice-select {
  min-width: 220px;
  flex: 1 1 220px;
}

.live-call {
  margin: 0 -22px;
  padding: 18px 22px;
  background: #f2f6f4;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.live-call__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.live-state {
  color: var(--muted);
  background: #e4e9e7;
}

.live-state.is-listening {
  color: var(--green-dark);
  background: var(--green-soft);
}

.live-state.is-speaking {
  color: #764f00;
  background: var(--yellow-soft);
}

.live-call .field {
  margin-top: 13px;
}

.objection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 13px;
}

.objection-button {
  min-height: 36px;
  padding: 5px 9px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  text-align: left;
  font-size: 12px;
}

.objection-button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.call-result {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-top: 18px;
}

.note-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 18px;
}

.timeline {
  border: 0;
}

.timeline-item {
  grid-template-columns: 120px 1fr;
  align-items: start;
  padding-right: 0;
  padding-left: 0;
}

.timeline-item__type {
  color: var(--green);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.timeline-item p {
  margin-bottom: 0;
}

.modal,
.confirm-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal::backdrop,
.confirm-dialog::backdrop {
  background: rgba(11, 24, 21, 0.48);
}

.modal-shell {
  display: grid;
  max-height: calc(100vh - 30px);
  grid-template-rows: auto 1fr auto;
}

.modal-shell--wide {
  width: min(920px, calc(100vw - 28px));
}

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

.modal-header h2 {
  margin-bottom: 3px;
  font-size: 19px;
}

.modal-header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.modal-content {
  overflow-y: auto;
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 20px;
  background: #f3f6f5;
  border-top: 1px solid var(--line);
}

.privacy-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.privacy-controls p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.duplicate-groups {
  display: grid;
  gap: 12px;
}

.duplicate-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.duplicate-group__reason {
  padding: 9px 12px;
  color: #6a531f;
  background: var(--yellow-soft);
  border-bottom: 1px solid #e3cc8f;
  font-size: 12px;
}

.duplicate-record {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.duplicate-record:last-child {
  border-bottom: 0;
}

.duplicate-record p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.confirm-dialog {
  width: min(440px, calc(100vw - 28px));
}

.confirm-dialog form {
  padding: 20px 20px 0;
}

.confirm-dialog h2 {
  margin-bottom: 8px;
  font-size: 18px;
}

.confirm-dialog p {
  color: var(--muted);
}

.confirm-dialog .modal-footer {
  margin: 20px -20px 0;
}

.toast-region {
  position: fixed;
  z-index: 120;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(360px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  color: #fff;
  background: var(--green-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.is-error {
  background: var(--red);
}

@media (max-width: 1220px) {
  .topbar {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .view-tabs {
    order: 3;
    grid-column: 1 / -1;
    min-height: 42px;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .topbar__actions {
    min-height: 64px;
  }

  .metrics-band {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .metric:nth-child(4) {
    border-right: 0;
  }

  .metric:nth-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .filters {
    grid-template-columns: minmax(240px, 1.4fr) repeat(4, minmax(130px, 1fr));
  }

  .filter-search {
    grid-column: span 2;
  }

  .view {
    min-height: calc(100vh - 110px);
  }
}

@media (max-width: 820px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 12px 14px 0;
  }

  .topbar__actions {
    min-height: 54px;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .view-tabs {
    order: 0;
    grid-column: auto;
    width: calc(100% + 28px);
    margin-left: -14px;
  }

  .view-tab {
    min-width: 0;
    flex: 1;
  }

  .search-band {
    padding: 18px 14px;
  }

  .search-form {
    grid-template-columns: 1fr 132px;
  }

  .field--location {
    grid-column: 1 / -1;
  }

  .search-submit {
    width: 100%;
  }

  .metrics-band {
    overflow-x: auto;
    grid-template-columns: repeat(8, 128px);
    margin: 0;
    border-left: 0;
  }

  .metric {
    border-bottom: 0 !important;
  }

  .workspace {
    padding-top: 12px;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 12px 12px;
  }

  .filter-search {
    grid-column: 1 / -1;
  }

  .filters .icon-button {
    width: 100%;
  }

  .list-toolbar {
    align-items: flex-start;
    padding-right: 12px;
    padding-left: 12px;
  }

  .list-toolbar > div:first-child {
    display: grid;
    gap: 2px;
  }

  .table-shell {
    max-height: none;
    margin: 0 12px;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: 62px 1fr;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  tbody tr:hover {
    background: var(--surface);
  }

  tbody td {
    padding: 9px 12px;
    border-bottom: 0;
  }

  tbody td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 720;
    text-transform: uppercase;
  }

  tbody td:nth-child(1) {
    position: absolute;
    z-index: 1;
    top: 12px;
    right: 12px;
    width: auto;
    padding: 0;
  }

  tbody td:nth-child(1)::before {
    display: none;
  }

  tbody td:nth-child(2) {
    grid-row: 1 / 3;
    min-height: 105px;
    padding-top: 15px;
    text-align: center;
    background: #f2f6f4;
  }

  tbody td:nth-child(3) {
    padding-top: 15px;
    padding-right: 46px;
  }

  tbody td:nth-child(4),
  tbody td:nth-child(5),
  tbody td:nth-child(6),
  tbody td:nth-child(7) {
    grid-column: 1 / -1;
  }

  tbody td:nth-child(8) {
    grid-column: 1 / -1;
    padding-top: 12px;
    padding-bottom: 12px;
    background: #f7f9f8;
    border-top: 1px solid var(--line);
  }

  .business-cell,
  .cell-note {
    max-width: none;
  }

  .row-actions {
    justify-content: flex-end;
  }

  .lead-drawer {
    width: 100vw;
  }

  .drawer-header {
    padding: 15px;
  }

  .drawer-score {
    grid-template-columns: 95px 1fr;
    padding: 11px 15px;
  }

  .drawer-panel {
    padding: 16px 15px 84px;
  }

  .diagnosis-band {
    margin: -16px -15px 16px;
    padding: 14px 15px;
  }

  .sticky-form-actions {
    margin-right: -15px;
    margin-left: -15px;
    padding-right: 15px;
    padding-left: 15px;
  }

  .live-call {
    margin-right: -15px;
    margin-left: -15px;
    padding-right: 15px;
    padding-left: 15px;
  }

  .followup-item,
  .activity-item {
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 560px) {
  .topbar__actions .primary-button {
    min-width: 150px;
  }

  .section-heading {
    display: grid;
    gap: 6px;
  }

  .source-label {
    justify-self: start;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .field--location {
    grid-column: auto;
  }

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

  .sector-option {
    min-width: 0;
    white-space: normal;
  }

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

  .filter-search {
    grid-column: auto;
  }

  .list-toolbar,
  .privacy-controls {
    display: grid;
  }

  .list-toolbar .compact-actions {
    width: 100%;
  }

  .list-toolbar .secondary-button {
    flex: 1 1 50%;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    white-space: normal;
  }

  .drawer-tabs {
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(92px, 1fr));
  }

  .drawer-score {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .diagnosis-band,
  .form-grid,
  .panel-toolbar,
  .panel-toolbar--call,
  .call-result,
  .objection-grid,
  .note-composer {
    grid-template-columns: 1fr;
  }

  .diagnosis-band p,
  .field--wide {
    grid-column: auto;
  }

  .email-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .email-actions > * {
    width: 100%;
  }

  .voice-toolbar {
    align-items: end;
  }

  .voice-select {
    order: -1;
    flex-basis: 100%;
  }

  .secondary-view {
    width: calc(100vw - 24px);
  }

  .followup-item,
  .activity-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .modal-content,
  .modal-header {
    padding: 15px;
  }

  .modal-footer {
    padding-right: 15px;
    padding-left: 15px;
  }

  .duplicate-record {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
