:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #686d76;
  --line: #d9dde3;
  --panel: #ffffff;
  --panel-alt: #f7f8fa;
  --field: #eef1f5;
  --brand: #111827;
  --blue: #2557a7;
  --blue-soft: #e8f0ff;
  --green: #0b7a4b;
  --green-soft: #e5f6ed;
  --amber: #99620d;
  --amber-soft: #fff4d9;
  --red: #aa2e25;
  --red-soft: #ffe8e4;
  --violet: #5e3a9f;
  --violet-soft: #efe8ff;
  --shadow: 0 18px 40px rgba(20, 27, 40, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f5f7;
  color: var(--ink);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 22px;
}

.simple-topbar {
  align-items: center;
}

.brand-lockup {
  display: grid;
  gap: 2px;
  min-width: 190px;
}

.brand-title {
  font-size: 18px;
  font-weight: 780;
  letter-spacing: 0;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

.call-page {
  display: grid;
  gap: 14px;
  max-width: 920px;
  margin: 0 auto;
}

.call-toolbar {
  display: flex;
  justify-content: flex-end;
}

.nav {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.nav a {
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #424854;
  font-size: 14px;
  font-weight: 720;
  padding: 9px 12px;
  white-space: nowrap;
}

.nav a.active {
  background: var(--brand);
  color: #fff;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 22px 44px;
}

.login-wrap {
  align-items: center;
  display: grid;
  min-height: 100vh;
}

.login-panel {
  justify-self: center;
  max-width: 420px;
  width: min(100%, 420px);
}

.login-brand {
  margin-bottom: 8px;
}

.login-button {
  margin-top: 4px;
  width: 100%;
}

.sign-out {
  white-space: nowrap;
}

.account-grid {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}

.account-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.account-item {
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
}

.account-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

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

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  margin-bottom: 6px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: 0;
  line-height: 1.08;
}

h2 {
  font-size: 19px;
  letter-spacing: 0;
}

h3 {
  font-size: 15px;
  letter-spacing: 0;
}

.lede {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 8px;
  max-width: 760px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
}

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: 18px;
}

.panel-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 16px 18px;
}

.panel-body {
  padding: 18px;
}

.upload-zone {
  align-items: center;
  background: var(--panel-alt);
  border: 1px dashed #aeb6c2;
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  justify-items: center;
  min-height: 250px;
  padding: 28px;
  text-align: center;
}

