/* ExportsMission CRM — full UI revamp layer
   This file intentionally overrides style.css and patch1.css without changing business logic. */

:root {
  --primary: #4f46e5;
  --primary-2: #2563eb;
  --primary-3: #0891b2;
  --accent: #14b8a6;
  --success: #16a34a;
  --danger: #dc2626;
  --warn: #d97706;
  --ink: #0f172a;
  --text: #172033;
  --text-soft: #475569;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --bg: #f4f7fb;
  --bg-2: #eaf1ff;
  --surface: rgba(255,255,255,.86);
  --surface-solid: #ffffff;
  --surface-muted: #f8fafc;
  --border: rgba(148, 163, 184, .24);
  --border-strong: rgba(100, 116, 139, .32);
  --sidebar-w: 286px;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 22px 70px rgba(15, 23, 42, .10);
  --shadow-sm: 0 12px 30px rgba(15, 23, 42, .07);
  --ring: 0 0 0 4px rgba(79, 70, 229, .14);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { scrollbar-width: thin; scrollbar-color: rgba(79,70,229,.35) rgba(226,232,240,.8); }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(79,70,229,.32); border-radius: 999px; }
*::-webkit-scrollbar-track { background: rgba(226,232,240,.7); }

html, body { max-width: 100%; overflow-x: hidden; }
body {
  color: var(--text);
  background:
    radial-gradient(circle at 4% 4%, rgba(79, 70, 229, .15), transparent 31rem),
    radial-gradient(circle at 88% 10%, rgba(20, 184, 166, .15), transparent 28rem),
    radial-gradient(circle at 60% 96%, rgba(37, 99, 235, .11), transparent 32rem),
    linear-gradient(135deg, #f7faff 0%, #f2f6fc 45%, #eef4ff 100%);
}
body::before {
  opacity: .32;
  background-image:
    linear-gradient(rgba(79, 70, 229, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, .05) 1px, transparent 1px);
  background-size: 48px 48px;
}
a { color: var(--primary-2); }
a:hover { color: var(--primary); }

.app-shell {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  width: 100%;
}

/* Sidebar navigation */
.navbar {
  width: var(--sidebar-w);
  padding: 1.15rem;
  background:
    linear-gradient(180deg, rgba(8, 13, 28, .98), rgba(13, 18, 35, .965)),
    radial-gradient(circle at 20% 0%, rgba(79, 70, 229, .34), transparent 18rem),
    radial-gradient(circle at 110% 72%, rgba(20, 184, 166, .2), transparent 16rem);
  border-right: 1px solid rgba(148,163,184,.18);
  box-shadow: 18px 0 60px rgba(15,23,42,.18);
}
.navbar::after {
  content: "";
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: .75rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125,211,252,.45), transparent);
}
.nav-brand {
  min-height: 62px;
  padding: .45rem .35rem .7rem;
  border-bottom: 1px solid rgba(148,163,184,.14);
  margin-bottom: .35rem;
}
.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 17px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  box-shadow: 0 18px 38px rgba(79,70,229,.33), inset 0 1px 0 rgba(255,255,255,.28);
}
.brand-name { font-size: 1.06rem; letter-spacing: -.04em; }
.brand-sub { color: #94a3b8; font-size: .72rem; }
.brand-tag {
  color: #dbeafe;
  background: rgba(59, 130, 246, .16);
  border-color: rgba(147, 197, 253, .22);
}
.nav-links { gap: .44rem; padding-top: .8rem; }
.nav-links a {
  min-height: 46px;
  padding: .78rem .86rem;
  border-radius: 16px;
  color: #b7c2d4;
  letter-spacing: -.01em;
}
.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99,102,241,.24), rgba(6,182,212,.10));
  border-color: rgba(165,180,252,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 12px 30px rgba(2,6,23,.16);
}
.nav-links a.active::before {
  left: .38rem;
  height: 24px;
  background: linear-gradient(180deg, #22d3ee, #6366f1);
}
.nav-link-icon { color: #93c5fd; }
.nav-links a.active .nav-link-icon,
.nav-links a:hover .nav-link-icon { color: #e0f2fe; }
.nav-count,
.bell-badge {
  box-shadow: 0 10px 22px rgba(37,99,235,.24);
}
.nav-user {
  gap: .65rem;
  border-top-color: rgba(148,163,184,.14);
}
.user-tag, .bell-btn, .btn-logout {
  border-radius: 16px;
}
.user-tag {
  background: rgba(255,255,255,.055);
  border-color: rgba(148,163,184,.16);
}
.btn-logout {
  background: rgba(248, 113, 113, .10);
  border-color: rgba(248, 113, 113, .18);
}

/* Page canvas */
.page-wrap {
  flex: 1;
  width: calc(100% - var(--sidebar-w));
  max-width: none;
  margin-left: var(--sidebar-w);
  padding: 2rem clamp(1rem, 3vw, 2.6rem) 1.5rem;
  overflow-x: clip;
}
.page-wrap > * {
  max-width: 1480px;
  margin-left: auto;
  margin-right: auto;
}
.page-header {
  position: relative;
  padding: 1.35rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(226,232,240,.74);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.70)),
    radial-gradient(circle at top right, rgba(79,70,229,.14), transparent 20rem);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}
.page-header::before {
  content: "";
  position: absolute;
  left: 1.35rem;
  right: 1.35rem;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, rgba(79,70,229,.45), rgba(20,184,166,.35), transparent);
}
.page-title-wrap { align-items: center; }
.page-title-icon {
  width: 46px;
  height: 46px;
  border-radius: 17px;
  background: linear-gradient(135deg, rgba(79,70,229,.16), rgba(20,184,166,.12));
  color: var(--primary);
}
.page-header h1 {
  color: var(--ink);
  font-size: clamp(1.45rem, 2.4vw, 2.2rem);
  font-weight: 900;
}
.page-subtitle {
  color: var(--muted);
  font-weight: 550;
}

