:root {
  --bg: #f4f7f9;
  --panel: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #d9e2e7;
  --brand: #075e54;
  --brand-2: #0f766e;
  --accent: #f59e0b;
  --danger: #dc2626;
  --good: #15803d;
  --soft: #e8f7f3;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 18px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; color: var(--brand); }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 13px; }
nav { display: flex; gap: 14px; overflow-x: auto; white-space: nowrap; font-size: 14px; font-weight: 800; color: var(--brand); }
.shell { width: min(1360px, 100%); margin: 0 auto; padding: 18px; }
.flash, .missed-alert {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border-radius: 8px; margin-bottom: 14px;
}
.flash { background: #ecfdf5; border: 1px solid #99f6e4; color: var(--brand); font-weight: 800; }
.missed-alert { background: #fff1f2; border: 1px solid #fecdd3; color: #9f1239; }
.missed-alert a { padding: 8px 12px; border-radius: 8px; background: #fff; font-weight: 900; }
.desk-hero, .form-hero {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 10px 0 16px;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
h1 { margin: 0 0 5px; font-size: 30px; letter-spacing: 0; }
h2 { margin: 0 0 12px; font-size: 18px; letter-spacing: 0; }
p { margin: 0; }
.desk-hero p, .form-hero p, .muted { color: var(--muted); }
.button {
  min-height: 46px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 8px;
  padding: 0 18px; background: var(--brand-2); color: white; font-weight: 900; cursor: pointer;
}
.button.ghost { background: var(--soft); color: var(--brand); border: 1px solid #b6dfd8; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 14px 0; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.stat strong { display: block; font-size: 30px; color: var(--brand); line-height: 1; }
.stat span { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; font-weight: 800; }
.stat.danger strong, .lead-card.overdue h2 { color: var(--danger); }
.stat.hot strong, .lead-card.hot h2 { color: #b45309; }
.stat.closed strong { color: var(--good); }
.pipeline, .quick-tabs { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 12px; }
.pipeline a {
  min-width: 138px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px;
  display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 900;
}
.pipeline strong { color: var(--brand); }
.quick-tabs a {
  background: var(--soft); color: var(--brand); border: 1px solid #b6dfd8; padding: 10px 14px; border-radius: 8px; font-weight: 900; white-space: nowrap;
}
.searchbar { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 12px 0; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: 7px; color: #344054; font-weight: 800; font-size: 14px; }
.lead-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lead-card {
  background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--brand-2); border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05); overflow: hidden;
}
.lead-card.overdue { border-left-color: var(--danger); background: #fffafa; }
.lead-card.hot { border-left-color: var(--accent); background: #fffaf0; }
.lead-card.closed { border-left-color: var(--good); }
.lead-card.lost { border-left-color: #64748b; opacity: .86; }
.lead-main { display: block; padding: 15px; }
.lead-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lead-head h2 { margin: 0 0 5px; font-size: 20px; }
.lead-head p, .last-note { color: var(--muted); font-size: 14px; }
.stage-pill {
  flex: 0 0 auto; padding: 6px 9px; background: var(--soft); color: var(--brand); border-radius: 999px; font-size: 12px; font-weight: 900;
}
.lead-meta, .follow-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 13px; color: #475467;
}
.lead-meta span, .follow-chip, .value-chip { background: #f8fafc; border: 1px solid #e5edf2; border-radius: 999px; padding: 6px 9px; }
.follow-chip { color: var(--brand); font-weight: 900; }
.value-chip { color: #7c2d12; font-weight: 900; }
.last-note { margin-top: 12px; line-height: 1.45; }
.lead-actions { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.lead-actions a { text-align: center; padding: 12px 8px; font-weight: 900; color: var(--brand); border-right: 1px solid var(--line); }
.lead-actions a:last-child { border-right: 0; }
.login-card, .form-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.login-card { max-width: 440px; margin: 54px auto; padding: 24px; }
.login-card form { display: grid; gap: 14px; margin-top: 18px; }
.lead-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.lead-form.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-panel { padding: 16px; display: grid; gap: 12px; }
.form-panel h2 { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.full { grid-column: 1 / -1; }
.sticky-save { grid-column: 1 / -1; width: 100%; }
.form-actions { display: flex; gap: 10px; }
.history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.note { border-top: 1px solid var(--line); padding: 11px 0; }
.note span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.note p { margin-top: 8px; color: #344054; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 10px 8px; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.empty { padding: 30px; text-align: center; border: 1px dashed var(--line); border-radius: 8px; background: #fff; color: var(--muted); grid-column: 1 / -1; }
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .lead-list, .lead-form, .history-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 11px; }
  nav { width: 100%; }
  .shell { padding: 12px; }
  .desk-hero, .form-hero { align-items: stretch; flex-direction: column; }
  .hero-actions { justify-content: stretch; }
  .hero-actions .button { flex: 1 1 auto; }
  h1 { font-size: 25px; }
  .searchbar { grid-template-columns: 1fr; }
  .stats { gap: 8px; }
  .stat { padding: 13px; }
  .stat strong { font-size: 26px; }
  .pipeline a { min-width: 128px; }
  .lead-actions a { padding: 13px 6px; }
}
