/* Mobile-first, large touch targets, no framework. */
:root {
  --red: #fdd8d8;
  --red-border: #d9534f;
  --yellow: #fff3c4;
  --yellow-border: #d9a406;
  --green: #d9f2d9;
  --green-border: #3c9a3c;
  --ink: #1a1a1a;
  --muted: #666;
  --line: #ddd;
  --accent: #1a5fb4;
  --bg: #f6f6f4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 17px;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 12px 80px;
}

/* Tab bar: fixed to bottom on phones so it's thumb-reachable. */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.tab.active { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.badge {
  background: var(--red-border);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

h1 { font-size: 22px; margin: 8px 0 16px; }

/* Forms */
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 4px; }
input[type=text], input[type=tel], input[type=email], input[type=date],
input[type=number], input[type=password], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font-size: 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
textarea { min-height: 80px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 20px;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  width: 100%;
  cursor: pointer;
}
button.secondary, .btn.secondary { background: #e8e8e5; color: var(--ink); }
button.danger, .btn.danger { background: #b3261e; }

/* Admin-only delete confirmation on the lead edit screen */
.confirm-delete { display: block; font-weight: 400; margin-bottom: 8px; }
.confirm-delete input[type=checkbox] { margin-right: 8px; }

/* Company toggle: 3 big buttons */
.company-toggle { display: flex; gap: 8px; }
.company-toggle input[type=radio] { position: absolute; opacity: 0; }
.company-toggle label {
  flex: 1;
  margin: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
}
.company-toggle input:checked + label {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.flash {
  background: var(--green);
  border: 1px solid var(--green-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  font-weight: 600;
}
.flash.error { background: var(--red); border-color: var(--red-border); }

/* Lead list rows */
.lead-row {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--ink);
}
.lead-row.red { background: var(--red); border-left-color: var(--red-border); }
.lead-row.yellow { background: var(--yellow); border-left-color: var(--yellow-border); }
.lead-row.green { background: var(--green); border-left-color: var(--green-border); }
.lead-row .row-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; }
.lead-row .row-sub { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; margin-top: 4px; }
.pill {
  font-size: 11px;
  font-weight: 700;
  background: #eee;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.pill.warn { background: var(--yellow); border-color: var(--yellow-border); }

/* Dashboard */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 15px; }
th { font-size: 13px; color: var(--muted); }
td.num, th.num { text-align: right; }

.empty { color: var(--muted); text-align: center; padding: 24px 0; }

@media (min-width: 700px) {
  .tabbar { position: sticky; top: 0; bottom: auto; border-top: none; border-bottom: 1px solid var(--line); }
  main { padding-bottom: 24px; }
}
