:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --text: #182235;
  --muted: #627086;
  --line: #dde5f0;
  --blue: #1f6feb;
  --blue-dark: #174ea6;
  --green: #16845b;
  --yellow: #b7791f;
  --red: #c93c37;
  --ink: #10233f;
  --shadow: 0 12px 28px rgba(24, 34, 53, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 34px;
  box-shadow: var(--shadow);
}
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}
.login-card h1 { margin: 18px 0 8px; font-size: 1.65rem; }
.login-card p { margin: 0 0 24px; color: var(--muted); line-height: 1.45; }
.login-card form { display: grid; gap: 10px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}
.form-error { min-height: 18px; color: var(--red); font-size: 0.85rem; }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 1.25rem; }
.eyebrow {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.session-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  color: var(--muted);
  font-size: 0.84rem;
  background: #fff;
}
.session-pill.live { color: var(--green); border-color: rgba(22, 132, 91, 0.35); background: #f0fbf6; }
.session-pill.warn { color: var(--yellow); border-color: rgba(183, 121, 31, 0.35); background: #fff9ec; }

.command-bar {
  display: grid;
  grid-template-columns: 220px auto auto auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.primary-button, .secondary-button, .danger-button, .ghost-button {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 13px;
  font-weight: 700;
}
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-dark); }
.secondary-button { background: #eef4ff; color: var(--blue-dark); border-color: #cdddf8; }
.danger-button { background: #fff1f0; color: var(--red); border-color: #f4c8c6; }
.ghost-button, .link-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.link-button {
  border: 0;
  padding: 0;
  color: var(--blue);
  font-weight: 700;
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 330px minmax(480px, 1fr) 310px;
  gap: 16px;
  padding: 16px;
}
.lead-rail, .call-stage, .insight-rail { min-height: 0; }
.lead-rail, .insight-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.filters, .selection-row, .panel, .current-call, .history-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.filters { padding: 12px; display: grid; gap: 9px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.88rem; }
.checkbox-line input { width: auto; }
.selection-row {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.88rem;
}
.lead-list {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.lead-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f7;
  align-items: start;
}
.lead-item:last-child { border-bottom: 0; }
.lead-item:hover { background: var(--panel-soft); }
.lead-item input { width: 16px; height: 16px; margin-top: 3px; }
.lead-name { font-weight: 750; font-size: 0.91rem; }
.lead-meta { color: var(--muted); font-size: 0.78rem; margin-top: 2px; line-height: 1.35; }
.lead-status {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #a0aec0;
  margin-top: 6px;
}
.lead-status.interested { background: var(--green); }
.lead-status.callback { background: #d69e2e; }
.lead-status.not-interested, .lead-status.wrong-number { background: var(--red); }
.lead-status.voicemail { background: #3182ce; }

.call-stage {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 12px;
  min-width: 0;
}
.current-call { padding: 18px; overflow: auto; }
.empty-panel {
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}
.empty-panel h2 { margin: 12px 0 6px; color: var(--text); }
.empty-icon {
  margin: 0 auto;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  font-weight: 800;
}
.call-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}
.call-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.call-header h2 { margin: 0; font-size: 1.45rem; }
.call-company { color: var(--muted); margin-top: 2px; }
.call-pill {
  height: max-content;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--green);
  background: #f0fbf6;
  border: 1px solid rgba(22, 132, 91, 0.25);
  font-size: 0.82rem;
  font-weight: 800;
}
.contact-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.contact-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.84rem;
  text-decoration: none;
  background: #fff;
}
textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}
.dispositions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.disp-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 11px;
  color: var(--text);
}
.disp-button.active { border-color: var(--blue); color: var(--blue); background: #f0f6ff; }
.next-button { width: 100%; margin-top: 4px; }

.copilot {
  background: var(--panel-soft);
  border: 1px solid #cfdbec;
  border-radius: 8px;
  padding: 14px;
}
.copilot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.score {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--green) calc(var(--score, 0) * 1%), #e5edf6 0);
  font-weight: 850;
}
.score span {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
}
.copilot-section {
  border-top: 1px solid #dde7f4;
  margin-top: 12px;
  padding-top: 12px;
}
.panel-label, .copilot-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.copilot-action {
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 10px;
  line-height: 1.35;
}
.copilot-list {
  display: grid;
  gap: 7px;
  color: #2f3d52;
  font-size: 0.86rem;
  line-height: 1.35;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid #c9d6e8;
  border-radius: 999px;
  background: #fff;
  padding: 6px 9px;
  color: var(--ink);
  font-size: 0.78rem;
}
.history-panel { overflow: hidden; }
.history-toggle {
  width: 100%;
  border: 0;
  background: #fff;
  padding: 12px 14px;
  text-align: left;
  font-weight: 800;
}
.history { border-top: 1px solid var(--line); max-height: 220px; overflow: auto; }
.history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf2f7;
}
.history-row:last-child { border-bottom: 0; }
.history-row strong { display: block; }
.history-row span { color: var(--muted); font-size: 0.82rem; }
.panel { padding: 14px; }
.panel h2 { margin: 0 0 8px; font-size: 1rem; }
.panel p, .panel li { color: var(--muted); line-height: 1.45; font-size: 0.9rem; }
.panel ul { margin: 0; padding-left: 18px; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 340px;
  background: var(--ink);
  color: #fff;
  padding: 11px 13px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 310px minmax(0, 1fr); }
  .insight-rail { display: none; }
}
@media (max-width: 820px) {
  .topbar, .command-bar { grid-template-columns: 1fr; height: auto; align-items: stretch; }
  .topbar { display: grid; }
  .topbar-actions { justify-content: space-between; }
  .workspace { grid-template-columns: 1fr; padding: 10px; }
  .lead-list { max-height: 320px; }
  .call-grid { grid-template-columns: 1fr; }
}