.upload-zone.drag {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.import-name-field {
  margin-top: 14px;
}

.upload-mark {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.upload-mark svg,
.button svg,
.icon-button svg {
  display: block;
  height: 18px;
  width: 18px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.icon-button,
.text-link {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  font-weight: 760;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 10px 13px;
}

.button {
  background: #fff;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

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

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

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

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

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

.button.soft {
  background: var(--panel-alt);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.icon-button {
  background: #fff;
  height: 42px;
  padding: 0;
  width: 42px;
}

.stat {
  display: grid;
  gap: 6px;
}

.stat-value {
  font-size: 30px;
  font-weight: 820;
  letter-spacing: 0;
  line-height: 1;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.stat.good .stat-value {
  color: var(--green);
}

.stat.warn .stat-value {
  color: var(--amber);
}

.stat.bad .stat-value {
  color: var(--red);
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.call-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.lead-stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 620px;
}

.call-card {
  min-height: calc(100vh - 150px);
}

.lead-header {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding: 24px;
}

.lead-title-row {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.lead-name {
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 840;
  letter-spacing: 0;
  line-height: 1;
  overflow-wrap: anywhere;
}

.lead-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 650;
  gap: 8px;
}

.lead-meta span {
  align-items: center;
  background: var(--field);
  border-radius: 999px;
  display: inline-flex;
  min-height: 30px;
  padding: 5px 10px;
}

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

.lead-detail {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
}

.lead-detail span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
  text-transform: uppercase;
}

.lead-detail strong {
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

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

.call-button {
  min-height: 68px;
  font-size: 20px;
}

.outcome-area {
  display: grid;
  gap: 18px;
  padding: 24px;
}

.outcome-head {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

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

.outcome-button {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  font-size: 18px;
  font-weight: 780;
  gap: 10px;
  justify-content: space-between;
  min-height: 78px;
  padding: 16px;
  text-align: left;
}

.outcome-button.good {
  background: var(--green-soft);
  border-color: #aad9bd;
  color: #0b5f3d;
}

.outcome-button.neutral {
  background: var(--blue-soft);
  border-color: #bad0f4;
  color: #1e4f99;
}

.outcome-button.warn {
  background: var(--amber-soft);
  border-color: #e6c87e;
  color: #7b4d04;
}

.outcome-button.bad {
  background: var(--red-soft);
  border-color: #efbbb3;
  color: #8d241d;
}

.queue-list {
  display: grid;
  gap: 10px;
}

.queue-item {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 3px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.queue-item.current {
  border-color: var(--brand);
  box-shadow: inset 3px 0 0 var(--brand);
}

.queue-name {
  font-weight: 780;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 760;
  min-height: 25px;
  padding: 4px 9px;
  white-space: nowrap;
}

.badge.new,
.badge.neutral {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.good {
  background: var(--green-soft);
  color: var(--green);
}

.badge.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.bad {
  background: var(--red-soft);
  color: var(--red);
}

.toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.field select,
.field input {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 42px;
  min-width: 190px;
  padding: 9px 11px;
  width: 100%;
}

.table-wrap {
  overflow-x: auto;
}

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

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

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

td {
  font-size: 14px;
}

.bar-track {
  background: var(--field);
  border-radius: 999px;
  height: 9px;
  min-width: 120px;
  overflow: hidden;
}

.bar {
  background: var(--green);
  height: 100%;
}

.bar.warn {
  background: var(--amber);
}

.bar.bad {
  background: var(--red);
}

.breakpoint-list {
  display: grid;
  gap: 10px;
}

.breakpoint {
  display: grid;
  gap: 6px;
}

.breakpoint-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.breakpoint-name {
  font-weight: 740;
}

.breakpoint-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.empty {
  align-items: center;
  background: var(--panel-alt);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  justify-items: center;
  min-height: 220px;
  padding: 30px;
  text-align: center;
}

.empty p {
  color: var(--muted);
  line-height: 1.45;
  max-width: 480px;
}

.import-preview {
  display: grid;
  gap: 12px;
}

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

.mapping-item {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  padding: 12px;
}

.mapping-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.mapping-value {
  font-weight: 780;
  overflow-wrap: anywhere;
}

.result-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.count-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 7px;
  min-height: 82px;
  padding: 13px;
}

.count-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.count-card strong {
  font-size: 28px;
  line-height: 1;
}

.batch-progress {
  display: grid;
  gap: 10px;
}

.progress-line {
  background: var(--field);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
}

.progress-fill {
  background: var(--green);
  height: 100%;
}

.toast {
  align-items: center;
  background: #111827;
  border-radius: var(--radius);
  bottom: 18px;
  box-shadow: var(--shadow);
  color: #fff;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  left: 50%;
  max-width: min(460px, calc(100vw - 24px));
  padding: 10px 10px 10px 14px;
  position: fixed;
  transform: translateX(-50%);
  width: 100%;
  z-index: 20;
}

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

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

.profile-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 14px;
}

.profile-card strong {
  font-size: 18px;
  line-height: 1.15;
}

.query-box {
  background: #111827;
  border-radius: var(--radius);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  padding: 16px;
}

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

.followup-item {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

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

.small {
  font-size: 13px;
}

.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

@media (max-width: 980px) {
  .topbar-inner {
    align-items: center;
    flex-wrap: wrap;
  }

  .nav {
    justify-content: center;
    order: 3;
    width: 100%;
  }

  .top-actions {
    justify-content: space-between;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .call-layout,
  .account-grid,
  .metric-strip,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .lead-stage {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 14px 10px calc(34px + env(safe-area-inset-bottom));
  }

  .topbar-inner {
    gap: 10px;
    padding: 10px 12px;
  }

  .brand-lockup {
    min-width: 0;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .nav a {
    flex: 1;
    padding: 9px 8px;
    text-align: center;
  }

  .sign-out {
    min-height: 36px;
    padding: 8px 10px;
  }

  .page-head,
  .lead-title-row,
  .outcome-head,
  .followup-item {
    align-items: stretch;
    flex-direction: column;
  }

  .lead-actions,
  .outcome-grid,
  .lead-detail-grid,
  .mapping-grid,
  .profile-grid,
  .result-grid.compact {
    grid-template-columns: 1fr;
  }

  .call-toolbar {
    justify-content: stretch;
  }

  .call-toolbar .field,
  .call-toolbar select {
    width: 100%;
  }

  .call-card {
    min-height: auto;
  }

  .lead-header,
  .outcome-area {
    padding: 16px;
  }

  .call-button {
    font-size: 18px;
    min-height: 64px;
  }

  .outcome-button {
    font-size: 17px;
    min-height: 66px;
  }

  .upload-zone {
    min-height: 210px;
    padding: 22px;
  }

  .toast {
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
}
