:root {
  --emerald: #059669;
  --emerald-dark: #047857;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #0284c7;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 10px 25px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--slate-900);
  background: var(--slate-50);
  line-height: 1.5;
  font-size: 14px;
}
body.dark-ui {
  background: #0b1120;
  color: #f8fafc;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* Utilities */
.container { max-width: 1220px; margin: 0 auto; padding: 0 20px; }
.hidden { display: none !important; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #e0f2fe; color: #075985; }
.badge-gray { background: #e2e8f0; color: #475569; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 600; font-size: 13px; cursor: pointer; transition: 0.15s ease;
}
.btn-primary { background: var(--emerald); color: var(--white); }
.btn-primary:hover { background: var(--emerald-dark); }
.btn-dark { background: var(--slate-900); color: var(--white); }
.btn-dark:hover { background: var(--slate-800); }
.btn-outline { background: var(--white); color: var(--slate-700); border-color: var(--slate-200); }
.btn-outline:hover { background: var(--slate-100); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--slate-200); border-radius: 8px;
  background: var(--white); color: var(--slate-900); font-size: 13px; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12); }
.label { display: block; font-size: 12px; font-weight: 600; color: var(--slate-700); margin-bottom: 5px; }
.card { background: var(--white); border: 1px solid var(--slate-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); }

/* Toast */
#sp-toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.sp-toast {
  padding: 11px 16px; border-radius: 8px; color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18); animation: fadeSlideIn 0.2s ease;
}
.sp-toast-success { background: #059669; }
.sp-toast-error { background: #dc2626; }
.sp-toast-info { background: #0284c7; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Public Landing Navbar & Hero */
.site-nav {
  position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--slate-200);
}
.site-nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; color: var(--slate-900); }
.brand-logo-img { width: 38px; height: 38px; border-radius: 9px; object-fit: contain; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #059669, #10b981);
  color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 16px;
}
.nav-links { display: flex; align-items: center; gap: 22px; font-weight: 600; color: var(--slate-700); }
.nav-links a:hover { color: var(--emerald); }
.nav-cta { display: flex; align-items: center; gap: 10px; }

.hero-section {
  background: radial-gradient(circle at 80% 10%, rgba(16, 185, 129, 0.12), transparent 45%),
              linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 64px 0 54px; border-bottom: 1px solid var(--slate-200);
}
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 36px; align-items: center; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px;
  background: var(--emerald-soft); border: 1px solid var(--emerald-border); color: var(--emerald-dark);
  font-size: 12px; font-weight: 700; margin-bottom: 16px;
}
.hero-title { font-size: 40px; line-height: 1.14; font-weight: 800; letter-spacing: -0.02em; color: var(--slate-900); }
.hero-sub { margin-top: 16px; font-size: 16px; color: var(--slate-500); max-width: 600px; }
.hero-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; }
.hero-stats { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 24px; font-size: 12px; color: var(--slate-500); }
.hero-stats strong { display: block; font-size: 18px; color: var(--slate-900); }
.hero-preview-card { padding: 20px; background: linear-gradient(145deg, #09081b 0%, #17153b 100%); color: #f8fafc; border-radius: 14px; box-shadow: 0 24px 50px rgba(15, 23, 42, 0.28); border: 1px solid rgba(139, 92, 246, 0.25); }
.preview-kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
.preview-kpi { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; padding: 12px; }
.preview-kpi span { font-size: 11px; color: var(--slate-400); }
.preview-kpi b { display: block; font-size: 20px; color: #34d399; margin-top: 2px; }

.section-pad { padding: 64px 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 38px; }
.section-head h2 { font-size: 30px; font-weight: 800; margin-top: 8px; }
.section-head p { color: var(--slate-500); margin-top: 8px; }

.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature-card { padding: 22px; }
.feature-icon {
  width: 40px; height: 40px; border-radius: 9px; background: var(--emerald-soft); color: var(--emerald);
  display: grid; place-items: center; font-size: 18px; font-weight: 700; margin-bottom: 14px;
}
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: var(--slate-500); }

/* Pricing Calculator (ChatKnow 1:1 Port Box + Tiers) */
.pricing-box { padding: 28px; }
.tier-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.tier-tab {
  padding: 14px 16px; border: 2px solid var(--slate-200); border-radius: 10px; cursor: pointer;
  background: var(--white); text-align: left; transition: 0.15s;
}
.tier-tab.active { border-color: var(--emerald); background: var(--emerald-soft); }
.tier-tab-title { font-weight: 800; font-size: 15px; color: var(--slate-900); }
.tier-tab-sub { font-size: 12px; color: var(--slate-500); margin-top: 2px; }

.calc-grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 28px; align-items: start; }
.benefits-list { list-style: none; display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.benefits-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--slate-700); }
.benefits-list li::before { content: '✔'; color: var(--emerald); font-weight: 800; }

.port-qty-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 20px; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--slate-200); border-radius: 8px; overflow: hidden; background: var(--white); }
.qty-btn { width: 38px; height: 38px; border: none; background: var(--slate-100); font-size: 18px; font-weight: 700; cursor: pointer; }
.qty-btn:hover { background: var(--slate-200); }
.qty-input { width: 76px; height: 38px; border: none; text-align: center; font-size: 16px; font-weight: 800; outline: none; }

