/* Space Lead Management — premium SaaS UI */
:root {
  --brand: #0f766e;
  --brand-dark: #0d5c56;
  --brand-soft: #ccfbf1;
  --ink: #0f172a;
  --muted: #64748b;
  --surface: #ffffff;
  --bg: #f1f5f9;
  --bg-accent: #e2e8f0;
  --border: #e2e8f0;
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
  --sidebar-w: 248px;
  --bottom-h: 64px;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .04);
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #ccfbf1 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e0f2fe 0%, transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

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

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0f172a 0%, #134e4a 100%);
  color: #e2e8f0;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: none;
  flex-direction: column;
  z-index: 40;
}
.sidebar .brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.02em;
  padding: .25rem .5rem 1.25rem;
  line-height: 1.2;
}
.sidebar .brand small {
  display: block;
  font-family: var(--font);
  font-size: .7rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-top: .35rem;
}
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.sidebar a.nav-link {
  color: #cbd5e1;
  border-radius: 10px;
  padding: .65rem .85rem;
  font-size: .92rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .65rem;
}
.sidebar a.nav-link:hover, .sidebar a.nav-link.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.sidebar .nav-footer {
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: .75rem;
  margin-top: .75rem;
  font-size: .85rem;
  color: #94a3b8;
}

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
  border-radius: 10px;
}
.btn-brand:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-soft {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: none;
  font-weight: 600;
  border-radius: 10px;
}

.content {
  padding: 1rem 1rem calc(var(--bottom-h) + 1.25rem);
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.kpi-card .label { color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-card .value { font-size: 1.45rem; font-weight: 700; margin-top: .25rem; letter-spacing: -.02em; }
.kpi-card .delta { font-size: .8rem; margin-top: .2rem; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.panel-title {
  font-size: 1rem;
  font-weight: 650;
  margin: 0 0 .85rem;
}

.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-bottom: .65rem;
  box-shadow: var(--shadow);
}
.lead-card .meta { color: var(--muted); font-size: .85rem; }

.badge-priority-high { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-priority-medium { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-priority-low { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }
.priority-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 650;
  padding: .2rem .5rem;
  border-radius: 999px;
}
.priority-badge::before {
  content: "";
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: currentColor;
}

.status-pill {
  display: inline-block;
  font-size: .72rem;
  font-weight: 650;
  padding: .25rem .55rem;
  border-radius: 999px;
  color: #fff;
}

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--bottom-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  color: var(--muted);
  font-size: .65rem;
  font-weight: 600;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--brand); }
.bottom-nav .fab {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -18px;
  box-shadow: 0 8px 20px rgba(15, 118, 110, .35);
  font-size: 1.4rem;
  line-height: 1;
}

.guest-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.guest-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.75rem;
}
.guest-card .brand {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 0 0 .25rem;
}
.guest-card .sub { color: var(--muted); margin-bottom: 1.25rem; }

.table-desktop { display: none; }
.kanban {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .5rem;
  scroll-snap-type: x mandatory;
}
.kanban-col {
  min-width: 260px;
  max-width: 280px;
  background: rgba(255,255,255,.55);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem;
  scroll-snap-align: start;
}
.kanban-col h3 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .65rem;
  display: flex;
  justify-content: space-between;
}
.kanban-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .7rem;
  margin-bottom: .5rem;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.timeline-item {
  border-left: 2px solid var(--border);
  padding: 0 0 1rem 1rem;
  margin-left: .4rem;
  position: relative;
}
.timeline-item::before {
  content: "";
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  background: var(--brand);
  position: absolute;
  left: -.35rem;
  top: .2rem;
}
.timeline-item.system::before { background: var(--muted); }
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}
.chart-box { position: relative; height: 240px; }

@media (min-width: 992px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none; }
  .content { padding: 1.5rem 1.75rem 2rem; }
  .kpi-grid { grid-template-columns: repeat(5, 1fr); }
  .table-desktop { display: table; }
  .cards-mobile { display: none; }
  .topbar .mobile-only { display: none !important; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.kpi-card, .panel, .lead-card { animation: fadeUp .35s ease both; }
.kpi-card:nth-child(2) { animation-delay: .04s; }
.kpi-card:nth-child(3) { animation-delay: .08s; }
.kpi-card:nth-child(4) { animation-delay: .12s; }
