/* ================================================================
   CUSTOM STYLES — augment Tailwind where inline classes are awkward
   ================================================================ */
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f8fafc;
}

/* ---- Sidebar ---- */
#sidebar {
  width: 240px; min-width: 240px;
  background: #0f172a;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: #94a3b8; font-size: 14px; font-weight: 500;
  transition: all 0.15s; cursor: pointer; text-decoration: none;
}
.nav-link:hover { color: #fff; background: #1e293b; }
.nav-link.active { color: #fff; background: #1e293b; }

/* ---- Cards ---- */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ---- Status badges ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 9999px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.badge-new       { background:#dbeafe; color:#1d4ed8; }
.badge-reviewed  { background:#fef9c3; color:#a16207; }
.badge-contacted { background:#ede9fe; color:#6d28d9; }
.badge-quoted    { background:#ffedd5; color:#c2410c; }
.badge-closed    { background:#dcfce7; color:#15803d; }
.badge-spam      { background:#fee2e2; color:#b91c1c; }
.badge-active    { background:#dcfce7; color:#15803d; }
.badge-inactive  { background:#f1f5f9; color:#64748b; }
.badge-dup       { background:#fee2e2; color:#b91c1c; }

/* ---- Table rows ---- */
.data-row { transition: background 0.1s; cursor: pointer; }
.data-row:hover { background: #f1f5f9; }

/* ---- Spinner ---- */
@keyframes _spin { to { transform: rotate(360deg); } }
.spinner {
  width: 24px; height: 24px;
  border: 3px solid #e2e8f0; border-top-color: #2563eb;
  border-radius: 50%; animation: _spin .7s linear infinite;
}
.spinner-sm {
  width: 14px; height: 14px; border-width: 2px;
}

/* ---- Toast ---- */
@keyframes _slideDown {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast { animation: _slideDown 0.25s ease forwards; }

/* ---- Lead Detail Full Page ---- */
.lead-detail-layout {
  display: grid;
  grid-template-columns: 38% 62%;
  gap: 24px;
}
.lead-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 20px;
  margin-bottom: 16px;
}
.lead-header-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 24px;
  margin-bottom: 24px;
}
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  color: #94a3b8; text-transform: uppercase; margin-bottom: 12px;
}
.field-label {
  font-size: 11px; font-weight: 600; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px;
}
.field-value {
  font-size: 13px; color: #334155; word-break: break-all;
}
.status-dropdown-container { position: relative; width: 200px; outline: none; }
.status-dropdown-header {
  height: 42px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff;
  padding: 0 12px; display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; font-size: 14px; font-weight: 500; color: #0f172a; transition: all 0.15s;
}
.status-dropdown-container:focus-within .status-dropdown-header {
  border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.status-dropdown-menu {
  position: absolute; top: calc(100% + 4px); right: 0; width: 100%;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  z-index: 50; overflow: hidden;
}
.status-dropdown-menu.hidden { display: none; }
.status-dropdown-item {
  padding: 10px 12px; display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; cursor: pointer; color: #334155; transition: background 0.1s;
}
.status-dropdown-item:hover { background: #f8fafc; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.copy-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 4px; border: none;
  background: transparent; cursor: pointer; color: #94a3b8;
  transition: all 0.15s; flex-shrink: 0;
}
.copy-btn:hover { background: #f1f5f9; color: #475569; }

/* ---- Bar chart fill ---- */
.bar-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width 0.7s cubic-bezier(.4,0,.2,1);
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.campaigns-scroll-wrapper { position: relative; }
.campaigns-scroll-wrapper::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 32px;
  background: linear-gradient(to bottom, transparent, white); pointer-events: none;
}
.campaigns-scroll-area {
  max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #e2e8f0 transparent; padding-bottom: 32px;
}
.campaigns-scroll-area::-webkit-scrollbar { width: 6px; }
.campaigns-scroll-area::-webkit-scrollbar-track { background: transparent; }
.campaigns-scroll-area::-webkit-scrollbar-thumb { background-color: #e2e8f0; border-radius: 10px; }

/* ---- Mobile sidebar ---- */
@media (max-width: 767px) {
  #sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 40; transform: translateX(-100%);
  }
  #sidebar.open { transform: translateX(0); }
}

/* ---- Input focus ---- */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ---- Button hover ---- */
.btn-primary { background: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost:hover { background: #f1f5f9; }

/* ---- Redesigned Dashboard CSS ---- */
.dashboard-card { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); padding: 24px; transition: all 0.3s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.stat-circle { background-color: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
.bar-fill { transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); }
.donut-segment { transition: stroke-dasharray 1s ease-out, opacity 0.2s ease; transform: rotate(-90deg); transform-origin: 50% 50%; }
@keyframes pulse-bg { 0% { background-color: #e2e8f0; } 50% { background-color: #f1f5f9; } 100% { background-color: #e2e8f0; } }
.skeleton { animation: pulse-bg 1.5s infinite; border-radius: 4px; }
#campaigns-card { height: fit-content; }
@media (min-width: 1024px) {
  #campaigns-card { height: auto; }
}

/* ================================================================
   LOGIN SCREEN STYLES
   ================================================================ */
.login-layout-wrapper {
  --primary-blue: #2563eb;
  --blue-dark: #1d4ed8;
  --navy: #0f1c3f;
  --indigo-accent: #1a3a6e;
  --white: #ffffff;
  --off-white: #f9fafb;
  --border: #e2e8f0;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --success-green: #16a34a;
  --focus-ring: rgba(37, 99, 235, 0.15);
  --pill-bg: #eff6ff;

  display: flex;
  width: 100%;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  background-color: var(--white);
}
.login-left-panel {
  width: 60%;
  background: linear-gradient(135deg, var(--navy) 0%, var(--indigo-accent) 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 48px 64px;
  color: var(--white);
  overflow: hidden;
}
.login-left-panel::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5; pointer-events: none;
}
.login-right-panel {
  width: 40%; background-color: var(--white); display: flex; flex-direction: column; position: relative;
}
.login-brand-logo { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; position: relative; z-index: 1; }
.login-brand-icon { width: 32px; height: 32px; background-color: var(--primary-blue); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.login-brand-icon svg { width: 20px; height: 20px; fill: var(--white); }
.login-value-prop { position: relative; z-index: 1; max-width: 480px; margin: auto 0; }
.login-value-prop h1 { font-size: 48px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 32px; }
.login-feature-list { list-style: none; display: flex; flex-direction: column; gap: 16px; padding: 0; margin: 0; }
.login-feature-item { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 400; color: rgba(255, 255, 255, 0.9); opacity: 0; transform: translateX(-16px); animation: staggerFadeIn 0.5s ease-out forwards; }
.login-feature-item:nth-child(1) { animation-delay: 0.1s; }
.login-feature-item:nth-child(2) { animation-delay: 0.2s; }
.login-feature-item:nth-child(3) { animation-delay: 0.3s; }
.login-feature-icon { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background-color: rgba(255, 255, 255, 0.1); color: var(--primary-blue); }
.login-trust-row { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 16px; }
.login-trust-text { font-size: 14px; color: rgba(255, 255, 255, 0.6); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.login-trust-icons { display: flex; gap: 24px; opacity: 0.7; }
.login-trust-icons svg { height: 24px; fill: currentColor; }
.login-support-link { position: absolute; top: 32px; right: 48px; font-size: 14px; color: var(--text-muted); text-decoration: none; font-weight: 500; transition: color 0.2s; }
.login-support-link:hover { color: var(--text-primary); }
.login-form-wrapper { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px; }
.login-form-card { width: 100%; max-width: 400px; opacity: 0; transform: translateY(16px); animation: formFadeIn 0.4s ease-out forwards; }
.login-pill { display: inline-block; background-color: var(--pill-bg); color: var(--blue-dark); font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 100px; margin-bottom: 24px; }
.login-header { margin-bottom: 32px; }
.login-header h2 { font-size: 28px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; letter-spacing: -0.01em; }
.login-header p { font-size: 14px; color: var(--text-muted); margin: 0; }
.login-input-group { margin-bottom: 20px; position: relative; }
.login-label { display: block; font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 8px; }
.login-input-wrap { position: relative; }
.login-input { width: 100%; height: 48px; padding: 0 16px; font-family: 'Inter', sans-serif; font-size: 16px; color: var(--text-primary); background-color: var(--white); border: 1.5px solid var(--border); border-radius: 8px; outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; box-sizing: border-box; }
.login-input::placeholder { color: #94a3b8; }
.login-input:focus { border-color: var(--primary-blue) !important; box-shadow: 0 0 0 3px var(--focus-ring) !important; }
.login-input.has-prefix { padding-left: 44px; }
.login-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; display: flex; pointer-events: none; transition: color 0.2s ease; }
.login-input:focus ~ .login-prefix { color: var(--primary-blue); }
.login-pwd-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #94a3b8; cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.login-pwd-toggle:hover { color: var(--text-primary); }
.login-pwd-toggle:focus-visible { outline: 2px solid var(--primary-blue); outline-offset: 2px; }
.login-forgot { display: block; text-align: right; font-size: 13px; font-weight: 500; color: var(--primary-blue); text-decoration: none; margin-bottom: 24px; }
.login-forgot:hover { text-decoration: underline; }

.login-btn-submit { width: 100%; height: 48px; background-color: var(--primary-blue); color: var(--white); font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 600; letter-spacing: 0.02em; border: none; border-radius: 8px; cursor: pointer; position: relative; overflow: hidden; transition: background-color 0.2s ease, transform 0.1s ease; display: flex; align-items: center; justify-content: center; }
.login-btn-submit:not(:disabled):hover { background-color: var(--blue-dark); }
.login-btn-submit:not(:disabled):active { transform: scale(0.99); }
.login-btn-submit:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.login-btn-submit:disabled { cursor: not-allowed; opacity: 0.9; }

.login-btn-text { transition: opacity 0.2s; }
.login-btn-submit.loading .login-btn-text { opacity: 0; }
.login-btn-submit.success { background-color: var(--success-green); }
.login-spinner-anim { position: absolute; width: 20px; height: 20px; border: 2px solid rgba(255, 255, 255, 0.3); border-radius: 50%; border-top-color: var(--white); animation: login-spin 0.8s linear infinite; opacity: 0; visibility: hidden; }
.login-btn-submit.loading .login-spinner-anim { opacity: 1; visibility: visible; }
.login-success-content { position: absolute; display: flex; align-items: center; gap: 8px; opacity: 0; visibility: hidden; transform: translateY(10px); transition: all 0.3s ease; }
.login-btn-submit.success .login-success-content { opacity: 1; visibility: visible; transform: translateY(0); }
.login-btn-submit.success .login-btn-text, .login-btn-submit.success .login-spinner-anim { display: none; }

.login-divider { display: flex; align-items: center; text-align: center; margin: 32px 0; color: var(--text-muted); font-size: 13px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--border); }
.login-divider:not(:empty)::before { margin-right: .5em; }
.login-divider:not(:empty)::after { margin-left: .5em; }
.login-btn-ghost { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; background-color: transparent; color: var(--text-primary); font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 500; border: 1.5px solid var(--border); border-radius: 8px; text-decoration: none; transition: all 0.2s ease; box-sizing: border-box; }
.login-btn-ghost:hover { background-color: var(--off-white); border-color: #cbd5e1; }
.login-btn-ghost:focus-visible { outline: none; border-color: var(--primary-blue); box-shadow: 0 0 0 3px var(--focus-ring); }
@keyframes formFadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes staggerFadeIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes login-spin { to { transform: rotate(360deg); } }
@media (max-width: 768px) { .login-left-panel { display: none; } .login-right-panel { width: 100%; } .login-form-wrapper { padding: 24px; } .login-support-link { top: 24px; right: 24px; } }
@media (prefers-reduced-motion: reduce) { .login-form-card, .login-feature-item, .login-btn-submit { animation: none !important; transition: none !important; } }
