:root {
  --ink: #101113;
  --muted: #64676c;
  --line: #d7d9dd;
  --panel: #ffffff;
  --page: #f4f4f5;
  --accent: #101113;
  --accent-dark: #2b2d31;
  --warning: #8a6200;
  --danger: #a02d2d;
  --shadow: 0 18px 45px rgba(16, 17, 19, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--page); }
button, input, select, textarea { font: inherit; }
button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}
.primary { color: #fff; background: var(--accent); }
.primary:hover { background: var(--accent-dark); }
.secondary, .ghost { color: var(--ink); background: #fff; border-color: var(--line); }
.danger { color: #fff; background: var(--danger); }
.hidden { display: none !important; }

.app-shell { display: grid; grid-template-columns: 330px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); background: #eceef1; padding: 22px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid #cfd2d7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(16, 17, 19, 0.08);
}
.brand-mark img { display: block; width: 48px; height: 48px; object-fit: contain; }
h1, h2, h3, h4, p { margin: 0; }
.brand h1 { font-size: 22px; }
.brand p, .helper-text, .topbar p, .section-title span, .lead-card p, .lead-meta dt { color: var(--muted); }
.panel { padding: 16px 0; border-top: 1px solid var(--line); }
.panel h2 { margin-bottom: 12px; font-size: 14px; text-transform: uppercase; color: var(--muted); }
.helper-text { margin: 10px 0 0; font-size: 13px; line-height: 1.45; }
.config-warning {
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #e5c57b;
  border-radius: 6px;
  background: #fff7df;
  color: #6d4b00;
  font-size: 13px;
  line-height: 1.4;
}

.status-message {
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid #cfd2d7;
  border-radius: 6px;
  background: #f8f8f9;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

.status-message.error {
  border-color: #df9a9a;
  background: #fff1f1;
  color: #7b1e1e;
}

.status-message.success {
  border-color: #9bc5a8;
  background: #eef8f1;
  color: #1f5a36;
}
.field, .check { display: grid; gap: 8px; margin-bottom: 12px; }
.check { grid-template-columns: 18px 1fr; align-items: center; }
.file-drop {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px dashed #aeb2b8;
  border-radius: 8px;
  background: #fff;
}
.field input, .field select, .field textarea, .section-title input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
}
.field input, .field select, .section-title input { min-height: 38px; }
.field textarea { min-height: 110px; resize: vertical; }

.workspace { display: grid; gap: 18px; padding: 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.actions { display: flex; gap: 8px; }
.setup-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #cfd2d7;
  border-radius: 8px;
  background: #f0f1f3;
}
.setup-strip span { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 12px; }
.stats div, .current, .active, .queue-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.stats div { padding: 16px; }
.stats strong { display: block; font-size: 28px; }
.stats span { color: var(--muted); }
.dial-area { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(360px, 0.85fr); gap: 18px; }
.current, .active, .queue-table { padding: 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.lead-empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}
.lead-card { display: grid; gap: 18px; }
.lead-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.lead-head h3 { font-size: 30px; }
.badge { border-radius: 999px; padding: 6px 10px; background: #eceef1; color: var(--ink); font-size: 12px; font-weight: 800; }
.lead-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.lead-meta div { min-height: 72px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8f8f9; }
.lead-meta dt { margin-bottom: 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.lead-meta dd { margin: 0; overflow-wrap: anywhere; }
.call-controls { display: flex; gap: 8px; }
.call-controls .primary { min-width: 120px; }
.active-list { display: grid; gap: 10px; }
.active-call { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8f8f9; }
.dispositions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qualification { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.qualification h4 { margin: 0 0 10px; font-size: 14px; }
.qual-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.qual-grid .wide { grid-column: 1 / -1; }
.table-wrap { overflow: auto; max-height: 38vh; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: #fff; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.pill { display: inline-flex; border-radius: 999px; padding: 4px 8px; background: #eceef1; font-size: 12px; font-weight: 800; }
.pill.done { background: #101113; color: #fff; }

@media (max-width: 980px) {
  .app-shell, .dial-area { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .stats { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .topbar { align-items: flex-start; flex-direction: column; }
}
