:root {
  --primary: #b5651d;
  --primary-dark: #8a4a12;
  --accent: #2f6f4f;
  --bg: #f7f3ec;
  --card-bg: #ffffff;
  --border: #e4dccd;
  --text: #2b2621;
  --muted: #7a7167;
  --busy: #c0392b;
  --free: #2f6f4f;
}

* {
  box-sizing: border-box;
}

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

nav {
  background: var(--primary);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

nav .brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  margin-right: 12px;
}

nav a {
  color: #fce8d5;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}

nav a:hover,
nav a.active {
  background: var(--primary-dark);
  color: #fff;
}

main {
  max-width: 1000px;
  margin: 30px auto;
  padding: 0 20px;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 24px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

form label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
  font-size: 0.9rem;
}

form input,
form select,
form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  background: #fffdfa;
}

form textarea {
  resize: vertical;
  min-height: 90px;
}

button {
  margin-top: 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: var(--primary-dark);
}

button.secondary {
  background: var(--accent);
}

button.secondary:hover {
  background: #23543b;
}

.msg {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  display: none;
}

.msg.success {
  background: #e3f3e8;
  color: #23543b;
  display: block;
}

.msg.error {
  background: #fbe4e1;
  color: #a3271c;
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.status-pill.busy {
  background: var(--busy);
}

.status-pill.free {
  background: var(--free);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.emp-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.emp-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.emp-card .role {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.emp-card .detail {
  font-size: 0.88rem;
  margin-top: 4px;
}

.refresh-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.small-muted {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Nav utilities */
nav {
  justify-content: space-between;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-user {
  color: #fce8d5;
  font-size: 0.88rem;
  font-weight: 500;
}

.logout-btn {
  background: transparent;
  color: #fce8d5;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
  margin-top: 0;
  transition: all 0.15s ease;
}

.logout-btn:hover {
  background: var(--primary-dark);
  color: #fff;
  border-color: #fff;
}

/* Login Page Styles */
.login-container {
  max-width: 420px;
  margin: 60px auto;
  padding: 0 16px;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header .logo-icon {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 8px;
}

.login-header h1 {
  font-size: 1.5rem;
  margin: 0 0 6px;
  color: var(--text);
}

.login-header p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 42px;
}

.toggle-password {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  margin-top: 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-password:hover {
  background: none;
  color: var(--text);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  margin: 14px 0 18px;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Status Pill Variations */
.status-pill.pending {
  background: #d97706;
  color: #fff;
}

.status-pill.supplied {
  background: #059669;
  color: #fff;
}

.status-pill.cancelled {
  background: #dc2626;
  color: #fff;
}

/* Filter Tabs */
.tabs-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: rgba(181, 101, 29, 0.08);
  color: var(--primary-dark);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
}

.count-badge {
  background: rgba(0, 0, 0, 0.12);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.78rem;
}

.tab-btn.active .count-badge {
  background: rgba(255, 255, 255, 0.25);
}

/* Toolbar: Search & Sort */
.lead-toolbar {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  background: #fff;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.sort-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-box select {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  background: #fff;
}

/* Lead Cards Grid */
.lead-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.lead-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lead-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.07);
}

.lead-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.lead-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.lead-card-meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

.lead-card-req {
  font-size: 0.92rem;
  color: #4a423a;
  background: #fdfaf6;
  border-left: 3px solid var(--primary);
  padding: 10px 12px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
}

.lead-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  margin-top: 0;
  border-radius: 6px;
  cursor: pointer;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: #f0eae1;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.status-select {
  padding: 5px 8px;
  font-size: 0.82rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: #fff;
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.3rem;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--muted);
  margin-top: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* Toast Notification */
.toast-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #2b2621;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}