:root {
  --primary: #7c5cff;
  --primary-dark: #5b3df0;
  --teal: #0ea672;
  --teal-dark: #0a363f;
  --gradient: linear-gradient(90deg, #7c5cff 0%, #4f7cff 50%, #0ea672 100%);
  --amber: #f59e0b;
  --bg: #f6f5fc;
  --card: #ffffff;
  --text: #1e1b2e;
  --text-light: #6b7280;
  --border: #e7e4f7;
  --danger: #ef4444;
  --success: #0ea672;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(circle at top, #efeaff 0%, var(--bg) 60%);
}

.auth-card {
  background: var(--card);
  border-radius: 18px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 40px rgba(124, 92, 255, 0.16);
  border: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--amber);
}

.logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 2px 6px;
}

.brand h1 {
  font-size: 18px;
  margin: 0;
  color: var(--text);
  font-weight: 700;
}

.brand span.sub {
  display: block;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin: 14px 0 6px;
  color: var(--text-light);
}

input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}

button { cursor: pointer; font-family: inherit; border: none; }

.btn-primary {
  width: 100%;
  background: var(--gradient);
  color: #fff;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  margin-top: 20px;
  box-shadow: 0 6px 16px rgba(124, 92, 255, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(124, 92, 255, 0.35); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-gradient-block {
  width: 100%;
  background: var(--gradient);
  color: #fff;
  padding: 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.25);
}
.btn-gradient-block:hover { box-shadow: 0 8px 22px rgba(124, 92, 255, 0.32); }
.btn-gradient-block:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-half {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.btn-half.front { background: linear-gradient(90deg, #7c5cff, #4f7cff); }
.btn-half.back { background: linear-gradient(90deg, #4f7cff, #0ea672); }
.btn-half:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}
.btn-secondary:hover { background: #f4f2fc; border-color: var(--primary); }

.btn-link {
  background: none;
  color: var(--text-light);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
}

.btn-whatsapp {
  background: #1ea952;
  color: #fff;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}
.btn-whatsapp:hover { background: #168a42; }

.btn-danger {
  background: #fff;
  border: 1.5px solid var(--danger);
  color: var(--danger);
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}
.btn-danger:hover { background: #fdecea; }

.btn-edit {
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--text);
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}
.btn-edit:hover { border-color: var(--primary); color: var(--primary); }

.error-msg {
  background: #fdecea;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-top: 14px;
  display: none;
}

.success-msg {
  background: #e6f9f0;
  color: var(--success);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-top: 14px;
  display: none;
}

/* App shell (dashboard pages) */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar .brand { margin-bottom: 0; }
.topbar .brand span.sub { color: var(--text-light); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}
.topbar-right a, .topbar-right span.linklike { color: var(--text-light); text-decoration: none; cursor: pointer; font-weight: 600; }
.topbar-right a:hover, .topbar-right span.linklike:hover { color: var(--primary); }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 14px rgba(124, 92, 255, 0.07);
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 15px;
  margin: 0 0 4px;
  color: var(--text);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .row { grid-template-columns: 1fr; }
}

.hint-text {
  font-size: 13px;
  color: var(--text-light);
  margin: 4px 0 16px;
}

/* Status pills row (front/back scanned status) */
.status-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f1effc;
  color: var(--text-light);
}
.pill.done { background: #e6f9f0; color: var(--success); }
.pill .dot-sm { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Upload zones */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  padding: 24px 12px;
  color: var(--text-light);
  cursor: pointer;
  font-size: 13px;
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fafafe;
}
.upload-zone:hover { border-color: var(--primary); background: #f7f5ff; }
.upload-zone img { max-width: 100%; max-height: 160px; border-radius: 10px; margin-top: 8px; object-fit: contain; }
.upload-zone.filled { border-style: solid; border-color: var(--success); background: #fff; }
.upload-zone.scanning { border-color: var(--amber); }

.upload-label {
  position: absolute;
  top: 8px; left: 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--primary);
}
.optional-tag { color: var(--text-light); font-weight: 400; letter-spacing: 0; }

.zone-status {
  font-size: 12px;
  font-weight: 700;
  color: var(--success);
  margin-top: 6px;
}

.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.loading-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid #ffffff55;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
.loading-spinner-dark {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#employeesList, #allContactsList, #contactsList {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#employeesList table, #allContactsList table, #contactsList table {
  min-width: 600px;
}
th, td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th { color: var(--text-light); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; }
tr:hover td { background: #faf9ff; }

.name-cell { display: flex; align-items: center; gap: 8px; }
.avatar-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-yes { background: #e6f9f0; color: var(--success); }
.badge-no { background: #f1effc; color: var(--text-light); }
.badge-company { background: #eef0ff; color: var(--primary-dark); }

.empty-state {
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  padding: 28px 0;
}

.section-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-light);
  background: #f1effc;
  padding: 3px 10px;
  border-radius: 999px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.merged-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-dark);
  background: #eef0ff;
  padding: 3px 10px;
  border-radius: 999px;
}

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(30, 27, 46, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 460px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
