/* Revolution Resources CRM — shared styles */
:root {
  --black: #0a0a0a;
  --near-black: #141414;
  --red: #d81f26;
  --red-dark: #a8161c;
  --gold: #e8a33d;
  --white: #ffffff;
  --off-white: #f6f6f7;
  --gray-100: #eceef0;
  --gray-300: #c7cbd1;
  --gray-500: #8a909a;
  --gray-700: #4d525a;
  --gray-900: #23262b;
  --border: #e2e4e8;
  --radius: 6px;
  --shadow: 0 2px 10px rgba(0,0,0,0.06);
  font-size: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--gray-900);
  background: var(--off-white);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Auth screen ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  padding: 24px;
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}
.auth-card .brand-mark { width: 40px; height: 40px; margin: 0 auto 16px; }
.auth-card h1 { font-size: 1.3rem; text-align: center; margin: 0 0 4px; }
.auth-card .sub { text-align: center; color: var(--gray-500); font-size: 0.85rem; margin: 0 0 24px; }
.auth-error {
  background: #fdecec; color: var(--red-dark); border: 1px solid #f4c6c6;
  border-radius: var(--radius); padding: 10px 14px; font-size: 0.85rem; margin-bottom: 16px; display: none;
}

/* ---------- Form basics ---------- */
.field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.82rem; font-weight: 700; }
.field input, .field select, .field textarea {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(216,31,38,0.15);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 20px; border-radius: 4px; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; border: 1.5px solid transparent; background: var(--red); color: var(--white);
  transition: background .15s ease;
}
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border-color: var(--gray-300); color: var(--gray-900); }
.btn-outline:hover { background: var(--gray-100); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--black); color: var(--white);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 20px; }
.sidebar .brand img { width: 28px; height: 28px; }
.sidebar .brand span { font-weight: 800; font-size: 0.95rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; }
.sidebar nav a, .sidebar nav button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 4px;
  color: var(--gray-300); font-size: 0.88rem; font-weight: 600; text-align: left;
  background: none; border: none; cursor: pointer; font-family: inherit;
}
.sidebar nav a:hover, .sidebar nav button:hover, .sidebar nav a.active, .sidebar nav button.active { background: rgba(255,255,255,0.08); color: var(--white); }
.sidebar .user-box { padding: 12px; border-top: 1px solid rgba(255,255,255,0.1); margin-top: 10px; }
.sidebar .user-box .name { font-size: 0.82rem; font-weight: 700; color: var(--white); }
.sidebar .user-box .role { font-size: 0.72rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }

.main { flex-grow: 1; padding: 32px 40px; max-width: 1200px; }
.main h1 { font-size: 1.5rem; margin: 0 0 4px; }
.main .page-sub { color: var(--gray-500); font-size: 0.9rem; margin: 0 0 28px; }

/* ---------- Stat cards ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 1.7rem; font-weight: 800; display: block; }
.stat-card .label { font-size: 0.8rem; color: var(--gray-500); }

/* ---------- Panels & tables ---------- */
.panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 28px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 1rem; margin: 0; }
.panel-body { padding: 20px; }

table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th { text-align: left; color: var(--gray-500); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 20px; border-bottom: 1px solid var(--border); }
td { padding: 12px 20px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
.table-empty { padding: 32px 20px; text-align: center; color: var(--gray-500); font-size: 0.88rem; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.pill-red { background: #fdecec; color: var(--red-dark); }
.pill-gold { background: #fdf3e0; color: #6b4c12; }
.pill-green { background: #e6f6ec; color: #1a7a3d; }
.pill-gray { background: var(--gray-100); color: var(--gray-700); }

/* Live lead feed */
.lead-card {
  border: 1px solid var(--border); border-left: 4px solid var(--red); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 12px; background: var(--white); box-shadow: var(--shadow);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.lead-card.claimed { border-left-color: var(--gray-300); opacity: 0.7; }
.lead-card .info strong { display: block; font-size: 0.95rem; }
.lead-card .info span { font-size: 0.8rem; color: var(--gray-500); }
@keyframes pulseIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.lead-card.new { animation: pulseIn .4s ease; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal { background: var(--white); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 18px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--black); color: var(--white);
  padding: 12px 20px; border-radius: var(--radius); font-size: 0.86rem; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 100; opacity: 0; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 10px 16px; overflow-x: auto; }
  .sidebar .brand { padding: 0 12px 0 0; }
  .sidebar nav { flex-direction: row; }
  .sidebar .user-box { display: none; }
  .main { padding: 20px; }
}
