/* NexoCRM — global styles */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #e0e7ff;
  --accent: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --sidebar-active: #6366f1;
  --sidebar-hover: #312e81;

  --ai-bg: #faf5ff;
  --ai-border: #ddd6fe;
  --ai-bubble: #ede9fe;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

img, svg { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

h1, h2, h3, h4, h5 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 1.35rem; font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }

p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.2rem; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: .9em; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.15rem; border-radius: var(--radius); font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; cursor: pointer; transition: all .15s; text-decoration: none;
  min-height: 44px; line-height: 1;
}
.btn-sm { padding: .45rem .85rem; font-size: .85rem; min-height: 36px; }
.btn-lg { padding: .9rem 1.5rem; font-size: 1.05rem; min-height: 52px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
label { display: block; font-size: .88rem; font-weight: 500; color: var(--text); margin-bottom: .35rem; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: .95rem; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s; min-height: 44px;
}
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, textarea:-webkit-autofill, select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.checkbox-row { display: flex; align-items: center; gap: .5rem; }
.checkbox-row input { width: auto; min-height: 0; }
.help-text { font-size: .82rem; color: var(--text-muted); margin-top: .3rem; }
.form-error { color: var(--danger); font-size: .88rem; margin: .35rem 0; }

.alert { padding: .85rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .95rem; }
.alert-info { background: #dbeafe; color: #1e40af; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card-lg { padding: 1.75rem; border-radius: var(--radius-lg); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-header h3 { margin: 0; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-lead { background: #dbeafe; color: #1e40af; }
.badge-prospect { background: #ede9fe; color: #5b21b6; }
.badge-customer { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #e5e7eb; color: #374151; }
.badge-priority-low { background: #e5e7eb; color: #374151; }
.badge-priority-medium { background: #fef3c7; color: #92400e; }
.badge-priority-high { background: #fee2e2; color: #991b1b; }
.badge-stage-new { background: #dbeafe; color: #1e40af; }
.badge-stage-contacted { background: #ede9fe; color: #5b21b6; }
.badge-stage-qualified { background: #cffafe; color: #155e75; }
.badge-stage-proposal { background: #fef3c7; color: #92400e; }
.badge-stage-negotiation { background: #fed7aa; color: #9a3412; }
.badge-stage-won { background: #d1fae5; color: #065f46; }
.badge-stage-lost { background: #fee2e2; color: #991b1b; }

/* Public header */
.public-header {
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); color: #fff; font-size: 1rem; }
.brand-name { letter-spacing: -.01em; }
.public-nav { display: flex; align-items: center; gap: 1.25rem; }
.public-nav a { color: var(--text); font-weight: 500; font-size: .95rem; }
.public-nav a.btn-primary, .public-nav a.btn-ghost { font-weight: 600; }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.4rem; color: var(--text); cursor: pointer; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .public-nav {
    position: fixed; inset: 64px 0 auto 0; background: var(--surface); border-bottom: 1px solid var(--border);
    flex-direction: column; gap: 1rem; padding: 1.5rem 1.25rem; transform: translateY(-120%);
    transition: transform .25s ease; z-index: 49;
  }
  .nav-open .public-nav { transform: translateY(0); }
  .public-nav a { width: 100%; }
}

/* Landing */
.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 7vw, 5rem);
  background: radial-gradient(ellipse at top, #ede9fe 0%, #f8fafc 60%);
  overflow: hidden;
}
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 2rem; } }
.hero-eyebrow { display: inline-flex; align-items: center; gap: .5rem; background: var(--primary-light); color: var(--primary-dark);
  padding: .35rem .8rem; border-radius: 999px; font-size: .82rem; font-weight: 600; margin-bottom: 1rem; }
.hero h1 { margin-bottom: 1rem; }
.hero-lede { font-size: 1.15rem; color: var(--text-muted); margin-bottom: 2rem; max-width: 540px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.5rem; }
.hero-note { color: var(--text-muted); font-size: .88rem; }

.hero-mockup {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1rem; box-shadow: var(--shadow-lg); transform: rotate(-1deg);
}
.hero-mockup-head { display: flex; gap: .35rem; margin-bottom: 1rem; }
.hero-mockup-head span { width: 12px; height: 12px; border-radius: 50%; background: #e2e8f0; }
.hero-mockup-head span:nth-child(1) { background: #fca5a5; }
.hero-mockup-head span:nth-child(2) { background: #fcd34d; }
.hero-mockup-head span:nth-child(3) { background: #86efac; }
.hero-mock-row { display: grid; grid-template-columns: 44px 1fr auto; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.hero-mock-avatar { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #a5b4fc, #c4b5fd); color: #fff; font-weight: 600; font-size: .9rem; }
.hero-mock-meta { min-width: 0; }
.hero-mock-name { font-weight: 600; font-size: .9rem; }
.hero-mock-sub { color: var(--text-muted); font-size: .8rem; }

.section { padding: clamp(3rem, 6vw, 5rem) 0; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 3rem; }
.section-head p { color: var(--text-muted); font-size: 1.05rem; }

.pain-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 820px) { .pain-grid { grid-template-columns: 1fr; } }
.pain-item { text-align: center; padding: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.pain-item .pain-old { color: var(--text-light); text-decoration: line-through; font-size: .9rem; }
.pain-item .pain-new { margin-top: .25rem; color: var(--accent); font-weight: 600; }
.pain-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--primary-light); color: var(--primary); display: grid; place-items: center; font-size: 1.4rem; margin: 0 auto 1rem; }

.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 900px) { .feat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .feat-grid { grid-template-columns: 1fr; } }
.feat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; transition: transform .15s, box-shadow .15s; }
.feat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.feat-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--primary-light); color: var(--primary);
  display: grid; place-items: center; font-size: 1.25rem; margin-bottom: 1rem; }
.feat-card h3 { margin-bottom: .4rem; }
.feat-card p { color: var(--text-muted); margin: 0; }

.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; position: relative; }
@media (max-width: 820px) { .how-grid { grid-template-columns: 1fr; } }
.how-step { text-align: center; padding: 0 1rem; }
.how-num { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 1rem; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 1.3rem; font-weight: 700; }
.how-step h3 { margin-bottom: .5rem; }
.how-step p { color: var(--text-muted); }

.tstmnl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
@media (max-width: 900px) { .tstmnl-grid { grid-template-columns: 1fr; } }
.tstmnl { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.tstmnl p { font-style: italic; color: var(--text); }
.tstmnl-author { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; }
.tstmnl-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #a5b4fc, #c4b5fd); color: #fff; display: grid; place-items: center; font-weight: 600; }

.cta-section { text-align: center; padding: clamp(3rem, 6vw, 5rem) 1.25rem;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); color: #fff; border-radius: var(--radius-lg); margin: 3rem 0; }
.cta-section h2 { color: #fff; }
.cta-section p { color: #e0e7ff; font-size: 1.1rem; }
.cta-section .btn-primary { background: #fff; color: var(--primary-dark); }
.cta-section .btn-primary:hover { background: #f8fafc; color: var(--primary-dark); }

/* Footer */
.site-footer { background: #0f172a; color: #cbd5e1; padding: 3rem 0 1.5rem; margin-top: 4rem; }
.site-footer .brand { color: #fff; }
.site-footer p { color: #94a3b8; font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h5 { color: #fff; margin-bottom: .75rem; font-size: .95rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: .4rem; }
.footer-grid a { color: #cbd5e1; font-size: .9rem; }
.footer-grid a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 1.25rem; margin-top: 2rem; font-size: .85rem; color: #94a3b8; }

.cookie-banner {
  position: fixed; bottom: 1rem; left: 1rem; right: 1rem; max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1rem 1.25rem; box-shadow: var(--shadow-lg); display: flex; align-items: center;
  gap: 1rem; z-index: 80; font-size: .9rem;
}
@media (max-width: 540px) { .cookie-banner { flex-direction: column; align-items: flex-start; } }

/* Auth pages */
.auth-wrap { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 1.75rem; margin-bottom: .5rem; }
.auth-card .sub { color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-card .btn { width: 100%; }
.auth-links { text-align: center; margin-top: 1.25rem; font-size: .9rem; color: var(--text-muted); }
.pw-strength { height: 4px; background: var(--border); border-radius: 2px; margin-top: .5rem; overflow: hidden; }
.pw-strength-bar { height: 100%; width: 0; transition: width .2s, background-color .2s; background: var(--danger); }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); background: none; border: 0;
  color: var(--text-muted); cursor: pointer; padding: .25rem; }

/* Toasts */
.flash-stack { position: fixed; top: 1rem; right: 1rem; display: grid; gap: .5rem; z-index: 200; }
.toast-host { position: fixed; top: 1rem; right: 1rem; display: grid; gap: .5rem; z-index: 200; max-width: calc(100vw - 2rem); }
.toast {
  padding: .85rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-md); font-size: .9rem; max-width: 360px; display: flex; gap: .5rem; align-items: flex-start;
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.toast-success { border-left: 4px solid var(--accent); }
.toast-error   { border-left: 4px solid var(--danger); }
.toast-info    { border-left: 4px solid var(--info); }
.toast-warning { border-left: 4px solid var(--warning); }

/* Modals */
[hidden] { display: none !important; }
.modal-host { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 300; display: grid; place-items: center; padding: 1rem; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: 1.25rem; }
.modal-close { background: none; border: 0; font-size: 1.3rem; color: var(--text-muted); cursor: pointer; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }
@media (max-width: 520px) {
  .modal-host { padding: 0; }
  .modal { border-radius: 0; max-height: 100vh; height: 100vh; }
}

/* Tables */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .92rem; vertical-align: middle; }
.data-table th { background: var(--surface-2); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

.tag { display: inline-block; background: var(--surface-2); color: var(--text-muted); padding: .15rem .55rem; border-radius: 999px; font-size: .76rem; margin-right: .25rem; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; color: var(--primary-light); margin-bottom: 1rem; }
.empty-state h3 { color: var(--text); margin-bottom: .5rem; }

/* Ad placeholders */
.ad-placeholder {
  background: repeating-linear-gradient(45deg, #f1f5f9, #f1f5f9 10px, #e2e8f0 10px, #e2e8f0 20px);
  border: 1px dashed var(--border); display: grid; place-items: center;
  color: var(--text-light); font-size: .8rem; font-weight: 500; border-radius: var(--radius); margin: 1rem auto;
}
.ad-728x90 { max-width: 728px; height: 90px; }
.ad-300x250 { max-width: 300px; height: 250px; }

/* FAQ */
.faq-list { display: grid; gap: .75rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.faq-item summary { cursor: pointer; font-weight: 600; color: var(--text); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::after { content: '+'; color: var(--primary); font-size: 1.25rem; font-weight: 700; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { margin-top: .75rem; color: var(--text-muted); }

/* Utility */
.muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
