/* ═══════════════════════════════════════════════════
   romer.css — ApexForge Operations design system
   Single source of truth for all shared page styles
   ═══════════════════════════════════════════════════ */

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

:root {
  /* Backgrounds */
  --bg-void:     #0a0a0b;
  --bg-primary:  #131314;
  --bg-sidebar:  #0e0e0f;
  --bg-card:     #201f21;
  --bg-elevated: #2a2a2b;
  --bg-input:    #1a1a1b;

  /* Accents */
  --accent-cyan: #f0f0f0;
  --accent-gold: #e9c349;

  /* Text */
  --text-primary:   #f4f4f5;
  --text-secondary: #9a9aa0;
  --text-muted:     #55555a;

  /* Semantic */
  --success:  #4ade80;
  --error:    #f87171;
  --warning:  #e9c349;
  --lavender: #bec2ff;

  /* Borders */
  --border-subtle: rgba(255,255,255,0.08);

  /* Shadows */
  --shadow-card:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 1px 3px rgba(0,0,0,0.5),
    0 6px 20px rgba(0,0,0,0.28);
  --shadow-elevated:
    0 8px 32px rgba(0,0,0,0.5),
    0 2px 8px rgba(0,0,0,0.3);

  /* Backward-compat alias — pages that use
     box-shadow: var(--border-card-glow) get the
     new shadow automatically */
  --border-card-glow: var(--shadow-card);

  /* Border radius */
  --radius-sm: 10px;
  --radius-md: 8px;
  --radius-lg:   16px;   /* modals */
  --radius-pill: 999px;  /* badges */

  /* Grid — quieter texture */
  --grid-line-color: rgba(255,255,255,0.028);
  --grid-size: 40px;

  /* Layout */
  --sw: 220px;

  /* Typography */
  --font-display: 'Manrope', sans-serif;
  --font-body:    'Inter', sans-serif;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
}

/* ─── SIDEBAR ─────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sw);
  height: 100vh;
  background: linear-gradient(180deg, #111112 0%, #0d0d0e 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 520;
  font-size: 14.5px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.25;
  flex: 1;
}

.logo-text em {
  font-style: normal;
  color: var(--accent-cyan);
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

nav { padding: 10px 0; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: color .14s, background .14s, border-color .14s;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}

.nav-link.active {
  color: var(--accent-cyan);
  border-left-color: var(--accent-cyan);
  background: rgba(80,216,233,0.06);
  animation: nav-active-in .15s ease;
}

@keyframes nav-active-in {
  from { border-left-color: transparent; background: transparent; }
  to   { border-left-color: var(--accent-cyan); background: rgba(80,216,233,0.06); }
}

.nav-link .icon {
  font-size: 17px;
  flex-shrink: 0;
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

.nav-link.active .icon {
  font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

.user-card {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .14s;
}

.user-card:hover { background: rgba(255,255,255,0.02); }

.uc-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(80,216,233,0.12);
  border: 1px solid rgba(80,216,233,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-cyan);
}

.uc-info { flex: 1; min-width: 0; }

.uc-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uc-role {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.uc-site {
  font-size: 10.5px;
  color: var(--accent-cyan);
  opacity: .7;
  text-decoration: none;
  display: block;
  margin-top: 2px;
}

.uc-site:hover { opacity: 1; }

/* ─── MAIN ─────────────────────────────────────────── */
.main {
  margin-left: var(--sw);
  padding: 36px 40px;
  min-height: 100vh;
  background-image:
    linear-gradient(var(--grid-line-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line-color) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}

/* ─── SHARED LABELS ───────────────────────────────── */
.card-label {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* ─── STATUS DOTS ─────────────────────────────────── */
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot-cyan    { background: var(--accent-cyan); }
.dot-success { background: var(--success); }
.dot-error   { background: var(--error); }
.dot-gold    { background: var(--accent-gold); }

/* ─── LIVE BADGE ──────────────────────────────────── */
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  animation: live-pulse 1.8s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(80,216,233,0.4); }
  50%       { opacity: 0.5; box-shadow: 0 0 0 4px rgba(80,216,233,0); }
}

/* ─── EMPTY / LOADING STATES ──────────────────────── */
.empty-state,
.loading-state {
  padding: 32px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.empty-state p { margin: 0; }

/* ─── CTA BUTTON (empty states) ───────────────────── */
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-cyan);
  color: #0e0e0f;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  text-decoration: none;
  margin-top: 10px;
  transition: opacity .16s;
}

.btn-cta:hover { opacity: .88; }

/* ─── SKELETON LOADING ────────────────────────────── */
.skeleton {
  display: inline-block;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--bg-elevated) 25%, rgba(255,255,255,0.07) 37%, var(--bg-elevated) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.sk-line { display: block; height: 10px; }
.sk-sub  { margin-top: 6px; height: 8px; }
.sk-pill { display: inline-block; width: 58px; height: 18px; border-radius: var(--radius-pill); }

.sk-w-90 { width: 90%; }
.sk-w-70 { width: 70%; }
.sk-w-60 { width: 60%; }
.sk-w-50 { width: 50%; }
.sk-w-40 { width: 40%; }

/* ─── SPINNER ─────────────────────────────────────── */
.spinner {
  border: 2px solid rgba(14,14,14,.35);
  border-top-color: #0e0e0f;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  flex-shrink: 0;
}

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

/* ─── TOAST ───────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  display: none;
  z-index: 9999;
  max-width: 320px;
  box-shadow: var(--shadow-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

#toast.success { border-left: 3px solid var(--success); }
#toast.error   { border-left: 3px solid var(--error); }
#toast.warning { border-left: 3px solid var(--warning); }

/* ─── HAMBURGER ───────────────────────────────────── */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 1001;
  background: #222124;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
}

.hamburger-btn .icon { font-size: 20px; }

/* ─── MOBILE OVERLAY ──────────────────────────────── */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 99;
  cursor: pointer;
}

/* ─── RESPONSIVE — SIDEBAR ────────────────────────── */
@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  .sidebar-close-btn { display: flex; }

  .sidebar {
    position: fixed;
    left: -240px;
    transition: left 0.26s ease;
    width: 240px;
  }

  .sidebar.mobile-open { left: 0; }
  .mobile-overlay.active { display: block; }
  body.sidebar-is-open .hamburger-btn { display: none; }

  .main {
    margin-left: 0;
    padding: 70px 16px 28px;
  }

  .main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* ─── TABLE OVERFLOW ────────────────────────────── */
  .table-wrap,
  #activityContainer,
  #leadsTableContainer {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 480px;
  }

  thead th,
  tbody td {
    white-space: nowrap;
  }

  /* ─── TRACKER LEAD CARDS ────────────────────────── */
  .lead-card-name {
    font-size: 13px;
    word-break: break-word;
  }

  .lead-card-meta {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
  }

  .tl-step {
    padding: 8px 10px;
  }

  .tl-step .tl-label {
    font-size: 9px;
  }

  .tl-step .tl-date {
    font-size: 11px;
  }
}

/* ─── RESPONSIVE — SMALL PHONES ────────────────────── */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .stat-value {
    font-size: 32px;
  }
}

/* ─── PAGE TRANSITIONS ─────────────────────────────────
   Native cross-document View Transitions (Chrome/Edge 126+).
   No JS needed — unsupported browsers just navigate normally. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: 120ms ease-in fade-slide-out;
}
::view-transition-new(root) {
  animation: 180ms ease-out fade-slide-in;
}
@keyframes fade-slide-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}
@keyframes fade-slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
