:root {
  --ink: #182026;
  --muted: #65717c;
  --line: #d9e1e7;
  --bg: #f6f8fa;
  --panel: #ffffff;
  --yellow: #f6c445;
  --blue: #245b84;
  --danger: #a83232;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  background: #111820;
  color: white;
}
.brand { font-weight: 700; letter-spacing: .2px; }
.topbar nav { display: flex; gap: 12px; flex: 1; }
.topbar a { color: white; text-decoration: none; opacity: .92; }
.topbar form { display: flex; gap: 10px; align-items: center; margin: 0; }

main { padding: 18px; }
.page-head { margin-bottom: 14px; }
.page-head.compact { margin-bottom: 8px; }
h1, h2, h3 { margin: 0 0 6px; }
p { margin: 0 0 10px; color: var(--muted); }

button, .button {
  border: 0;
  border-radius: 6px;
  padding: 9px 13px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font: inherit;
}
button.secondary, .button.secondary { background: #637282; }
button.danger, .button.danger { background: var(--danger); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
  background: white;
}
label { display: grid; gap: 4px; font-size: 13px; color: #3a4650; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-card {
  width: min(420px, calc(100vw - 32px));
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(0,0,0,.12);
  display: grid;
  gap: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.metric span { color: var(--muted); display: block; }
.metric strong { font-size: 28px; }

.filterbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
}
.filterbar input[type="text"], .filterbar input:not([type]) { min-width: 280px; width: 320px; }
.filterbar label { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.filterbar input[type="checkbox"] { width: auto; }

.workspace {
  display: grid;
  grid-template-columns: minmax(500px, 58%) minmax(360px, 1fr);
  gap: 12px;
  min-height: calc(100vh - 150px);
}
.lead-list, .call-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}
.call-card { padding: 14px; }

table { border-collapse: collapse; width: 100%; }
th, td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}
th { background: #edf2f6; position: sticky; top: 0; z-index: 1; }
tr.selected, tr:hover { background: #fff4d2; }

.lead-summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  padding-bottom: 8px;
}
.phones { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.phones form { margin: 0; }
.phones a {
  background: #e8f1f7;
  color: var(--blue);
  padding: 6px 9px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}
.phones button { background: #1f6f8b; padding: 7px 10px; }
.call-help { font-size: 13px; }
.talk-track {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
}
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.notes-form { display: grid; gap: 10px; }
.actions, .quick-actions, .export-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.quick-actions { margin-top: 10px; }
.form-stack { display: grid; gap: 12px; max-width: 560px; }
.success, .error {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.success { background: #e8f5e9; color: #1b5e20; }
.error { background: #fdecea; color: #8a1c1c; }
.empty { padding: 30px; color: var(--muted); text-align: center; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .topbar { height: auto; padding: 12px; flex-wrap: wrap; }
  .grid2 { grid-template-columns: 1fr; }
}
