:root {
  --navy: #12233f;
  --ink: #1a2436;
  --paper: #eef2f6;
  --card: #ffffff;
  --line: #d8e0ea;
  --muted: #5e6b7c;
  --copper: #d3541a;
  --copper-dark: #b54312;
  --danger: #b42318;
  --ok: #157347;
  --shadow: 0 12px 32px rgba(18, 35, 63, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

.is-hidden { display: none !important; }

.eyebrow {
  margin: 0 0 2px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--copper);
  font-weight: 700;
}

h1 { margin: 0 0 8px; font-size: 28px; color: var(--navy); }
h2 { margin: 0 0 4px; font-size: 22px; color: var(--navy); }
h3 { margin: 0; font-size: 20px; color: var(--navy); }
.muted { color: var(--muted); margin: 0; line-height: 1.45; }
.error { color: var(--danger); margin: 8px 0 0; font-size: 14px; }
.banner { padding: 10px 12px; background: #fdecec; border-radius: 10px; }
.status { margin: 10px 0 0; color: var(--ok); font-size: 13px; font-weight: 600; }

button, input, textarea { font: inherit; }
button {
  background: var(--copper);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
}
button:hover { background: var(--copper-dark); }
button:disabled { opacity: 0.65; cursor: wait; }
.btn-light {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.btn-light:hover { background: rgba(255, 255, 255, 0.22); }
.btn-light.dark {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--line);
}
.btn-light.dark:hover { background: #f3f6fa; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  color: var(--navy);
}
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
}
input:focus, textarea:focus {
  outline: 2px solid rgba(211, 84, 26, 0.28);
  border-color: var(--copper);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--navy);
}
.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-card form { display: grid; gap: 14px; margin-top: 18px; }
.auth-card button { width: 100%; }

.app-shell { min-height: 100vh; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--navy);
  color: white;
}
.brand { display: flex; align-items: center; gap: 12px; }
.topbar .eyebrow { color: #f0b089; }
.topbar-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.header-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e8edf5;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}
.stat-pill strong { color: #fff; font-size: 14px; margin-left: 2px; }
#user-label { color: #d7deea; font-size: 14px; }

.wrap { width: min(1120px, calc(100% - 32px)); margin: 24px auto 40px; }
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar-actions { display: flex; gap: 10px; align-items: center; }
.toolbar-actions input { width: 280px; }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: auto;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: middle;
}
th {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f7f9fc;
}
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fff4ec; }
td.company, td.email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.open-link { color: var(--copper); font-weight: 700; font-size: 13px; }

.empty {
  padding: 36px 20px;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
}
.empty strong { display: block; color: var(--navy); margin-bottom: 6px; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 35, 63, 0.45);
  z-index: 20;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(460px, 100%);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 20px;
  overflow: auto;
  z-index: 21;
}
.drawer-head, .drawer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.lead-form { margin-top: 16px; }
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.full { grid-column: 1 / -1; }
.drawer-actions { margin-top: 18px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  z-index: 30;
  font-size: 14px;
  font-weight: 650;
}

@media (max-width: 800px) {
  .toolbar, .topbar { flex-direction: column; align-items: stretch; }
  .toolbar-actions, .topbar-actions { width: 100%; }
  .toolbar-actions input { width: 100%; }
  .grid { grid-template-columns: 1fr; }
}
