/* ============================================================
   GeoLeads — Dark Glassmorphism Design System
   ============================================================ */

:root {
  --bg-base:       #0a0d14;
  --bg-elevated:   #111623;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.08);
  --border-hover:  rgba(255,255,255,0.18);

  --text-primary:  #e8eaf0;
  --text-secondary:#8a93a8;
  --text-muted:    #555e72;

  --accent-teal:   #00d4b4;
  --accent-purple: #8b5cf6;
  --accent-orange: #f59e0b;
  --accent-green:  #10b981;
  --accent-red:    #ef4444;
  --accent-blue:   #3b82f6;

  --sidebar-w: 220px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-glow: 0 0 20px rgba(0,212,180,0.15);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   App Shell
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, #0d1220 0%, #0a0d14 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  color: var(--accent-teal);
  font-size: 22px;
  filter: drop-shadow(0 0 8px rgba(0,212,180,0.5));
}
.brand-icon.large { font-size: 36px; }
.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}
.nav-item.active {
  color: var(--accent-teal);
  background: rgba(0,212,180,0.08);
  border: 1px solid rgba(0,212,180,0.15);
}
.nav-icon { font-size: 15px; opacity: 0.8; }

.sidebar-footer {
  padding: 12px 10px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-footer .nav-item.small { font-size: 12px; padding: 8px 12px; }
.sidebar-user {
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ============================================================
   Main content area
   ============================================================ */

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 36px;
  max-width: 1400px;
}

.page-header {
  margin-bottom: 28px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.page-sub {
  color: var(--text-secondary);
  font-size: 13px;
}
.back-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  display: inline-block;
  margin-bottom: 8px;
}
.back-link:hover { color: var(--accent-teal); }

/* ============================================================
   Glass Cards
   ============================================================ */

.glass {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.card {
  padding: 24px;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}
.card-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.narrow-card {
  max-width: 440px;
  padding: 32px;
}
.mt-md { margin-top: 20px; }
.mt-sm { margin-top: 12px; }
.mb-md { margin-bottom: 20px; }

/* ============================================================
   Stats Grid
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}
.stat-icon { font-size: 20px; }
.stat-val  { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-label{ font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ============================================================
   Two-column layout
   ============================================================ */

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ============================================================
   Info list
   ============================================================ */

.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-row  { display: flex; align-items: baseline; gap: 8px; }
.info-label{
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  width: 110px;
  flex-shrink: 0;
}
.info-val  { font-size: 13px; color: var(--text-secondary); }
.highlight { color: var(--accent-teal) !important; font-weight: 600; }
.mono      { font-family: var(--font-mono); font-size: 11px; }
.muted     { color: var(--text-muted) !important; }
.small     { font-size: 12px; }
.nowrap    { white-space: nowrap; }

/* ============================================================
   Bar chart
   ============================================================ */

.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-label{ width: 160px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.bar-fill  { height: 100%; background: linear-gradient(90deg, var(--accent-teal), var(--accent-purple)); border-radius: 3px; transition: width 0.5s ease; }
.bar-count { width: 28px; text-align: right; color: var(--text-muted); }

/* ============================================================
   Tables
   ============================================================ */

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.lead-row { cursor: pointer; transition: background 0.15s ease; }
.lead-row:hover td { background: rgba(255,255,255,0.04); }
.lead-title a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
}
.lead-title a:hover { color: var(--accent-teal); }

/* ============================================================
   Badges & Tags
   ============================================================ */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-running { background: rgba(0,212,180,0.15); color: var(--accent-teal); border: 1px solid rgba(0,212,180,0.3); }
.badge-done    { background: rgba(16,185,129,0.15); color: var(--accent-green); border: 1px solid rgba(16,185,129,0.3); }
.badge-error   { background: rgba(239,68,68,0.15);  color: var(--accent-red);   border: 1px solid rgba(239,68,68,0.3); }
.badge-idle    { background: rgba(138,147,168,0.15); color: var(--text-secondary); border: 1px solid var(--border); }

.type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(139,92,246,0.15);
  color: var(--accent-purple);
  border: 1px solid rgba(139,92,246,0.25);
  white-space: nowrap;
}

.score-dot {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.score-high { background: rgba(16,185,129,0.15);  color: var(--accent-green); }
.score-mid  { background: rgba(245,158,11,0.15);  color: var(--accent-orange); }
.score-low  { background: rgba(138,147,168,0.1);  color: var(--text-muted); }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin: 2px;
}
.tag-primary{ background: rgba(0,212,180,0.1);   color: var(--accent-teal);   border: 1px solid rgba(0,212,180,0.2); }
.tag-tech   { background: rgba(59,130,246,0.1);  color: var(--accent-blue);   border: 1px solid rgba(59,130,246,0.2); }
.tag-intent { background: rgba(245,158,11,0.1);  color: var(--accent-orange); border: 1px solid rgba(245,158,11,0.2); }
.kw-tags    { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.kw-label   { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.kw-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.kw-section:last-child { border-bottom: none; }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-teal), #00a896);
  color: #000;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm  { padding: 6px 14px; font-size: 12px; }
.btn-xs  { padding: 4px 10px; font-size: 11px; }
.btn-lg  { padding: 12px 24px; font-size: 14px; }
.btn-full{ width: 100%; justify-content: center; }

/* ============================================================
   Forms
   ============================================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.form-group.compact { margin-bottom: 0; }
.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group select {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(0,212,180,0.1);
}
.form-group select option { background: var(--bg-elevated); }
.form-hint { font-size: 11px; color: var(--text-muted); }

/* Radio group */
.radio-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}
.radio-option:has(input:checked) {
  border-color: var(--accent-teal);
  background: rgba(0,212,180,0.08);
  color: var(--accent-teal);
}
.radio-option input[type="radio"] { accent-color: var(--accent-teal); }
.radio-option input[type="number"] {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
}

/* Filter row */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filter-row .form-group { margin-bottom: 0; }
.filter-actions { display: flex; gap: 8px; align-items: flex-end; }

/* ============================================================
   Alerts
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-success {
  background: rgba(16,185,129,0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16,185,129,0.3);
}
.alert-error {
  background: rgba(239,68,68,0.12);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.3);
}

/* ============================================================
   Pagination
   ============================================================ */

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
.page-info { font-size: 12px; color: var(--text-muted); }
.page-buttons { display: flex; gap: 8px; }

/* ============================================================
   Running status
   ============================================================ */

.pulse-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-teal);
  animation: pulse 1.5s ease-in-out infinite;
  margin-right: 4px;
  vertical-align: middle;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(0,212,180,0.3);
  border-top-color: var(--accent-teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.running-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(0,212,180,0.06);
  border: 1px solid rgba(0,212,180,0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

/* ============================================================
   Log viewer
   ============================================================ */

.log-card { padding: 0; overflow: hidden; }
.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.log-status { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.log-controls { display: flex; align-items: center; gap: 10px; }
.toggle-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.toggle-label input { accent-color: var(--accent-teal); }

.log-output {
  height: calc(100vh - 260px);
  min-height: 400px;
  overflow-y: auto;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
}
.log-output::-webkit-scrollbar { width: 6px; }
.log-output::-webkit-scrollbar-track { background: transparent; }
.log-output::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.log-line       { color: var(--text-muted); padding: 1px 0; }
.log-info       { color: var(--text-secondary); }
.log-highlight  { color: var(--accent-teal); font-weight: 500; }
.log-warn       { color: var(--accent-orange); }
.log-error      { color: var(--accent-red); }

/* ============================================================
   Detail page
   ============================================================ */

.detail-card { padding: 28px; }
.detail-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 10px;
}
.detail-url {
  display: inline-block;
  font-size: 11px;
  color: var(--accent-blue);
  text-decoration: none;
  word-break: break-all;
  margin-bottom: 4px;
}
.detail-url:hover { color: var(--accent-teal); text-decoration: underline; }

.evidence-block { margin-top: 20px; }
.evidence-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.evidence-quote {
  padding: 14px 16px;
  border-left: 3px solid var(--accent-purple);
  background: rgba(139,92,246,0.07);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  font-style: italic;
}

.score-row { display: flex; gap: 24px; }
.score-item { flex: 1; }
.score-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.score-bar-wrap { height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.score-bar-fill { height: 100%; border-radius: 3px; }
.score-bar-fill.score-high { background: linear-gradient(90deg, var(--accent-green), #06d6a0); }
.score-bar-fill.score-mid  { background: linear-gradient(90deg, var(--accent-orange), #fbbf24); }
.score-bar-fill.score-low  { background: rgba(255,255,255,0.15); }
.score-val { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

/* ============================================================
   Tips list
   ============================================================ */

.tip-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tip-list li {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-purple);
  line-height: 1.5;
}
.tip-list li strong { color: var(--text-primary); }
.tip-list li a { color: var(--accent-teal); text-decoration: none; }
.tip-list li code {
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ============================================================
   Empty state
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 60px 30px;
}
.empty-icon { font-size: 40px; color: var(--text-muted); margin-bottom: 14px; }
.empty-state h2 { color: var(--text-secondary); font-size: 16px; margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); font-size: 13px; }
.empty-state a { color: var(--accent-teal); }

/* ============================================================
   Login page
   ============================================================ */

.login-body {
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

.login-bg { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  animation: orb-float 8s ease-in-out infinite;
}
.orb1 { width: 400px; height: 400px; background: var(--accent-teal);   top: -100px;  left: -100px;  animation-delay: 0s; }
.orb2 { width: 300px; height: 300px; background: var(--accent-purple); bottom: -80px; right: -80px;  animation-delay: -3s; }
.orb3 { width: 250px; height: 250px; background: var(--accent-blue);   top: 40%;     left: 40%;     animation-delay: -5s; }

@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -20px) scale(1.05); }
  66%       { transform: translate(-15px, 15px) scale(0.97); }
}

.login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 380px;
  padding: 44px 40px;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-teal), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 8px 0 4px;
}
.login-subtitle { font-size: 12px; color: var(--text-muted); }
.login-form { display: flex; flex-direction: column; gap: 4px; }

/* ============================================================
   Organisation highlight cards (Lead Detail)
   ============================================================ */

.org-highlight-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.org-highlight {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid;
}

.org-contractor-card {
  background: rgba(0,212,180,0.06);
  border-color: rgba(0,212,180,0.25);
}

.org-client-card {
  background: rgba(139,92,246,0.06);
  border-color: rgba(139,92,246,0.25);
}

.org-highlight-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.org-contractor-card .org-highlight-label { color: var(--accent-teal); }
.org-client-card .org-highlight-label     { color: var(--accent-purple); }

.org-highlight-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.org-highlight-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ============================================================
   Compact tag variants for table keyword chips
   ============================================================ */

.tag-xs {
  padding: 1px 5px;
  font-size: 10px;
  margin: 1px;
}

.tag-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
}

.kw-cell {
  max-width: 160px;
}

/* ============================================================
   Org column cues in table
   ============================================================ */

.org-contractor strong {
  color: var(--accent-teal);
}

.org-client {
  color: var(--text-secondary);
}

