/* =========================================================
   KC Global CRM — Demo
   ========================================================= */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6eaf2;
  --border-2: #d6dce8;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;

  --primary: #2952e3;
  --primary-600: #1f43c4;
  --primary-50: #eef2ff;
  --accent: #0f9d8a;
  --accent-600: #0b8574;
  --accent-50: #e6f7f4;
  --danger: #e11d48;
  --danger-50: #fff1f3;
  --warn: #d97706;
  --warn-50: #fff7e6;
  --ok: #059669;
  --ok-50: #e8f8f1;
  --wa: #25d366;

  --side: #0c1a34;
  --side-2: #142649;
  --side-text: #aebbd6;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .22);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --side-w: 252px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
small { font-size: 12px; }
kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--muted);
}
.ic { flex: none; display: inline-block; vertical-align: middle; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.txt-danger { color: var(--danger); font-weight: 600; }
.txt-warn { color: var(--warn); font-weight: 600; }
.txt-ok { color: var(--ok); font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.r { text-align: right; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w);
  background: linear-gradient(180deg, var(--side) 0%, #0a1630 100%);
  color: var(--side-text);
  display: flex; flex-direction: column;
  padding: 18px 14px; z-index: 40;
  transition: transform .28s ease;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand-text strong { display: block; color: #fff; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.brand-text span { font-size: 11.5px; color: var(--side-text); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #6f80a3; padding: 16px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--side-text); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(79, 123, 255, .28), rgba(79, 123, 255, .08)); color: #fff; box-shadow: inset 3px 0 0 #6d91ff; }
.nav-item .nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: #ef4462; color: #fff;
  font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.nav-item .nav-badge.soft { background: rgba(255, 255, 255, .14); }
.side-help {
  margin-top: 12px; padding: 14px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(79, 123, 255, .22), rgba(20, 184, 166, .16));
  border: 1px solid rgba(255, 255, 255, .08);
}
.side-help-title { color: #fff; font-weight: 700; margin-bottom: 2px; }
.side-help p { font-size: 12.5px; margin-bottom: 10px; }

.main { margin-left: var(--side-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 64px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: rgba(243, 245, 250, .85);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.search { min-width: 0;
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); color: var(--faint);
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(41, 82, 227, .14); }
.search input { flex: 1; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); min-width: 0; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.demo-tag { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: var(--warn); background: var(--warn-50); border: 1px solid #fde3b3; padding: 3px 8px; border-radius: 6px; }
.me { margin-left: 4px; }
.view { padding: 28px 32px 60px; max-width: 1440px; outline: none; }

.scrim { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer;
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(41, 82, 227, .3); }
.btn-primary:hover { background: var(--primary-600); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(15, 157, 138, .3); }
.btn-accent:hover { background: var(--accent-600); }
.btn-outline { background: var(--surface); border-color: var(--border-2); color: var(--text-2); }
.btn-outline:hover { background: var(--surface-2); border-color: #c4ccdb; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(15, 23, 42, .05); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #be123c; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #fecdd6; }
.btn-danger-ghost:hover { background: var(--danger-50); }
.btn-wa { background: var(--wa); color: #fff; }
.btn-wa:hover { background: #1fb95a; }
.btn-light { background: #fff; color: var(--side); }
.btn-light:hover { background: #eef2ff; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer; color: var(--text-2);
  position: relative; transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.wa { color: #16a34a; }
.icon-btn.wa:hover { background: #ecfdf3; border-color: #bbf0cf; }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: #ef4462; border: 2px solid #fff; display: none; }
.bell-dot.on { display: block; animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 98, .5); } 70% { box-shadow: 0 0 0 8px rgba(239, 68, 98, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 98, 0); } }

/* ---------- Popovers ---------- */
.pop-wrap { position: relative; }
.popover {
  position: absolute; right: 0; top: calc(100% + 8px); width: 270px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 8px; display: none; z-index: 50;
}
.popover.open { display: block; animation: pop .16s ease-out; }
.popover-wide { width: 360px; padding: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex; gap: 11px; align-items: flex-start; width: 100%;
  padding: 10px; border-radius: 10px; border: 0; background: none; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item .mi-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex: none; }
.menu-item b { display: block; font-size: 13.5px; }
.menu-item small { color: var(--muted); }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif {
  display: flex; gap: 11px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.notif:hover { background: var(--surface-2); }
.notif.unread { background: #f5f8ff; }
.notif.unread::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; margin-top: 6px; }
.notif .n-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.notif .n-ic.enquiry { background: var(--accent-50); color: var(--accent); }
.notif .n-ic.reminder { background: var(--warn-50); color: var(--warn); }
.notif .n-body { flex: 1; min-width: 0; }
.notif .n-body b { display: block; font-size: 13px; }
.notif .n-body span { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif .n-body small { color: var(--faint); }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 750; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.how-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: 999px; border: 1px solid #d6e0ff; background: var(--primary-50); color: var(--primary);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.how-btn:hover { background: #e2e9ff; }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { flex-wrap: wrap; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head p { color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 18px; }
.grid-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid-2e { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.mt { margin-top: 18px; }

.kpi { padding: 18px 20px; display: flex; gap: 14px; align-items: flex-start; }
.kpi-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.t-blue { background: var(--primary-50); color: var(--primary); }
.t-teal { background: var(--accent-50); color: var(--accent); }
.t-amber { background: var(--warn-50); color: var(--warn); }
.t-green { background: var(--ok-50); color: var(--ok); }
.t-rose { background: var(--danger-50); color: var(--danger); }
.t-violet { background: #f3effe; color: #7c3aed; }

/* ---------- Checklist ---------- */
.checklist { padding: 20px; display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: center; background: linear-gradient(120deg, #ffffff 0%, #f4f7ff 60%, #effaf8 100%); }
.checklist h3 { font-size: 16px; }
.checklist p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.progress { height: 8px; border-radius: 99px; background: #e4e9f5; overflow: hidden; margin-top: 14px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width .4s; }
.check-items { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.check-item {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff; cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.check-item:hover { border-color: #b9c7f5; box-shadow: 0 3px 10px rgba(41, 82, 227, .08); }
.check-item .ck { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-2); display: grid; place-items: center; color: #fff; }
.check-item.done { background: #f3fbf8; border-color: #c9eee2; }
.check-item.done .ck { background: var(--ok); border-color: var(--ok); }
.check-item.done span.t { color: var(--muted); text-decoration: line-through; }
.check-item span.t { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.check-item small { color: var(--primary); font-weight: 600; }

/* ---------- Charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 6px 20px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bar { width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #5b7fff, var(--primary)); min-height: 3px; position: relative; transition: height .4s; }
.bar.zero { background: #e5e9f3; }
.bar.today { background: linear-gradient(180deg, #2dd4bf, var(--accent)); }
.bar .bv { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--text-2); }
.bar-lbl { font-size: 11px; color: var(--faint); line-height: 1.1; text-align: center; }
.bar-lbl b { display: block; color: var(--muted); font-weight: 600; }
.hbars { display: flex; flex-direction: column; gap: 13px; padding: 18px 20px; }
.hbar-row { display: grid; grid-template-columns: 120px 1fr 64px; gap: 12px; align-items: center; font-size: 13px; }
.hbar-row .lbl { display: flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; background: #eef1f7; border-radius: 99px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; }
.hbar-row .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.li {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.li:last-child { border-bottom: 0; }
.li:hover { background: var(--surface-2); }
.li .li-main { flex: 1; min-width: 0; }
.li .li-main b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .li-main span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .li-side { text-align: right; font-size: 12px; color: var(--muted); flex: none; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .empty-ic { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ---------- Avatars / pills ---------- */
.av {
  width: 36px; height: 36px; border-radius: 10px; color: #fff; font-weight: 700; font-size: 13px;
  display: inline-grid; place-items: center; flex: none; letter-spacing: .02em;
}
.av-sm { width: 32px; height: 32px; font-size: 12px; border-radius: 9px; }
.av-lg { width: 52px; height: 52px; font-size: 18px; border-radius: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 13%, white); color: color-mix(in srgb, var(--c) 78%, black);
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.prio { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: .04em; }
.prio-hot { background: #ffe4e8; color: #be123c; }
.prio-warm { background: #fff1d6; color: #b45309; }
.prio-cold { background: #e0ecff; color: #1d4ed8; }
.cc {
  display: inline-grid; place-items: center; min-width: 26px; height: 18px; padding: 0 4px; border-radius: 4px;
  font-size: 10px; font-weight: 800; letter-spacing: .04em; background: #eef1f7; color: var(--text-2); margin-right: 6px; vertical-align: 1px;
}
.src { font-size: 12px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }

/* ---------- Toolbar / chips ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.chip:hover { border-color: var(--border-2); }
.chip i { width: 7px; height: 7px; border-radius: 50%; }
.chip b { font-weight: 700; color: var(--faint); font-size: 11.5px; }
.chip.on { background: var(--text); border-color: var(--text); color: #fff; }
.chip.on b { color: #a3b1cc; }
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.select, .input, .textarea {
  height: 38px; border: 1px solid var(--border-2); border-radius: 10px; background: var(--surface); padding: 0 12px; outline: none;
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.select { width: auto; padding-right: 30px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.select.full { width: 100%; }
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select:focus, .input:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(41, 82, 227, .14); }
.search-note { padding: 10px 16px; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 900px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: #f7f9ff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who b { display: block; font-weight: 600; }
.who small { display: block; color: var(--muted); }
.new-tag { font-size: 10px; font-weight: 800; color: var(--primary); background: var(--primary-50); padding: 1px 6px; border-radius: 5px; margin-left: 6px; vertical-align: 1px; letter-spacing: .04em; }

/* ---------- Kanban ---------- */
.tip-bar { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px; background: var(--primary-50); color: #2a3f8f; border: 1px solid #dbe3ff; margin-bottom: 16px; font-size: 13px; }
.kanban { display: grid; grid-template-columns: repeat(6, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.kcol { background: #eceff6; border-radius: 14px; display: flex; flex-direction: column; min-height: 420px; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 700; font-size: 13px; }
.kcol-head .count { background: #fff; border-radius: 99px; padding: 0 8px; font-size: 11.5px; color: var(--muted); }
.kcol-head .kval { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.kcol-body { flex: 1; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 10px; border-radius: 12px; transition: background .15s, box-shadow .15s; }
.kcol-body.over { background: rgba(41, 82, 227, .08); box-shadow: inset 0 0 0 2px rgba(41, 82, 227, .35); }
.kcard {
  background: #fff; border-radius: 12px; padding: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  cursor: grab; transition: box-shadow .15s, transform .15s;
}
.kcard:hover { box-shadow: 0 6px 16px rgba(15, 23, 42, .08); }
.kcard.dragging { opacity: .5; transform: rotate(2deg); }
.kcard-top { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.kcard-top b { display: block; font-size: 13px; line-height: 1.25; }
.kcard-top small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.kcard-prod { font-size: 12.5px; color: var(--text-2); margin-bottom: 9px; }
.kcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }
.kcard-foot .v { font-weight: 700; color: var(--text); }
.knext { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.knext:hover { background: var(--primary-50); color: var(--primary); border-color: #cdd8ff; }
.kempty { border: 2px dashed #d3d9e6; border-radius: 12px; padding: 22px 10px; text-align: center; color: var(--faint); font-size: 12.5px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 6px; background: #e9edf5; border-radius: 12px; width: fit-content; flex-wrap: wrap; }
.tab { height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: none; cursor: pointer; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.tab.on { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.tab .tc { font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; background: rgba(15, 23, 42, .07); }
.tab .tc.red { background: #ffe4e8; color: #be123c; }

.fu { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.fu:last-child { border-bottom: 0; }
.fu-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.fu-main { flex: 1; min-width: 0; cursor: pointer; }
.fu-main b { display: block; }
.fu-main span { display: block; color: var(--muted); font-size: 13px; }
.fu-when { text-align: right; flex: none; font-size: 12.5px; min-width: 110px; }
.fu-when small { display: block; color: var(--faint); }
.fu-act { display: flex; gap: 6px; flex: none; }
.fu.done .fu-main b { text-decoration: line-through; color: var(--muted); }

/* ---------- Customers ---------- */
.cust { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.cust-top { display: flex; gap: 12px; align-items: center; }
.cust-top b { display: block; font-size: 14.5px; }
.cust-top small { color: var(--muted); }
.cust-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cust-stats div { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; }
.cust-stats small { color: var(--muted); display: block; }
.cust-stats b { font-size: 14px; }
.cust-act { display: flex; gap: 8px; }
.cust-act .btn { flex: 1; }

/* ---------- Web form page ---------- */
.browser { border-radius: 14px; overflow: hidden; border: 1px solid var(--border-2); box-shadow: var(--shadow); background: #fff; }
.browser-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #eef1f6; border-bottom: 1px solid var(--border); }
.browser-dots { display: flex; gap: 6px; }
.browser-dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.browser-dots i:nth-child(2) { background: #febc2e; }
.browser-dots i:nth-child(3) { background: #28c840; }
.browser-url { flex: 1; background: #fff; border-radius: 8px; padding: 5px 12px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.site-hero { padding: 26px 28px; background: linear-gradient(135deg, #0c1a34, #1f3a78 60%, #0f766e); color: #fff; }
.site-hero h2 { font-size: 22px; }
.site-hero p { color: #c9d4ee; margin-top: 6px; font-size: 13.5px; }
.site-form { padding: 24px 28px 28px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.success-box { display: none; margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--ok-50); border: 1px solid #bfead9; color: #065f46; }
.success-box.show { display: flex; gap: 10px; align-items: flex-start; animation: pop .25s; }
.steps { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.step { display: flex; gap: 14px; }
.step-n { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: grid; place-items: center; flex: none; font-size: 13px; }
.step b { display: block; }
.step span { color: var(--muted); font-size: 13px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; background: #0c1a34; color: #c9d7f5; border-radius: 10px; padding: 14px; overflow-x: auto; white-space: pre; line-height: 1.6; margin: 0; }
.code .k { color: #7dd3fc; } .code .s { color: #86efac; } .code .c { color: #64748b; }
.wa-preview { margin: 0 20px 20px; padding: 16px; border-radius: 12px; background: #e9e1d6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='1.2' fill='%23d6cbbb'/%3E%3C/svg%3E"); }

/* ---------- Settings ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-row b { display: block; font-size: 13.5px; }
.set-row span { color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: #cfd6e4; cursor: pointer; transition: background .2s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(15, 157, 138, .25); }
.ch-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.set-left { display: flex; gap: 12px; align-items: center; }

/* ---------- Help ---------- */
.help-hero {
  border-radius: 18px; padding: 34px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(1200px 300px at 100% 0%, rgba(20, 184, 166, .45), transparent 60%), linear-gradient(135deg, #0c1a34, #1d3a7a);
  display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap;
}
.help-hero h2 { font-size: 26px; font-weight: 750; }
.help-hero p { color: #c9d4ee; margin-top: 8px; max-width: 560px; font-size: 14.5px; }
.help-hero .btns { display: flex; gap: 10px; flex-wrap: wrap; }
.flow { display: flex; align-items: stretch; gap: 8px; padding: 22px 20px; overflow-x: auto; }
.flow-step { flex: 1; min-width: 150px; text-align: center; padding: 16px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.flow-step .fi { width: 44px; height: 44px; border-radius: 13px; margin: 0 auto 10px; display: grid; place-items: center; }
.flow-step b { display: block; font-size: 13.5px; }
.flow-step span { font-size: 12px; color: var(--muted); }
.flow-arrow { display: grid; place-items: center; color: var(--faint); flex: none; }
.guide-card { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.guide-card .gh { display: flex; align-items: center; gap: 12px; }
.guide-card .gn { font-size: 11px; font-weight: 800; color: var(--primary); letter-spacing: .08em; }
.guide-card h4 { font-size: 15px; }
.guide-card p { color: var(--muted); font-size: 13px; flex: 1; }
.guide-card ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; }
.guide-card li { margin: 3px 0; }
.gloss { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.gloss div { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.gloss div:nth-child(odd) { border-right: 1px solid var(--border); }
.gloss b { display: block; font-size: 13.5px; }
.gloss span { color: var(--muted); font-size: 13px; }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:last-child { border-bottom: 0; }
.faq summary { padding: 15px 20px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 18px; color: var(--muted); line-height: 1; }
.faq details[open] summary::after { content: '–'; }
.faq details p { padding: 0 20px 16px; color: var(--muted); }
.keys { display: grid; gap: 10px; padding: 18px 20px; }
.keys div { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }

/* ---------- Drawer ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(12, 26, 52, .35); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 60; }
.drawer-back.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg); z-index: 61;
  transform: translateX(102%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.drawer.show { transform: none; }
.d-head { background: #fff; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.d-top { display: flex; gap: 14px; align-items: flex-start; }
.d-top h2 { font-size: 19px; }
.d-top .sub { color: var(--muted); font-size: 13px; }
.d-top .x { margin-left: auto; }
.d-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.d-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 16px; }
.d-sec { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.d-sec h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.stages { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-btn { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.stage-btn:hover { border-color: var(--c); }
.stage-btn.on { background: var(--c); border-color: var(--c); color: #fff; }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.dl div small { display: block; color: var(--muted); font-size: 11.5px; }
.dl div span { font-weight: 600; word-break: break-word; }
.quote { background: var(--surface-2); border-left: 3px solid var(--primary); border-radius: 0 10px 10px 0; padding: 12px 14px; color: var(--text-2); font-style: italic; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl { position: relative; padding-bottom: 14px; }
.tl:last-child { padding-bottom: 0; }
.tl::before { content: ''; position: absolute; left: -20px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--tc, var(--primary)); }
.tl b { font-size: 13px; font-weight: 600; display: block; }
.tl small { color: var(--faint); }
.mini-fu { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--warn-50); border: 1px solid #fde3b3; margin-bottom: 8px; }
.mini-fu .mf { flex: 1; min-width: 0; font-size: 13px; }
.mini-fu .mf small { display: block; color: var(--muted); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(12, 26, 52, .45); z-index: 80; display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.modal-back.show { opacity: 1; }
.modal { background: #fff; border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.98); transition: transform .22s; }
.modal-back.show .modal { transform: none; }
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.welcome-hero { padding: 30px 30px 24px; text-align: center; background: radial-gradient(600px 200px at 50% 0%, #e6edff, transparent 70%); border-radius: 18px 18px 0 0; }
.welcome-hero h2 { font-size: 24px; margin-top: 14px; }
.welcome-hero p { color: var(--muted); margin-top: 6px; }
.welcome-points { padding: 4px 30px 8px; display: flex; flex-direction: column; gap: 12px; }
.wp { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); }
.wp .wi { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.wp b { display: block; }
.wp span { color: var(--muted); font-size: 13px; }
.welcome-note { margin: 10px 30px 0; font-size: 12.5px; color: #8a5a00; background: var(--warn-50); border: 1px solid #fde3b3; padding: 10px 12px; border-radius: 10px; }
.welcome-btns { display: flex; flex-direction: column; gap: 8px; padding: 20px 30px 28px; }

/* ---------- Phone alert ---------- */
.phone {
  position: fixed; right: 24px; bottom: 24px; width: 310px; z-index: 70;
  transform: translateY(calc(100% + 40px)); transition: transform .45s cubic-bezier(.2, .9, .25, 1.1);
  pointer-events: none;
}
.phone.show { transform: none; pointer-events: auto; }
.phone.instant { transition: none; }
.phone-frame { background: #111; border-radius: 34px; padding: 9px; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); }
.phone-screen { background: #efe7dc; border-radius: 26px; overflow: hidden; }
.phone-status { display: flex; justify-content: space-between; align-items: center; padding: 8px 18px 4px; font-size: 11.5px; font-weight: 700; background: #075e54; color: #fff; }
.phone-status .notch { width: 70px; height: 16px; border-radius: 10px; background: #111; }
.wa-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px 10px; background: #075e54; color: #fff; }
.wa-av { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #4f7bff, #14b8a6); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.wa-head b { display: block; font-size: 13.5px; }
.wa-head small { color: #b9e6dd; font-size: 11px; }
.phone-x { margin-left: auto; background: rgba(255, 255, 255, .15); border: 0; color: #fff; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.wa-body { padding: 12px 10px; min-height: 120px; }
.wa-date { text-align: center; font-size: 10.5px; color: #54656f; margin-bottom: 8px; }
.wa-date span { background: #fff; padding: 3px 10px; border-radius: 7px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); }
.wa-msg { background: #fff; border-radius: 0 10px 10px 10px; padding: 9px 11px 6px; font-size: 12.8px; line-height: 1.5; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); color: #111b21; position: relative; animation: pop .35s .25s both; }
.wa-msg .wt { display: block; text-align: right; font-size: 10.5px; color: #667781; margin-top: 2px; }
.wa-msg .wt i { color: #53bdeb; font-style: normal; }
.wa-msg q { display: block; margin-top: 4px; color: #3b4a54; font-style: italic; quotes: none; }
.wa-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.wa-btns button, .wa-btns a { background: #fff; border: 0; border-radius: 8px; padding: 8px 6px; font-size: 12px; font-weight: 600; color: #027eb5; cursor: pointer; text-align: center; box-shadow: 0 1px 1px rgba(0, 0, 0, .1); }
.phone-foot { font-size: 10.5px; color: #54656f; text-align: center; padding: 0 10px 12px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #0f172a; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 10px; animation: toastIn .3s ease-out; max-width: min(520px, calc(100vw - 32px)); }
.toast.warn { background: #7c2d12; }
.toast.hide { opacity: 0; transform: translateY(8px); transition: all .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Tour ---------- */
.tour { position: fixed; inset: 0; z-index: 100; display: none; }
.tour.show { display: block; }
.tour-spot {
  position: fixed; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10, 20, 44, .62), 0 0 0 3px rgba(109, 145, 255, .9);
  transition: all .35s cubic-bezier(.2, .8, .2, 1);
}
.tour-spot.center { box-shadow: 0 0 0 9999px rgba(10, 20, 44, .62); }
.tour-card {
  position: fixed; width: min(360px, calc(100vw - 32px)); background: #fff; border-radius: 16px; padding: 18px 20px 16px;
  box-shadow: var(--shadow-lg); transition: top .35s cubic-bezier(.2, .8, .2, 1), left .35s cubic-bezier(.2, .8, .2, 1);
}
.tour-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tour-step { font-size: 11.5px; font-weight: 700; color: var(--primary); letter-spacing: .04em; text-transform: uppercase; }
.tour-skip { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12.5px; font-weight: 600; padding: 4px; }
.tour-skip:hover { color: var(--text); }
.tour-progress { height: 4px; border-radius: 99px; background: #e8ecf5; overflow: hidden; margin-bottom: 14px; }
.tour-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .35s; }
.tour-card h3 { font-size: 16.5px; margin-bottom: 6px; }
.tour-card p { color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.tour-btns { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 10px; }
.tour-hint { font-size: 11.5px; color: var(--faint); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .check-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .checklist { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(12, 26, 52, .4); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; gap: 10px; }
  .view { padding: 20px 16px 60px; }
  .search kbd { display: none; }
  .demo-tag { display: none; }
  .grid-2e { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .hide-sm { display: none; }
  #btn-simulate { width: 40px; padding: 0; }
  .me { display: none; }
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; flex-direction: column; gap: 10px; }
  .kpi-value { font-size: 22px; }
  .check-items { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .page-head h1 { font-size: 21px; }
  .dl { grid-template-columns: 1fr; }
  .gloss { grid-template-columns: 1fr; }
  .gloss div:nth-child(odd) { border-right: 0; }
  .fu { flex-wrap: wrap; }
  .fu-when { text-align: left; min-width: 0; }
  .phone { right: 50%; transform: translate(50%, calc(100% + 40px)); width: 290px; bottom: 12px; }
  .phone.show { transform: translate(50%, 0); }
  .popover-wide { width: calc(100vw - 32px); right: -60px; }
  .help-hero { padding: 24px; }
  .hbar-row { grid-template-columns: 90px 1fr 56px; }
  .site-form, .site-hero { padding-left: 18px; padding-right: 18px; }
  .row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