.duration-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.dur-card {
  position: relative; border: 2px solid var(--slate-200); border-radius: 10px; padding: 18px 10px 12px;
  text-align: center; cursor: pointer; background: var(--white); transition: 0.15s;
}
.dur-card.active { border-color: var(--emerald); background: var(--emerald-soft); }
.dur-badge {
  position: absolute; top: 0; left: 0; background: var(--emerald); color: #fff;
  font-size: 10px; font-weight: 800; padding: 2px 8px; border-bottom-right-radius: 8px;
}
.dur-days { font-size: 12px; font-weight: 700; color: var(--slate-700); margin-top: 6px; }
.dur-price { font-size: 22px; font-weight: 800; color: var(--slate-900); margin: 4px 0; }
.dur-unit { font-size: 11px; color: var(--slate-500); }

/* Company Admin Dashboard Layout (ChatKnow User Dashboard 1:1) */
.app-shell { display: flex; min-height: 100vh; }
.ck-sidebar {
  width: 236px; flex-shrink: 0; background: linear-gradient(180deg, #059669 0%, #047857 100%);
  color: #ecfdf5; display: flex; flex-direction: column; justify-content: space-between;
}
.ck-brand { padding: 16px 18px; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.14); }
.ck-nav { padding: 10px 8px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.ck-nav-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: none; background: transparent; color: rgba(255, 255, 255, 0.88);
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; text-align: left;
}
.ck-nav-btn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.ck-nav-btn.active { background: #ffffff; color: var(--emerald-dark); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12); }
.ck-sidebar-foot { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.16); display: flex; gap: 8px; }
.ck-foot-link { flex: 1; text-align: center; padding: 7px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; background: rgba(255,255,255,0.15); color: #fff; cursor: pointer; }
.ck-foot-link:hover { background: rgba(255,255,255,0.25); }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  height: 58px; background: var(--white); border-bottom: 1px solid var(--slate-200);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px; gap: 14px;
}
.app-body { padding: 20px 24px; flex: 1; overflow-y: auto; }

.ck-hero-banner {
  background: linear-gradient(120deg, #059669 0%, #10b981 65%, #34d399 100%);
  border-radius: 12px; color: #fff; padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px;
}
.ck-port-metrics { display: flex; gap: 28px; flex-wrap: wrap; }
.ck-port-metric { text-align: center; }
.ck-port-metric span { font-size: 12px; opacity: 0.9; display: block; }
.ck-port-metric b { font-size: 26px; font-weight: 800; }

.kpi-5-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 16px 0; }
.kpi-mini { padding: 14px; }
.kpi-mini-label { font-size: 12px; font-weight: 700; color: var(--slate-700); display: flex; justify-content: space-between; }
.kpi-mini-sub { font-size: 11px; color: var(--slate-400); margin-top: 4px; }

.dash-3col { display: grid; grid-template-columns: 1.15fr 1fr 0.95fr; gap: 16px; margin-bottom: 16px; }
.hot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.hot-tile {
  padding: 12px 8px; border: 1px solid var(--slate-200); border-radius: 8px;
  text-align: center; cursor: pointer; background: var(--slate-50); font-size: 12px; font-weight: 600;
}
.hot-tile:hover { border-color: var(--emerald); background: var(--emerald-soft); color: var(--emerald-dark); }

/* Super Admin Theme (WACRM Style Dark Sidebar) */
.sa-sidebar { width: 248px; flex-shrink: 0; background: var(--slate-900); color: #cbd5e1; display: flex; flex-direction: column; }
.sa-brand { padding: 16px 18px; border-bottom: 1px solid #1e293b; font-size: 16px; font-weight: 800; color: #38bdf8; display: flex; align-items: center; gap: 8px; }
.sa-nav-group { padding: 10px 10px 2px; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--slate-500); }
.sa-nav-btn {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: none; background: transparent;
  color: #cbd5e1; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; text-align: left;
}
.sa-nav-btn:hover { background: #1e293b; color: #fff; }
.sa-nav-btn.active { background: #0284c7; color: #fff; }

/* Tables & Forms */
.table-wrap { width: 100%; overflow-x: auto; }
.sp-table { width: 100%; border-collapse: collapse; font-size: 12.5px; text-align: left; }
.sp-table th { background: var(--slate-100); color: var(--slate-700); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--slate-200); white-space: nowrap; }
.sp-table td { padding: 10px 12px; border-bottom: 1px solid var(--slate-200); vertical-align: middle; }
.sp-table tr:hover td { background: var(--slate-50); }

.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.65); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal-panel {
  background: var(--white); border-radius: 12px; width: 100%; max-width: 880px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
}
.modal-panel.modal-sm { max-width: 480px; }
.modal-header { padding: 16px 22px; background: var(--emerald); color: #fff; display: flex; justify-content: space-between; align-items: center; }
.modal-close { background: transparent; border: none; color: #fff; font-size: 20px; cursor: pointer; font-weight: 700; }
.modal-body { padding: 20px 22px; }

/* Presence Dot */
.dot-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.dot-online { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.dot-idle { background: #f59e0b; }
.dot-offline { background: #94a3b8; }

.impersonate-bar {
  background: #fef3c7; color: #92400e; padding: 8px 20px; font-size: 12px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #fcd34d;
}

@media (max-width: 980px) {
  .hero-grid, .features-grid, .calc-grid, .dash-3col, .kpi-5-grid, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .duration-grid, .tier-tabs { grid-template-columns: repeat(2, 1fr); }
  .ck-sidebar, .sa-sidebar { width: 200px; }
}
@media (max-width: 720px) {
  .app-shell { flex-direction: column; }
  .ck-sidebar, .sa-sidebar { width: 100%; }
  .nav-links { display: none; }
}
