* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f4f5f7;
  color: #1a1a1a;
}
label { display: block; font-size: 13px; color: #555; margin: 10px 0 4px; }
input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
}
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d2d6;
  border-radius: 6px;
  background: #fff;
}
textarea { resize: vertical; }
button {
  cursor: pointer;
  border-radius: 6px;
  padding: 9px 16px;
  border: 1px solid #d0d2d6;
  background: #fff;
}
button:hover { background: #f0f1f3; }
button.primary {
  background: #1f4e78;
  color: #fff;
  border-color: #1f4e78;
}
button.primary:hover { background: #163a5a; }
button.ghost { background: transparent; }
.muted { color: #777; font-size: 13px; }
.error { color: #b3261e; font-size: 13px; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-wrap[hidden] { display: none; }
.login-card {
  background: #fff;
  border-radius: 10px;
  padding: 2rem;
  width: 320px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.login-card h1 { font-size: 18px; margin: 0 0 1rem; }
.login-card button { width: 100%; margin-top: 14px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: #1f4e78;
  color: #fff;
}
.topbar .brand { font-weight: 600; }
.tabs { display: flex; gap: 4px; margin-left: 24px; }
.tab-btn {
  background: transparent;
  border: none;
  color: #cfe0ee;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
}
.tab-btn:hover { background: rgba(255,255,255,0.1); }
.tab-btn.active { background: rgba(255,255,255,0.18); color: #fff; font-weight: 500; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 1100px; }
.table-scroll td, .table-scroll th { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .muted { color: #d8e3ec; }
.topbar button.ghost { color: #fff; border-color: rgba(255,255,255,0.4); }
.topbar button.ghost:hover { background: rgba(255,255,255,0.1); }

.content { max-width: 1100px; margin: 0 auto; padding: 20px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
}
.stat-label { font-size: 13px; color: #666; margin: 0 0 4px; }
.stat-value { font-size: 26px; font-weight: 600; margin: 0; }
.stat-value.danger { color: #b3261e; }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar input[type=text] { flex: 1; }
.toolbar select { width: 160px; }

.table-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 12px;
  color: #666;
  font-weight: 500;
  border-bottom: 1px solid #eaeaea;
  background: #fafafa;
}
td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f7f9fb; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: #eef0f3; }
.badge-Won { background: #e2f3e5; color: #1e6b30; }
.badge-Lost { background: #fbe4e4; color: #9c2b2b; }
.badge-Negotiation { background: #eee6fb; color: #5a3c9c; }
.badge-Interested { background: #fdf1d8; color: #8a5b0c; }
.badge-Contacted { background: #e3edfb; color: #2a5b9c; }
.badge-New { background: #eee; color: #555; }
.overdue { color: #b3261e; font-weight: 600; }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 10;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  width: 380px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h2 { margin: 0 0 4px; font-size: 16px; }
.modal-divider { border: none; border-top: 1px solid #eee; margin: 14px 0; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions button { flex: 1; }
.history-item { font-size: 13px; padding: 6px 0; border-bottom: 1px solid #f0f0f0; }
.history-item:last-child { border-bottom: none; }
