/* ExportsMission CRM – minimal futuristic sidebar UI */
:root {
  --primary: #2563eb;
  --primary-soft: rgba(37, 99, 235, .12);
  --primary-glow: rgba(59, 130, 246, .24);
  --accent: #06b6d4;
  --success: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --bg: #f6f8fb;
  --bg-2: #eef4ff;
  --card: rgba(255,255,255,.86);
  --card-solid: #ffffff;
  --sidebar: rgba(9, 15, 28, .94);
  --sidebar-border: rgba(148, 163, 184, .18);
  --border: #e5eaf3;
  --text: #111827;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --sidebar-w: 260px;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, .06);
  --ring: 0 0 0 4px rgba(37, 99, 235, .12);
}

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

html { min-height: 100%; }
body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(circle at 8% 8%, rgba(37, 99, 235, .12), transparent 32rem),
    radial-gradient(circle at 92% 12%, rgba(6, 182, 212, .11), transparent 28rem),
    linear-gradient(135deg, var(--bg) 0%, #ffffff 45%, var(--bg-2) 100%);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .36;
  background-image:
    linear-gradient(rgba(15, 23, 42, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; color: #1d4ed8; }

/* ── APP SHELL / SIDEBAR ── */
.app-shell { min-height: 100vh; display: flex; }
.navbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  color: #e5edf8;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(2, 6, 23, .94)),
    radial-gradient(circle at 20% 10%, rgba(59, 130, 246, .26), transparent 18rem);
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 16px 0 50px rgba(15, 23, 42, .18);
  backdrop-filter: blur(18px);
}
.nav-brand {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: .75rem;
  min-height: 54px;
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(125, 211, 252, .34);
  border-radius: 16px;
  color: #93c5fd;
  background: linear-gradient(135deg, rgba(37, 99, 235, .28), rgba(6, 182, 212, .15));
  box-shadow: 0 0 32px rgba(59, 130, 246, .18);
  font-size: 1.2rem;
}
.brand-name { font-weight: 800; font-size: 1rem; letter-spacing: -.03em; color: #f8fafc; }
.brand-tag {
  align-self: center;
  font-size: .64rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #bae6fd;
  background: rgba(14, 165, 233, .14);
  border: 1px solid rgba(125, 211, 252, .24);
  padding: .22rem .48rem;
  border-radius: 999px;
}
.nav-links { display: flex; flex-direction: column; gap: .35rem; padding-top: .5rem; }
.nav-links a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: .75rem .9rem .75rem 1rem;
  border-radius: 14px;
  color: #a8b4c7;
  font-size: .92rem;
  font-weight: 650;
  transition: transform .16s ease, background .16s ease, color .16s ease, border-color .16s ease;
  border: 1px solid transparent;
}
.nav-links a:hover,
.nav-links a.active {
  color: #f8fafc;
  background: linear-gradient(135deg, rgba(37, 99, 235, .22), rgba(6, 182, 212, .10));
  border-color: rgba(125, 211, 252, .18);
  transform: translateX(3px);
}
.nav-links a.active::before {
  content: "";
  position: absolute;
  left: .42rem;
  top: 50%;
  width: 5px;
  height: 22px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  box-shadow: 0 0 16px rgba(56, 189, 248, .5);
}
.nav-links a.admin-link { color: #fbbf24; }
.nav-links a.admin-link:hover,
.nav-links a.admin-link.active { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .2); }
.nav-user {
  margin-top: auto;
  display: grid;
  gap: .7rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, .16);
}
.user-tag {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
  color: #cbd5e1;
  background: rgba(148, 163, 184, .08);
  border: 1px solid rgba(148, 163, 184, .15);
  padding: .7rem .8rem;
  border-radius: 14px;
}
.user-tag.is-admin { color: #fde68a; background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .24); }
.btn-logout {
  display: inline-flex;
  justify-content: center;
  padding: .72rem .85rem;
  border-radius: 14px;
  color: #fecaca;
  background: rgba(239, 68, 68, .10);
  border: 1px solid rgba(248, 113, 113, .20);
  font-size: .86rem;
  font-weight: 700;
}
.btn-logout:hover { color: #fff; background: rgba(239, 68, 68, .18); }
.nav-toggle {
  display: none;
  position: fixed;
  top: .85rem;
  right: .85rem;
  z-index: 140;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(148, 163, 184, .24);
  border-radius: 14px;
  background: rgba(255, 255, 255, .86);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  font-size: 1.25rem;
  cursor: pointer;
}

/* ── PAGE WRAP ── */
.page-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1400px;
  margin-left: var(--sidebar-w);
  padding: 2rem clamp(1rem, 3vw, 2.5rem);
}

/* ── ALERTS ── */
.alert {
  padding: .9rem 1.1rem;
  border-radius: 16px;
  margin-bottom: 1rem;
  font-size: .9rem;
  font-weight: 650;
  box-shadow: var(--shadow-sm);
}
.alert-success { background: rgba(16, 185, 129, .11); color: #047857; border: 1px solid rgba(16, 185, 129, .25); }
.alert-error   { background: rgba(239, 68, 68, .10); color: #b91c1c; border: 1px solid rgba(239, 68, 68, .22); }

/* ── CARDS ── */
.card,
.login-card,
.modal-box {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, .86);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.card { padding: 1.35rem; }
.card-title { font-size: 1rem; font-weight: 800; color: var(--text); margin-bottom: 1rem; letter-spacing: -.02em; }
.card + .card { margin-top: 1rem; }

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
  gap: .9rem;
}
.page-header h1 { font-size: clamp(1.45rem, 2.6vw, 2rem); font-weight: 850; letter-spacing: -.045em; }
.page-subtitle { color: var(--muted); font-size: .92rem; margin-top: .15rem; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .64rem 1rem;
  border-radius: 14px;
  font-size: .875rem;
  font-weight: 750;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { color: #fff; background: linear-gradient(135deg, #2563eb, #0891b2); box-shadow: 0 12px 28px rgba(37, 99, 235, .22); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-danger  { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.btn-warn    { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-outline { background: rgba(255,255,255,.45); color: var(--primary); border-color: rgba(37, 99, 235, .28); }
.btn-ghost   { background: rgba(255,255,255,.65); color: var(--text); border-color: var(--border); }
.btn-sm      { padding: .42rem .72rem; font-size: .8rem; border-radius: 12px; }
.btn-block   { width: 100%; }

/* ── FORMS ── */
.form-section { margin-bottom: 1.75rem; }
.form-section-title,
.section-title {
  font-size: .76rem;
  font-weight: 850;
  color: var(--primary);
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group.span-2 { grid-column: 1 / -1; }
label { font-size: .82rem; font-weight: 750; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=url], select, textarea {
  width: 100%;
  padding: .72rem .86rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: .92rem;
  color: var(--text);
  background: rgba(255,255,255,.8);
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, .55);
  box-shadow: var(--ring);
  background: #fff;
}
textarea { resize: vertical; min-height: 96px; }
.form-hint { font-size: .78rem; color: var(--muted); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 16px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
thead th {
  text-align: left;
  padding: .78rem 1rem;
  background: rgba(241, 245, 249, .8);
  border-bottom: 1px solid var(--border);
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
tbody td { padding: .86rem 1rem; border-bottom: 1px solid rgba(226, 232, 240, .72); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(37, 99, 235, .045); }
.table-actions { display: flex; gap: .45rem; flex-wrap: wrap; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .28rem .68rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 850;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-new       { background: rgba(37, 99, 235, .10); color: #1d4ed8; border-color: rgba(37, 99, 235, .18); }
.badge-started   { background: rgba(99, 102, 241, .10); color: #4338ca; border-color: rgba(99, 102, 241, .18); }
.badge-followup  { background: rgba(239, 68, 68, .10); color: #b91c1c; border-color: rgba(239, 68, 68, .18); }
.badge-confirmed { background: rgba(16, 185, 129, .12); color: #047857; border-color: rgba(16, 185, 129, .2); }
.badge-dropped   { background: rgba(100, 116, 139, .10); color: #475569; border-color: rgba(100, 116, 139, .16); }

/* ── DASHBOARD STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, .86);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -55% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(37, 99, 235, .10);
}
.stat-num { font-size: 2.1rem; font-weight: 900; color: var(--primary); line-height: 1; letter-spacing: -.05em; }
.stat-label { font-size: .78rem; color: var(--muted); margin-top: .45rem; font-weight: 750; letter-spacing: .02em; }
.stat-card.danger .stat-num  { color: var(--danger); }
.stat-card.success .stat-num { color: var(--success); }
.stat-card.warn .stat-num    { color: var(--warn); }

/* ── SECTION TABS ── */
.section-tabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.tab-btn {
  padding: .55rem .95rem;
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 750;
  cursor: pointer;
  background: rgba(255,255,255,.68);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all .15s;
}
.tab-btn:hover  { border-color: rgba(37, 99, 235, .35); color: var(--primary); }
.tab-btn.active { background: #0f172a; color: #fff; border-color: #0f172a; box-shadow: 0 12px 26px rgba(15, 23, 42, .16); }

/* ── FOLLOW-UP ALERT BANNER ── */
.followup-banner {
  background: rgba(239, 68, 68, .08);
  border: 1px solid rgba(239, 68, 68, .18);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}
.followup-banner .fu-icon { font-size: 1.35rem; flex-shrink: 0; }
.followup-banner .fu-body { flex: 1; }
.followup-banner .fu-title { font-weight: 850; color: #b91c1c; font-size: .95rem; }
.followup-banner .fu-meta  { color: #dc2626; font-size: .83rem; margin-top: .2rem; }

/* ── CONVERSATION HISTORY ── */
.conv-list { display: flex; flex-direction: column; gap: .85rem; }
.conv-item, .conv-label, .conv-text, .conv-meta {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  background: rgba(248, 250, 252, .78);
}
.conv-header, .header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.conv-user { font-weight: 850; font-size: .85rem; color: var(--primary); }
.conv-date, .meta { font-size: .78rem; color: var(--muted); }
.conv-message label { font-size: .76rem; color: var(--muted); font-weight: 850; display: block; margin-bottom: .2rem; margin-top: .5rem; }
.conv-message p { font-size: .88rem; color: var(--text); white-space: pre-wrap; }

/* ── DETAIL GRID ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.detail-item { display: flex; flex-direction: column; gap: .22rem; }
.detail-label { font-size: .72rem; font-weight: 850; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; }
.detail-value { font-size: .92rem; color: var(--text); white-space: pre-wrap; }
.detail-item.span-2 { grid-column: 1 / -1; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state .es-icon { font-size: 2.5rem; filter: grayscale(.15); }
.empty-state p { margin-top: .5rem; font-size: .9rem; }

/* ── LOGIN PAGE ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(37, 99, 235, .18), transparent 28rem),
    linear-gradient(135deg, #f8fafc, #eef6ff);
  padding: 1.5rem;
}
.login-card { width: 100%; max-width: 420px; padding: 2.35rem 2rem; }
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo h1 { font-size: 1.55rem; font-weight: 900; letter-spacing: -.04em; }
.login-logo p  { color: var(--muted); font-size: .88rem; margin-top: .3rem; }

/* ── PROSPECT DETAIL / ADMIN / SEARCH ── */
.prospect-meta { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.prospect-meta .creator-tag { font-size: .82rem; color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.admin-grid.wide { grid-template-columns: 1fr; }
.search-bar { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 180px; }
.section { margin-bottom: 1.25rem; }
.info { color: var(--muted); }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(10px);
}
.modal-overlay.open { display: flex; }
.modal-box { padding: 2rem; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: .75rem; right: 1rem; font-size: 1.4rem; cursor: pointer; background: none; border: none; color: var(--muted); }
.modal-title { font-size: 1.1rem; font-weight: 850; margin-bottom: 1.25rem; }

/* ── FOOTER ── */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: .8rem;
  margin-top: 2rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .nav-toggle { display: grid; place-items: center; }
  .navbar {
    transform: translateX(-104%);
    transition: transform .22s ease;
  }
  body.nav-open .navbar { transform: translateX(0); }
  body.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(2, 6, 23, .35);
    backdrop-filter: blur(4px);
  }
  .page-wrap {
    margin-left: 0;
    padding-top: 4.6rem;
  }
  .form-grid, .detail-grid, .admin-grid { grid-template-columns: 1fr; }
  .form-group.span-2, .detail-item.span-2 { grid-column: 1; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  body { font-size: 14px; }
  .navbar { width: min(86vw, 310px); }
  .page-wrap { padding-inline: 1rem; }
  .card, .login-card, .modal-box { padding: 1rem; border-radius: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat-card { padding: 1rem; }
  .stat-num { font-size: 1.65rem; }
  .page-header { align-items: flex-start; }
  .page-header .btn { width: 100%; }
  .search-bar .btn { flex: 1; }
}

@media print {
  .navbar, .nav-toggle, .site-footer, .no-print { display: none !important; }
  .page-wrap { margin: 0; padding: 0; max-width: none; }
  body { background: #fff; }
  body::before { display: none; }
  .card { box-shadow: none; border-color: #ddd; }
}
