* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #d7deea;
  --primary: #1d4ed8;
  --primary-dark: #153ea8;
  --secondary: #111827;
  --danger: #b91c1c;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  --radius: 14px;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  padding: 24px;
}

.hidden {
  display: none !important;
}

.shell {
  max-width: 1200px;
  margin: 0 auto;
}

.card,
.lead-card,
.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card {
  max-width: 420px;
  margin: 60px auto 0;
  padding: 24px;
}

.app-shell {
  display: block;
}

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

.topbar h1,
.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.field {
  display: block;
  margin: 14px 0;
}

.field span {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--muted);
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 200px;
  resize: vertical;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

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

.secondary-btn,
.icon-btn {
  background: var(--secondary);
  color: #fff;
}

.icon-btn {
  width: 40px;
  height: 40px;
  font-size: 24px;
  line-height: 1;
  padding: 0;
}

.message {
  min-height: 22px;
  margin: 12px 0;
  color: var(--muted);
}

.message.error {
  color: var(--danger);
}

.lead-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.lead-card {
  padding: 16px;
}

.lead-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lead-title {
  font-size: 18px;
  font-weight: 700;
  text-transform: capitalize;
}

.lead-subtitle {
  color: var(--muted);
  margin-top: 4px;
}

.lead-status {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.lead-meta {
  font-size: 14px;
  margin-bottom: 6px;
  word-break: break-word;
}

.lead-summary {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

.lead-actions {
  margin-top: 14px;
}

.empty-state {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal {
  width: 100%;
  max-width: 760px;
  padding: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
}

.modal-body {
  margin-bottom: 14px;
}

.meta-row {
  margin-bottom: 12px;
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.meta-value {
  display: block;
  word-break: break-word;
}

.link {
  color: var(--primary);
  text-decoration: none;
}

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

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  body {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }

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