/* Cards and panels */
.card,
.login-card,
.modal-box,
.search-bar,
.section-tabs,
.followup-banner,
.next-action-panel,
.stat-card {
  background: linear-gradient(180deg, rgba(255,255,255,.93), rgba(255,255,255,.80));
  border: 1px solid rgba(226,232,240,.84);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}
.card,
.login-card,
.modal-box { border-radius: 24px; }
.card { padding: 1.25rem; }
.card[style*="padding:0"] { overflow: hidden; }
.card-title {
  color: var(--ink);
  font-size: 1rem;
  letter-spacing: -.025em;
}
.card-title i { color: var(--primary); }
.card + .card { margin-top: 1rem; }
.card:hover,
.stat-card:hover,
.followup-banner:hover,
.search-bar:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 50px rgba(15,23,42,.10);
}

/* Buttons */
.btn {
  border-radius: 14px;
  min-height: 38px;
  letter-spacing: -.01em;
  box-shadow: none;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #0891b2);
  box-shadow: 0 14px 30px rgba(79,70,229,.23);
}
.btn-primary:hover { box-shadow: 0 18px 38px rgba(79,70,229,.30); }
.btn-success { background: linear-gradient(135deg, #16a34a, #0d9488); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-warn { background: linear-gradient(135deg, #f59e0b, #d97706); }
.btn-outline {
  background: rgba(255,255,255,.78);
  color: var(--primary);
  border-color: rgba(79,70,229,.26);
}
.btn-ghost {
  background: rgba(248,250,252,.86);
  color: var(--text);
  border-color: rgba(148,163,184,.24);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { min-height: 32px; border-radius: 12px; }

/* Forms */
.form-section-title,
.section-title {
  color: var(--primary);
  border-bottom-color: rgba(148,163,184,.22);
}
label { color: #536179; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=url], input[type=datetime-local], select, textarea {
  border-radius: 15px;
  border-color: rgba(148,163,184,.30);
  background: rgba(255,255,255,.82);
  color: var(--ink);
}
input:hover, select:hover, textarea:hover { border-color: rgba(79,70,229,.28); }
input:focus, select:focus, textarea:focus {
  border-color: rgba(79,70,229,.62);
  box-shadow: var(--ring);
}
.form-hint { color: var(--muted); }

/* Tables */
.table-wrap {
  border-radius: 22px;
  border: 1px solid rgba(226,232,240,.72);
  background: rgba(255,255,255,.66);
}
table { border-spacing: 0; }
thead th {
  background: rgba(241,245,249,.92);
  color: #64748b;
  padding: .88rem 1rem;
}
tbody td {
  padding: .95rem 1rem;
  border-bottom-color: rgba(226,232,240,.72);
}
tbody tr { background: rgba(255,255,255,.54); }
tbody tr:hover {
  background: rgba(79,70,229,.055);
}
tbody td:first-child a { font-weight: 850; color: var(--ink); }
.table-actions { gap: .45rem; }

/* Stats */
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
}
.stat-card {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 24px;
  padding: 1.35rem;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(79,70,229,.16), rgba(6,182,212,.10));
  border: 1px solid rgba(79,70,229,.10);
}
.stat-card::after {
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(79,70,229,.13), transparent 68%);
}
.stat-num {
  color: var(--primary);
  font-size: clamp(1.8rem, 3vw, 2.55rem);
  letter-spacing: -.06em;
}
.stat-label {
  color: #607089;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Badges */
.badge {
  min-height: 24px;
  padding: .28rem .68rem;
  border-radius: 999px;
  font-weight: 850;
}
.badge-new { background: rgba(79,70,229,.10); color: #4338ca; border-color: rgba(79,70,229,.18); }
.badge-started { background: rgba(8,145,178,.10); color: #0e7490; border-color: rgba(8,145,178,.18); }
.badge-followup { background: rgba(245,158,11,.12); color: #b45309; border-color: rgba(245,158,11,.18); }
.badge-confirmed { background: rgba(22,163,74,.11); color: #15803d; border-color: rgba(22,163,74,.18); }
.badge-dropped { background: rgba(100,116,139,.12); color: #475569; border-color: rgba(100,116,139,.16); }

/* Search and tabs */
.search-bar {
  padding: .85rem;
  border-radius: 22px;
}
.section-tabs {
  padding: .55rem;
  border-radius: 20px;
  gap: .45rem;
}
.tab-btn {
  border: 0;
  background: transparent;
  color: #64748b;
}
.tab-btn:hover { background: rgba(79,70,229,.08); }
.tab-btn.active {
  background: linear-gradient(135deg, #111827, #1e293b);
  color: #fff;
  box-shadow: 0 12px 26px rgba(15,23,42,.18);
}

/* Follow-up and next action */
.followup-banner {
  border-radius: 22px;
  border-color: rgba(245,158,11,.22);
  background: linear-gradient(135deg, rgba(255,247,237,.95), rgba(255,255,255,.80));
}
.followup-banner .fu-title { color: #9a3412; }
.followup-banner .fu-meta { color: #b45309; }
.fu-icon,
.next-action-icon,
.notif-icon,
.es-icon {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}
.next-action-panel {
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(79,70,229,.10), rgba(20,184,166,.075), rgba(255,255,255,.78));
}
.next-action-label { color: var(--primary); }
.next-action-text { color: var(--ink); }

/* Goal rows */
.goal-board-card { border-radius: 24px; }
.goal-row {
  padding: 1.05rem 1.25rem;
  background: rgba(255,255,255,.62);
}
.goal-row:hover { background: rgba(79,70,229,.05); }
.goal-row.is-overdue { background: rgba(254,242,242,.76); }
.goal-title { color: var(--ink); }
.goal-todo {
  background: rgba(248,250,252,.84);
  border-color: rgba(148,163,184,.22);
}
.mini-goal-item { background: rgba(255,255,255,.72); }

/* Prospect detail and conversations */
.prospect-layout { align-items: start; }
.detail-label { color: #667085; }
.detail-value { color: var(--ink); }
.conv-item,
.conv-label,
.conv-text,
.conv-meta {
  background: rgba(255,255,255,.76);
  border-color: rgba(226,232,240,.86);
}
.conv-enhanced {
  border-left: 4px solid rgba(79,70,229,.35);
}
.conv-user { color: var(--primary); }
.client-response {
  background: rgba(240,253,244,.84);
  border-color: rgba(22,163,74,.18) !important;
}
.internal-note {
  background: rgba(255,251,235,.86);
  border-color: rgba(245,158,11,.20) !important;
}
.conv-next-step {
  background: rgba(238,242,255,.90);
  border-color: rgba(99,102,241,.20);
}

/* Sales template UI */
.sales-message-card { overflow: hidden; }
.sales-head { gap: 1rem; }
.sales-template-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
}
.sales-template-item {
  position: relative;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.82));
  border-color: rgba(226,232,240,.88);
}
.sales-template-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 22px 0 0 22px;
}
.sales-template-type { color: var(--ink); }
.sales-focus {
  background: rgba(238,242,255,.78);
  border-left-color: rgba(79,70,229,.48);
}
.sales-message-text {
  border-radius: 16px;
  background: rgba(255,255,255,.86);
  line-height: 1.62;
}
.research-strip,
.research-preview,
.sales-rules-box {
  border-radius: 18px;
}
.research-strip { background: rgba(238,242,255,.75); }
.research-preview { background: rgba(248,250,252,.90); }
.sales-rules-box { background: rgba(240,253,244,.88); }

/* Notifications */
.notif-item {
  background: rgba(255,255,255,.70);
  border-bottom-color: rgba(226,232,240,.76);
}
.notif-item.unread { background: rgba(238,242,255,.80); }
.notif-icon { background: rgba(79,70,229,.10); color: var(--primary); }

/* Empty states */
.empty-state {
  border-radius: 22px;
  color: var(--muted);
}
.es-icon {
  background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(20,184,166,.10));
  color: var(--primary);
}

/* Modals */
.modal-overlay {
  background: rgba(15,23,42,.58);
  backdrop-filter: blur(12px);
}
.modal-box {
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
}
.modal-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #f1f5f9;
}
.modal-title { color: var(--ink); font-size: 1.18rem; }

/* Login page */
.login-wrap {
  background:
    radial-gradient(circle at 22% 16%, rgba(79,70,229,.18), transparent 28rem),
    radial-gradient(circle at 78% 24%, rgba(20,184,166,.15), transparent 22rem),
    linear-gradient(135deg, #f8fbff, #eef4ff);
}
.login-card {
  max-width: 450px;
  padding: 2rem;
}
.login-logo { margin-bottom: 1.45rem; }
.login-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto .8rem;
  border-radius: 22px;
  color: #fff;
  font-weight: 900;
  letter-spacing: .08em;
  background: linear-gradient(135deg, #4f46e5, #0891b2);
  box-shadow: 0 18px 38px rgba(79,70,229,.27);
}
.login-logo h1 { font-size: 1.75rem; color: var(--ink); }
.login-logo p { color: var(--muted); }

/* Footer */
.site-footer {
  color: #7b8799;
  border-top: 1px solid rgba(148,163,184,.16);
  margin-top: 1.5rem;
}

/* Hard overflow guards */
.card,
.modal-box,
.table-wrap,
.prospect-layout,
.sales-template-item,
.sales-message-text,
.conv-item,
.goal-row,
.next-action-panel,
.detail-value,
.conv-message p,
.sales-focus,
.form-hint,
.research-strip,
.research-preview { min-width: 0; overflow-wrap: anywhere; }
img, video, canvas, iframe { max-width: 100%; }

/* Mobile */
@media (max-width: 1100px) {
  :root { --sidebar-w: 270px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .navbar {
    width: min(88vw, 320px);
    transform: translateX(-104%);
  }
  body.nav-open .navbar { transform: translateX(0); }
  .page-wrap {
    width: 100%;
    margin-left: 0;
    padding-top: 4.8rem;
  }
  .page-header { border-radius: 24px; }
  .nav-toggle { display: grid; place-items: center; }
}
@media (max-width: 720px) {
  .page-wrap { padding-left: .9rem; padding-right: .9rem; }
  .page-header { padding: 1rem; }
  .card { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat-card { min-height: 112px; padding: 1rem; }
  .search-bar { display: grid; grid-template-columns: 1fr; }
  .search-bar .btn { width: 100%; }
  .section-tabs { overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; }
  .tab-btn { white-space: nowrap; flex: 0 0 auto; }
  .sales-head-actions,
  .sales-template-actions,
  .goal-actions,
  .table-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
  .sales-head-actions .btn,
  .sales-template-actions .btn,
  .goal-actions .btn,
  .table-actions .btn,
  .sales-template-actions form,
  .sales-head-actions form { width: 100%; }
  .modal-box { padding: 1rem; }
}
@media (max-width: 520px) {
  body { font-size: 14px; }
  .page-wrap { padding-inline: .72rem; }
  .page-header h1 { font-size: 1.35rem; }
  .page-title-icon { width: 40px; height: 40px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 96px; }
  .table-wrap { border-radius: 18px; }
  table { min-width: 720px; }
  .btn { white-space: normal; }
  .sales-head-actions,
  .sales-template-actions,
  .goal-actions,
  .table-actions { grid-template-columns: 1fr; }
  .login-card { padding: 1.25rem; }
}
@media print {
  .page-wrap > * { max-width: none; }
  .card, .stat-card { background: #fff; }
}
