:root {
  --blue:#2563eb; --blue-dark:#1d4ed8; --bg:#f1f5f9; --card:#fff; --ink:#0f172a;
  --muted:#64748b; --line:#e2e8f0; --good:#16a34a; --bad:#dc2626; --sidebar:#0f172a;
}
* { box-sizing:border-box; }
body { margin:0; background:var(--bg); color:var(--ink); font-family:-apple-system,system-ui,"Segoe UI",Roboto,sans-serif; -webkit-font-smoothing:antialiased; }
a { color:var(--blue); text-decoration:none; }
h1 { font-size:24px; margin:0 0 18px; }
.muted { color:var(--muted); font-size:14px; }
.center { text-align:center; }
.error { color:var(--bad); font-size:14px; margin-top:8px; }
.hidden { display:none !important; }
.loading { color:var(--muted); text-align:center; padding:15vh 0; }

/* buttons + fields */
.btn-primary,.btn-secondary { display:inline-block; border:0; border-radius:10px; padding:12px 18px; font-size:15px; font-weight:600; cursor:pointer; text-align:center; }
.btn-primary { background:var(--blue); color:#fff; } .btn-primary:hover{ background:var(--blue-dark);}
.btn-primary.sm,.btn-secondary.sm { padding:8px 14px; font-size:13px; }
.btn-secondary { background:#e2e8f0; color:var(--ink); }
.btn-ghost { background:none; border:0; color:var(--muted); cursor:pointer; font-size:14px; padding:8px; }
.btn-danger { background:none; border:1px solid var(--bad); color:var(--bad); border-radius:8px; padding:7px 12px; font-size:13px; cursor:pointer; }
.field { width:100%; border:1px solid var(--line); border-radius:10px; padding:12px; font-size:15px; margin-bottom:12px; background:#fff; color:var(--ink); }
select.field { appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 14px center; padding-right:34px; cursor:pointer; }
.form-label { display:block; font-size:13px; font-weight:600; color:var(--muted); margin-bottom:6px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:16px; padding:24px; margin-bottom:16px; }

/* nav / landing */
.nav { display:flex; align-items:center; justify-content:space-between; padding:18px 6vw; background:#fff; border-bottom:1px solid var(--line); }
.brand { font-weight:800; font-size:20px; color:var(--ink); }
.nav nav a { margin-left:18px; font-weight:600; }
.hero { text-align:center; padding:9vh 6vw 6vh; }
.hero h1 { font-size:clamp(30px,5vw,52px); line-height:1.05; margin:0 0 16px; }
.hero p { font-size:18px; color:var(--muted); max-width:560px; margin:0 auto 22px; }
.hero-cta { display:flex; gap:12px; justify-content:center; flex-wrap:wrap; margin-bottom:14px; }
.features { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:18px; padding:2vh 6vw 8vh; max-width:1000px; margin:0 auto; }
.feature { background:#fff; border:1px solid var(--line); border-radius:16px; padding:24px; }
.feature h3 { margin:0 0 8px; }

/* auth */
.auth-wrap { max-width:400px; margin:8vh auto; padding:0 20px; }
.auth-wrap .brand { display:block; margin-bottom:24px; font-size:24px; }

/* app frame */
.app-frame { display:flex; min-height:100vh; }
.sidebar { width:220px; background:var(--sidebar); color:#cbd5e1; padding:22px 16px; display:flex; flex-direction:column; gap:6px; position:sticky; top:0; height:100vh; }
.sidebar .brand { color:#fff; margin-bottom:18px; }
.sidebar nav { display:flex; flex-direction:column; gap:2px; flex:1; }
.sidebar nav a { color:#cbd5e1; padding:10px 12px; border-radius:8px; font-size:14px; font-weight:500; }
.sidebar nav a:hover { background:#1e293b; color:#fff; }
.sidebar nav a.active { background:var(--blue); color:#fff; }
.sidebar .btn-ghost { color:#94a3b8; text-align:left; }
.content { flex:1; padding:32px clamp(20px,4vw,48px); max-width:1100px; }

/* stat tiles */
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:14px; margin-bottom:20px; }
.stat { background:#fff; border:1px solid var(--line); border-radius:14px; padding:18px; }
.stat .num { font-size:30px; font-weight:800; color:var(--blue); }
.stat .lbl { color:var(--muted); font-size:13px; margin-top:4px; }

/* tables/lists */
table { width:100%; border-collapse:collapse; font-size:14px; }
th,td { text-align:left; padding:11px 10px; border-bottom:1px solid var(--line); }
th { color:var(--muted); font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.03em; }
tr:last-child td { border-bottom:0; }
.badge { display:inline-block; padding:2px 10px; border-radius:999px; font-size:12px; font-weight:600; }
.badge.ok { background:#dcfce7; color:#166534; } .badge.warn{ background:#fef3c7; color:#92400e; }
.badge.bad { background:#fee2e2; color:#991b1b; } .badge.info{ background:#dbeafe; color:#1e40af; }
.row-actions { display:flex; gap:8px; }
.page-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.page-head h1 { margin:0; }
.toolbar { display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.toolbar .field { margin:0; max-width:280px; }
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.kv { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--line); font-size:14px; }
.qr { width:180px; height:180px; display:block; margin:12px auto; }

/* modal */
.modal { position:fixed; inset:0; background:rgba(15,23,42,.5); display:flex; align-items:center; justify-content:center; padding:20px; z-index:50; }
.modal-card { background:#fff; border-radius:16px; padding:26px; width:100%; max-width:440px; max-height:90vh; overflow:auto; }
.modal-card.wide { max-width:520px; }
.modal-card h2 { margin:0 0 16px; }

/* integrations */
.int-cat { font-size:16px; font-weight:600; color:var(--ink); margin:22px 0 10px; }
.int-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; margin-bottom:8px; }
.int-card { background:#fff; border:1px solid var(--line); border-radius:14px; padding:18px; display:flex; flex-direction:column; }
.int-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:6px; }
.int-card-head h4 { margin:0; font-size:15px; color:var(--ink); }
.int-desc { font-size:13px; color:var(--muted); flex:1; margin:0 0 14px; }
.int-error { font-size:12px; color:var(--bad); margin:0 0 12px; word-break:break-word; }
.int-notice { font-size:12px; color:#b45309; margin:0 0 12px; word-break:break-word; }
.int-card-foot { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.int-docs { font-size:13px; color:var(--blue); white-space:nowrap; }
.int-guide { background:#eef2ff; border:1px solid #c7d2fe; border-radius:10px; padding:12px 14px; margin-bottom:14px; }
.int-guide b { display:block; color:#3730a3; font-size:13px; margin-bottom:6px; }
.int-guide ol { margin:0; padding-left:18px; color:#4338ca; font-size:13px; display:flex; flex-direction:column; gap:4px; }
.int-guide li.done { opacity:.6; text-decoration:line-through; }
.int-instructions { background:#eff6ff; border:1px solid #bfdbfe; border-radius:10px; padding:12px 14px; margin-bottom:14px; font-size:13px; color:#1d4ed8; white-space:pre-line; }
.int-saved { background:#f0fdf4; border:1px solid #bbf7d0; border-radius:10px; padding:10px 14px; margin-bottom:14px; font-size:13px; color:#166534; }
.int-webhook { display:flex; gap:8px; }
.int-webhook .field { flex:1; margin-bottom:4px; font-family:ui-monospace,monospace; font-size:13px; background:#f8fafc; }
.field-help { font-size:12px; color:var(--muted); margin:-6px 0 12px; }

/* toast */
#toast-root { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); z-index:60; display:flex; flex-direction:column; gap:8px; }
.toast { background:var(--ink); color:#fff; padding:12px 18px; border-radius:10px; font-size:14px; }
.toast.err { background:var(--bad); }

/* chat widget */
.chat-fab { position:fixed; bottom:22px; right:22px; width:56px; height:56px; border-radius:50%; border:0; background:var(--blue); color:#fff; font-size:24px; cursor:pointer; box-shadow:0 6px 20px rgba(37,99,235,.4); z-index:40; }
.chat-panel { position:fixed; bottom:88px; right:22px; width:min(360px,92vw); height:460px; background:#fff; border:1px solid var(--line); border-radius:16px; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 12px 40px rgba(15,23,42,.2); z-index:40; }
.chat-header { background:var(--blue); color:#fff; padding:14px 16px; font-weight:600; display:flex; justify-content:space-between; align-items:center; }
.chat-header button { background:none; border:0; color:#fff; font-size:22px; cursor:pointer; }
.chat-log { flex:1; overflow:auto; padding:14px; display:flex; flex-direction:column; gap:10px; }
.msg { max-width:80%; padding:10px 13px; border-radius:14px; font-size:14px; line-height:1.4; white-space:pre-wrap; }
.msg.user { align-self:flex-end; background:var(--blue); color:#fff; border-bottom-right-radius:4px; }
.msg.bot { align-self:flex-start; background:#f1f5f9; color:var(--ink); border-bottom-left-radius:4px; }
.chat-input { display:flex; gap:8px; padding:12px; border-top:1px solid var(--line); }
.chat-input input { flex:1; border:1px solid var(--line); border-radius:10px; padding:10px; font-size:14px; }
@media (max-width:640px){ .sidebar{ width:64px; } .sidebar .brand,.sidebar nav a span,.sidebar .btn-ghost{ font-size:0; } .grid2{ grid-template-columns:1fr; } }

/* ============ Marketing landing (dark, professional) ============ */
body.lp { background:#0a0a12; color:#e7e9f3; font-family:-apple-system,system-ui,"Segoe UI",Inter,Roboto,sans-serif; }
.lp a { color:inherit; }
.lp-nav { position:sticky; top:0; z-index:30; display:flex; align-items:center; justify-content:space-between; padding:16px clamp(20px,6vw,80px); background:rgba(10,10,18,.72); backdrop-filter:blur(12px); border-bottom:1px solid rgba(255,255,255,.06); }
.lp-brand { font-weight:800; font-size:20px; letter-spacing:-.02em; background:linear-gradient(90deg,#a78bfa,#22d3ee); -webkit-background-clip:text; background-clip:text; color:transparent; }
.lp-nav-links { display:flex; align-items:center; gap:22px; font-size:14px; font-weight:500; }
.lp-nav-links a { color:#c7cbe0; } .lp-nav-links a:hover{ color:#fff; }
.lp-nav-links a:nth-last-child(-n+3){ } @media(max-width:720px){ .lp-nav-links a:not(.primary){ display:none; } }
.lp-btn { display:inline-block; border-radius:12px; padding:10px 18px; font-size:14px; font-weight:700; cursor:pointer; transition:transform .15s, box-shadow .15s, background .15s; border:0; }
.lp-btn.lg { padding:15px 28px; font-size:16px; }
.lp-btn.primary { color:#fff; background:linear-gradient(135deg,#8b5cf6,#06b6d4); box-shadow:0 8px 30px rgba(139,92,246,.35); }
.lp-btn.primary:hover { transform:translateY(-2px); box-shadow:0 12px 40px rgba(139,92,246,.5); }
.lp-btn.ghost { color:#e7e9f3; background:rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.12); }
.lp-btn.ghost:hover { background:rgba(255,255,255,.12); }
.lp-glow { position:absolute; inset:0; pointer-events:none; background:radial-gradient(600px 300px at 50% -10%, rgba(139,92,246,.35), transparent 70%), radial-gradient(500px 260px at 80% 20%, rgba(6,182,212,.22), transparent 70%); }
.lp-hero { position:relative; text-align:center; padding:clamp(56px,10vh,120px) 6vw 80px; overflow:hidden; }
.lp-badge { position:relative; display:inline-block; padding:7px 16px; border-radius:999px; font-size:12.5px; font-weight:700; letter-spacing:.04em; color:#c4b5fd; background:rgba(139,92,246,.12); border:1px solid rgba(139,92,246,.3); margin-bottom:26px; }
.lp-hero h1 { position:relative; font-size:clamp(38px,6.2vw,72px); line-height:1.03; letter-spacing:-.03em; margin:0 0 20px; font-weight:800; }
.lp-sub { position:relative; max-width:620px; margin:0 auto 30px; font-size:clamp(16px,2vw,20px); line-height:1.6; color:#aab0cc; }
.lp-cta { position:relative; display:flex; gap:14px; justify-content:center; flex-wrap:wrap; margin-bottom:16px; }
.lp-trust { position:relative; color:#8790ab; font-size:14px; }
.lp-stats { position:relative; display:flex; gap:44px; justify-content:center; flex-wrap:wrap; margin-top:52px; }
.lp-stats div { display:flex; flex-direction:column; align-items:center; }
.lp-stats b { font-size:34px; font-weight:800; background:linear-gradient(90deg,#a78bfa,#22d3ee); -webkit-background-clip:text; background-clip:text; color:transparent; }
.lp-stats span { color:#8790ab; font-size:13px; margin-top:4px; }
.lp-section { padding:clamp(56px,9vh,110px) 6vw; max-width:1120px; margin:0 auto; text-align:center; }
.lp-section.alt { background:linear-gradient(180deg,rgba(255,255,255,.02),transparent); border-top:1px solid rgba(255,255,255,.05); border-bottom:1px solid rgba(255,255,255,.05); max-width:none; }
.lp-section.alt > * { max-width:1120px; margin-left:auto; margin-right:auto; }
.lp-eyebrow { display:inline-block; font-size:12.5px; font-weight:700; letter-spacing:.14em; text-transform:uppercase; color:#a78bfa; margin-bottom:14px; }
.lp-section h2, .lp-final h2 { font-size:clamp(26px,3.6vw,44px); line-height:1.1; letter-spacing:-.02em; margin:0 auto 44px; max-width:720px; font-weight:800; }
.lp-steps { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:22px; }
.lp-step { background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.08); border-radius:20px; padding:32px 26px; text-align:left; }
.lp-num { display:inline-flex; width:40px; height:40px; align-items:center; justify-content:center; border-radius:12px; font-weight:800; color:#fff; background:linear-gradient(135deg,#8b5cf6,#06b6d4); margin-bottom:16px; }
.lp-step h3, .lp-card h3 { margin:0 0 8px; font-size:19px; }
.lp-step p, .lp-card p { color:#aab0cc; line-height:1.55; font-size:15px; margin:0; }
.lp-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:18px; text-align:left; }
.lp-card { background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.08); border-radius:18px; padding:26px; transition:border-color .2s, transform .2s; }
.lp-card:hover { border-color:rgba(139,92,246,.4); transform:translateY(-3px); }
.lp-ico { font-size:26px; margin-bottom:12px; }
.lp-logos { display:flex; flex-wrap:wrap; gap:12px; justify-content:center; }
.lp-logo { padding:10px 18px; border-radius:12px; background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.1); font-weight:600; font-size:14px; color:#c7cbe0; }
.lp-pricing { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:22px; max-width:760px; margin:0 auto; text-align:left; }
.lp-plan { position:relative; background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.1); border-radius:22px; padding:32px; }
.lp-plan.featured { border-color:rgba(139,92,246,.55); box-shadow:0 0 50px rgba(139,92,246,.18); }
.lp-ribbon { position:absolute; top:-12px; right:24px; background:linear-gradient(135deg,#8b5cf6,#06b6d4); color:#fff; font-size:11px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; padding:5px 12px; border-radius:999px; }
.lp-plan h3 { margin:0 0 6px; font-size:16px; color:#aab0cc; text-transform:uppercase; letter-spacing:.05em; }
.lp-price { font-size:46px; font-weight:800; letter-spacing:-.02em; margin-bottom:20px; }
.lp-price span { font-size:16px; font-weight:600; color:#8790ab; margin-left:6px; }
.lp-plan ul { list-style:none; padding:0; margin:0 0 24px; }
.lp-plan li { padding:8px 0 8px 26px; position:relative; color:#c7cbe0; font-size:15px; }
.lp-plan li::before { content:"✓"; position:absolute; left:0; color:#22d3ee; font-weight:800; }
.lp-plan .lp-btn { display:block; text-align:center; }
.lp-final { position:relative; text-align:center; padding:clamp(64px,12vh,130px) 6vw; overflow:hidden; }
.lp-final p { color:#aab0cc; font-size:18px; margin:0 0 28px; }
.lp-footer { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; padding:28px 6vw; border-top:1px solid rgba(255,255,255,.06); font-size:14px; }
.lp-footer > span:first-child { font-weight:800; background:linear-gradient(90deg,#a78bfa,#22d3ee); -webkit-background-clip:text; background-clip:text; color:transparent; }
.lp .chat-header, .lp .chat-fab { } /* widget inherits base styles */
