/* The CRM — dashboard, pipeline board and lead list. Visual first: icons, colour, numbers; words only behind an ⓘ. */

.crm { --st-new: #f59e0b; --st-contacted: #3b82f6; --st-qualified: #8b5cf6; --st-proposal: #ec4899; --st-won: #16a34a; --st-lost: #9ca3af;
  --crm-ink: #1e2130; --crm-muted: #80839a; --crm-line: #ecedf5; --crm-soft: #f4f5fb; max-width: 1400px; margin: 0 auto; padding: 0.35rem 0 1.75rem; color: var(--crm-ink); }

/* Icons */
.ci { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.125em; }
.crm .ci { width: 1.05rem; height: 1.05rem; }
.ci-lg { width: 1.35rem !important; height: 1.35rem !important; }

/* Header: title, tabs, actions */
.crm-head { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.crm-title { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-heading); font-weight: 800; font-size: 1.15rem; margin: 0; }
.crm-title .ci { width: 1.4rem; height: 1.4rem; color: var(--pv-indigo); }
.crm-tabs { display: inline-flex; gap: 0.2rem; background: var(--crm-soft); border-radius: 12px; padding: 0.22rem; }
.crm-tabs a { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.42rem 0.85rem; border-radius: 9px; font-size: 0.72rem; font-weight: 700; color: var(--crm-muted); text-decoration: none; }
.crm-tabs a:hover { color: var(--pv-indigo); }
.crm-tabs a.active { background: #fff; color: var(--pv-indigo); box-shadow: 0 1px 4px rgba(30, 33, 48, 0.1); }
.crm-actions { margin-left: auto; display: inline-flex; gap: 0.45rem; align-items: center; }

/* Buttons */
.crm-btn { display: inline-flex; align-items: center; gap: 0.4rem; font: inherit; font-size: 0.72rem; font-weight: 700; line-height: 1; padding: 0.6rem 0.95rem; border-radius: 10px;
  border: 1px solid var(--crm-line); background: #fff; color: var(--crm-ink); cursor: pointer; text-decoration: none; transition: border-color .12s, color .12s, background .12s, box-shadow .12s; }
.crm-btn:hover { border-color: var(--pv-indigo); color: var(--pv-indigo); }
.crm-btn.primary { background: var(--pv-indigo); border-color: var(--pv-indigo); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.28); }
.crm-btn.primary:hover { background: var(--pv-indigo-dark); color: #fff; }
.crm-btn.icon { padding: 0.6rem; }
.crm-btn.danger:hover { border-color: #ef4444; color: #dc2626; }
.crm-icobtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--crm-line); background: #fff; color: var(--crm-muted); cursor: pointer; text-decoration: none; padding: 0; }
.crm-icobtn:hover { color: #fff; background: var(--pv-indigo); border-color: var(--pv-indigo); }
.crm-icobtn.wa:hover { background: #16a34a; border-color: #16a34a; }
.crm-icobtn .ci { width: 0.9rem; height: 0.9rem; }

/* KPI cards */
.crm-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.crm-kpi { position: relative; display: flex; align-items: center; gap: 0.8rem; background: #fff; border: 1px solid var(--crm-line); border-radius: 16px; padding: 0.95rem 1rem; text-decoration: none; color: inherit; min-width: 0; transition: box-shadow .15s, transform .15s; }
a.crm-kpi:hover { box-shadow: 0 8px 22px rgba(79, 70, 229, 0.12); transform: translateY(-1px); }
.crm-kpi-ico { width: 44px; height: 44px; flex: none; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.crm-kpi-ico .ci { width: 1.3rem; height: 1.3rem; }
.crm-kpi strong { display: block; font-family: var(--font-heading); font-size: 1.55rem; line-height: 1.05; }
.crm-kpi small { display: block; margin-top: 0.15rem; font-size: 0.64rem; color: var(--crm-muted); font-weight: 600; }
.crm-kpi .sub { font-size: 0.6rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 99px; background: var(--crm-soft); color: var(--crm-muted); }
.crm-kpi.alert { border-color: #fecaca; background: linear-gradient(180deg, #fff, #fff5f5); }
.crm-ring { margin-left: auto; width: 46px; height: 46px; flex: none; position: relative; }
.crm-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.crm-ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.62rem; }

/* Cards */
.crm-card { background: #fff; border: 1px solid var(--crm-line); border-radius: 16px; padding: 0.95rem 1.05rem; min-width: 0; }
.crm-card-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.7rem; }
.crm-card-head h2 { margin: 0; font-family: var(--font-heading); font-size: 0.85rem; font-weight: 800; display: flex; align-items: center; gap: 0.45rem; }
.crm-card-head h2 .ci { color: var(--pv-indigo); }
.crm-card-head .more { margin-left: auto; font-size: 0.66rem; font-weight: 700; color: var(--pv-indigo); text-decoration: none; }
.crm-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 0.9rem; align-items: start; }
.crm-grid.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.crm-stack { display: grid; gap: 0.9rem; min-width: 0; }

/* Pipeline funnel */
.crm-funnel { display: grid; gap: 0.38rem; }
.crm-funnel a { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 0.6rem; text-decoration: none; color: inherit; }
.crm-funnel .dot { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.crm-funnel .dot .ci { width: 0.85rem; height: 0.85rem; }
.crm-funnel .bar { height: 26px; border-radius: 8px; background: var(--crm-soft); overflow: hidden; position: relative; }
.crm-funnel .bar i { display: block; height: 100%; border-radius: 8px; min-width: 0; transition: width .4s ease; }
.crm-funnel .bar span { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); font-size: 0.66rem; font-weight: 700; color: var(--crm-ink); }
.crm-funnel b { font-family: var(--font-heading); font-size: 0.95rem; min-width: 1.6rem; text-align: right; }
.crm-funnel a:hover .bar { box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25); }

/* Weekly bars, sources */
.crm-weeks { display: flex; align-items: flex-end; gap: 0.45rem; height: 118px; }
.crm-weeks div { flex: 1; text-align: center; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.crm-weeks i { display: block; background: linear-gradient(180deg, #818cf8, #4f46e5); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.crm-weeks small { font-size: 0.58rem; color: var(--crm-muted); margin-top: 0.25rem; }
.crm-weeks em { font-style: normal; font-size: 0.62rem; font-weight: 700; color: var(--crm-ink); }
.crm-src { display: grid; gap: 0.5rem; }
.crm-src a, .crm-src div { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 0.6rem; }
.crm-src .ico { width: 30px; height: 30px; border-radius: 9px; background: var(--crm-soft); display: inline-flex; align-items: center; justify-content: center; color: var(--pv-indigo); }
.crm-src .bar { height: 8px; border-radius: 99px; background: var(--crm-soft); overflow: hidden; }
.crm-src .bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #38bdf8, #6366f1); }

/* Quick tiles */
.crm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.crm-tile { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; background: #fff; border: 1px solid var(--crm-line); border-radius: 14px; padding: 0.85rem 0.5rem; font: inherit; font-size: 0.7rem; font-weight: 700; color: var(--crm-ink); text-decoration: none; cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s; }
.crm-tile:hover { box-shadow: 0 8px 20px rgba(79, 70, 229, 0.13); transform: translateY(-1px); border-color: #c7caf5; }
.crm-tile .ico { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.crm-tile .ico .ci { width: 1.2rem; height: 1.2rem; }

/* Rows: today's work, activity */
.crm-rows { display: grid; }
.crm-row { display: flex; align-items: center; gap: 0.65rem; padding: 0.55rem 0; border-top: 1px solid var(--crm-line); text-decoration: none; color: inherit; font-size: 0.72rem; }
.crm-row:first-child { border-top: 0; }
.crm-row .main { flex: 1; min-width: 0; }
.crm-row .main b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-row .main span { display: block; color: var(--crm-muted); font-size: 0.62rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-row .ico { width: 30px; height: 30px; flex: none; border-radius: 9px; background: var(--crm-soft); color: var(--pv-indigo); display: inline-flex; align-items: center; justify-content: center; }
.crm-row .ico.red { background: #fee2e2; color: #dc2626; }
.crm-row .ico.amber { background: #fef3c7; color: #b45309; }
.crm-empty { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; padding: 1.1rem 0.5rem; color: var(--crm-muted); font-size: 0.7rem; text-align: center; }
.crm-empty .ci { width: 1.9rem; height: 1.9rem; color: #c7caf5; }

/* Chips */
.crm-chip { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.62rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 99px; background: var(--crm-soft); color: var(--crm-muted); white-space: nowrap; }
.crm-chip .ci { width: 0.75rem; height: 0.75rem; }
.crm-chip.red { background: #fee2e2; color: #dc2626; }
.crm-chip.amber { background: #fef3c7; color: #b45309; }
.crm-chip.green { background: #dcfce7; color: #15803d; }
.crm-chip.blue { background: #dbeafe; color: #1d4ed8; }
.crm-stage { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.64rem; font-weight: 700; padding: 0.2rem 0.6rem; border-radius: 99px; color: #fff; white-space: nowrap; }

/* Toolbar */
.crm-bar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.crm-search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.crm-search .ci { position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%); color: var(--crm-muted); }
.crm-search input { width: 100%; padding: 0.58rem 0.8rem 0.58rem 2.1rem; border: 1px solid var(--crm-line); border-radius: 10px; font: inherit; font-size: 0.72rem; background: #fff; }
.crm-search input:focus { outline: 2px solid rgba(79, 70, 229, 0.25); border-color: var(--pv-indigo); }
.crm-chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.crm-pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.42rem 0.75rem; border-radius: 99px; border: 1px solid var(--crm-line); background: #fff; font-size: 0.68rem; font-weight: 700; color: var(--crm-ink); text-decoration: none; }
.crm-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, #9ca3af); }
.crm-pill b { color: var(--crm-muted); font-weight: 700; }
.crm-pill:hover { border-color: var(--pv-indigo); }
.crm-pill.on { background: var(--pv-indigo); border-color: var(--pv-indigo); color: #fff; }
.crm-pill.on b { color: #c7d2fe; }
.crm-seg { display: inline-flex; background: var(--crm-soft); border-radius: 10px; padding: 0.18rem; margin-left: auto; }
.crm-seg button { border: 0; background: transparent; width: 32px; height: 28px; border-radius: 8px; color: var(--crm-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.crm-seg button.on { background: #fff; color: var(--pv-indigo); box-shadow: 0 1px 4px rgba(30, 33, 48, 0.12); }

/* Pipeline board */
.crm-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 0.7rem; overflow-x: auto; padding-bottom: 0.6rem; align-items: start; }
.crm-col { background: var(--crm-soft); border-radius: 14px; padding: 0.55rem; min-height: 120px; border-top: 3px solid var(--c); transition: background .12s; }
.crm-col.over { background: #e6e8fb; outline: 2px dashed var(--pv-indigo); }
.crm-col-head { display: flex; align-items: center; gap: 0.45rem; padding: 0.2rem 0.3rem 0.55rem; font-size: 0.72rem; font-weight: 800; }
.crm-col-head i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.crm-col-head em { font-style: normal; font-weight: 700; font-size: 0.62rem; color: var(--crm-muted); margin-left: auto; }
.crm-col-head .n { background: #fff; border-radius: 99px; padding: 0.05rem 0.5rem; font-size: 0.64rem; }
.crm-cards { display: grid; gap: 0.5rem; }
.crm-card-lead { position: relative; background: #fff; border: 1px solid var(--crm-line); border-radius: 12px; padding: 0.65rem 0.7rem; cursor: grab; text-decoration: none; color: inherit; display: block; transition: box-shadow .15s, transform .15s; }
.crm-card-lead:hover { box-shadow: 0 6px 16px rgba(30, 33, 48, 0.1); transform: translateY(-1px); }
.crm-card-lead.dragging { opacity: 0.45; }
.crm-card-lead .top { display: flex; align-items: center; gap: 0.5rem; }
.crm-card-lead .top b { font-size: 0.74rem; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-card-lead p { margin: 0.4rem 0 0; font-size: 0.66rem; color: var(--crm-muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.crm-card-lead .foot { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.55rem; flex-wrap: wrap; }
.crm-card-lead .quick { display: none; gap: 0.25rem; margin-left: auto; }
.crm-card-lead:hover .quick { display: inline-flex; }
.crm-avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; color: #fff; font-size: 0.64rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; background: var(--a, #6366f1); }
.crm-avatar.sm { width: 20px; height: 20px; font-size: 0.5rem; }
.crm-src-ico { width: 20px; height: 20px; border-radius: 6px; background: var(--crm-soft); display: inline-flex; align-items: center; justify-content: center; color: var(--crm-muted); }
.crm-src-ico img { width: 12px; height: 12px; }
.crm-src-ico .ci { width: 0.72rem; height: 0.72rem; }

/* List */
.crm-listcard { background: #fff; border: 1px solid var(--crm-line); border-radius: 16px; overflow: hidden; }
.crm-table { width: 100%; border-collapse: collapse; font-size: 0.7rem; }
.crm-table th { text-align: left; padding: 0.6rem 0.9rem; background: #f8f9fd; color: var(--crm-muted); font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.crm-table td { padding: 0.62rem 0.9rem; border-top: 1px solid var(--crm-line); vertical-align: middle; }
.crm-table tr:hover td { background: #fbfbff; }
.crm-table .who { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: inherit; }
.crm-table .who b { font-weight: 800; }
.crm-table .msg { max-width: 300px; color: var(--crm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-table .acts { display: inline-flex; gap: 0.25rem; }

/* Empty state */
.crm-hero { text-align: center; padding: 2.2rem 1rem; display: grid; gap: 1rem; justify-items: center; }
.crm-hero h3 { margin: 0; font-family: var(--font-heading); font-size: 1.05rem; }
.crm-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 190px)); gap: 0.7rem; justify-content: center; width: 100%; }
.crm-source { background: var(--crm-soft); border-radius: 14px; padding: 0.9rem 0.6rem; display: flex; flex-direction: column; align-items: center; gap: 0.45rem; font-size: 0.7rem; font-weight: 700; position: relative; }
.crm-source .ico { width: 42px; height: 42px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.crm-source .info-tip { position: absolute; top: 0.45rem; right: 0.45rem; }

/* Modals */
.crm-modal { border: 0; border-radius: 18px; padding: 0; width: min(520px, 94vw); box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35); color: var(--crm-ink); }
.crm-modal::backdrop { background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); }
.crm-modal form, .crm-modal .body { padding: 1.1rem 1.2rem 1.2rem; display: grid; gap: 0.7rem; }
.crm-modal header { display: flex; align-items: center; gap: 0.6rem; padding: 1rem 1.2rem 0; }
.crm-modal header h3 { margin: 0; font-family: var(--font-heading); font-size: 1rem; flex: 1; }
.crm-modal .x { border: 0; background: var(--crm-soft); width: 30px; height: 30px; border-radius: 9px; cursor: pointer; color: var(--crm-muted); }
.crm-modal label { display: grid; gap: 0.25rem; font-size: 0.66rem; font-weight: 700; color: var(--crm-muted); }
.crm-modal input[type=text], .crm-modal input[type=email], .crm-modal input[type=tel], .crm-modal textarea { font: inherit; font-size: 0.74rem; padding: 0.6rem 0.75rem; border: 1px solid var(--crm-line); border-radius: 10px; color: var(--crm-ink); }
.crm-modal .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.crm-linkbox { display: flex; gap: 0.4rem; align-items: center; background: var(--crm-soft); border-radius: 10px; padding: 0.4rem 0.4rem 0.4rem 0.8rem; font-size: 0.7rem; }
.crm-linkbox span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.crm-switch { display: flex; align-items: center; gap: 0.6rem; font-size: 0.72rem; font-weight: 700; }
.crm-toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 0.55rem 1rem; border-radius: 10px; font-size: 0.72rem; font-weight: 700; z-index: 200; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.3); }
.crm-note { padding: 0.6rem 0.85rem; border-radius: 12px; font-size: 0.72rem; font-weight: 600; margin-bottom: 0.8rem; display: flex; align-items: center; gap: 0.5rem; }
.crm-note.ok { background: #dcfce7; color: #15803d; }
.crm-note.bad { background: #fee2e2; color: #b91c1c; }

@media (max-width: 1100px) { .crm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .crm-grid, .crm-grid.thirds { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .crm-kpis { grid-template-columns: 1fr; } .crm-actions { margin-left: 0; width: 100%; } .crm-seg { margin-left: 0; } .crm-modal .two { grid-template-columns: 1fr; } }

/* The tab bar on its own (pages without the full header) */
.leads-page > .crm-tabs, .app-main > .crm-tabs { margin: 0.4rem 0 1rem; }

/* ---- The shared CRM header: one line everywhere; on a phone the section links fold into a menu button ---- */
.crm.crm-hdr { max-width: none; padding: 0; margin: 0 0 0.6rem; }
.crm-hdr .crm-head { flex-wrap: nowrap; gap: 0.6rem; margin-bottom: 0.6rem; }
.crm-hdr .crm-title { flex: none; }
.crm-hdr .crm-tabs { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.crm-hdr .crm-tabs::-webkit-scrollbar { display: none; }
.crm-hdr .crm-tabs a { white-space: nowrap; }
.crm-hdr .crm-actions { margin-left: auto; flex: none; flex-wrap: nowrap; }
.crm-menu { display: none; position: relative; }
.crm-menu summary { list-style: none; }
.crm-menu summary::-webkit-details-marker { display: none; }
.crm-menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 210px; background: #fff; border: 1px solid var(--crm-line); border-radius: 12px; box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18); padding: 0.35rem; display: grid; }
.crm-menu-list a { display: flex; align-items: center; gap: 0.6rem; padding: 0.62rem 0.8rem; border-radius: 8px; font-size: 0.78rem; font-weight: 700; color: var(--crm-ink); text-decoration: none; }
.crm-menu-list a:hover, .crm-menu-list a.active { background: var(--crm-soft); color: var(--pv-indigo); }
@media (max-width: 1000px) { .crm-hdr .crm-tabs { display: none; } .crm-menu { display: block; } .crm-hdr .crm-gear { display: none; } }
@media (max-width: 520px) { .crm-hdr .crm-btn.primary .lbl { display: none; } .crm-hdr .crm-btn.primary { padding: 0.6rem; } .crm-hdr .crm-actions { gap: 0.3rem; } }
.cx-bar > .crm-hdr { width: 100%; }

/* The enquiry forms list in the share dialog */
.crm-formlist { display: grid; gap: 0.45rem; }
.crm-formrow { display: flex; align-items: center; gap: 0.4rem; background: var(--crm-soft); border-radius: 10px; padding: 0.45rem 0.5rem 0.45rem 0.75rem; }
.crm-formrow.off { opacity: 0.65; }
.crm-formrow .main { flex: 1; min-width: 0; display: grid; gap: 0.1rem; }
.crm-formrow .main b { font-size: 0.74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-formrow .main span { font-size: 0.62rem; color: var(--crm-muted); }

/* ---- CRM pages on a phone ---- */
@media (max-width: 720px) {
  .crm-search { max-width: none; min-width: 0; flex-basis: 100%; }
  .crm-seg { margin-left: 0; }
  .crm-board { grid-auto-columns: minmax(78vw, 1fr); }
  .crm-listcard { overflow: visible !important; }
  .crm-table, .crm-table tbody, .crm-table tr, .crm-table td { display: block; width: 100%; }
  .crm-table thead { display: none; }
  .crm-table tr { padding: 0.65rem 0.85rem; border-top: 1px solid var(--crm-line); }
  .crm-table tr:first-child { border-top: 0; }
  .crm-table td { border: 0; padding: 0.22rem 0; display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; }
  .crm-table td::before { content: attr(data-label); flex: none; min-width: 64px; font-size: 0.58rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--crm-muted); }
  .crm-table td[data-label=""]::before { display: none; }
  .crm-table td[data-label=""] { justify-content: flex-start; padding-bottom: 0.35rem; }
  .crm-table .msg { max-width: none; white-space: normal; text-align: right; }
  .crm-table tr:hover td { background: transparent; }
  .crm-modal { width: 96vw; }
  .ld-steps { min-width: 0; overflow-x: auto; }
  .ld-stages { padding: 10px 12px; }
  .ld-head { gap: 10px; }
  .ld-who { min-width: 0; flex-basis: calc(100% - 120px); }
  .ld-who h1 { font-size: 20px; overflow-wrap: anywhere; }
  .ld-quick .ld-act { flex: 1 1 calc(50% - 8px); }
  .leads-page, .calx { padding-left: 0; padding-right: 0; }
}

/* ---- Enquiry forms: list, editor, field builder ---- */
.crm-pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin: 0.2rem 0 0.9rem; }
.crm-pagehead h2 { margin: 0; font-family: var(--font-heading); font-size: 1.05rem; font-weight: 800; display: flex; align-items: center; gap: 0.45rem; }
.crm-pagehead p { margin: 0.2rem 0 0; font-size: 0.7rem; color: var(--crm-muted); }
.crm-back { font-size: 0.72rem; font-weight: 700; color: var(--pv-indigo); text-decoration: none; }
.crm-formcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0.9rem; }
.crm-formcard { display: grid; gap: 0.7rem; align-content: start; }
.crm-formcard.off { opacity: 0.75; }
.crm-formcard .top { display: flex; align-items: center; gap: 0.7rem; }
.crm-formcard .ico { width: 38px; height: 38px; border-radius: 11px; background: #ede9fe; color: var(--pv-indigo); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.crm-formcard .who { flex: 1; min-width: 0; display: grid; }
.crm-formcard .who a { color: var(--crm-ink); text-decoration: none; }
.crm-formcard .who b { font-size: 0.82rem; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.crm-formcard .who span { font-size: 0.64rem; color: var(--crm-muted); }
.crm-formcard .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; align-items: center; }
.crm-formcard .stats strong { display: block; font-family: var(--font-heading); font-size: 1.05rem; }
.crm-formcard .stats small { font-size: 0.6rem; color: var(--crm-muted); font-weight: 600; }
.crm-formcard .acts { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

.crm-formpage { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 0.9rem; align-items: start; }
.crm-formedit, .crm-formside { display: grid; gap: 0.9rem; min-width: 0; }
.crm-field { display: grid; gap: 0.25rem; font-size: 0.68rem; font-weight: 700; color: var(--crm-muted); margin-bottom: 0.6rem; }
.crm-field small { font-weight: 500; color: #a0a3b8; }
.crm-field input[type=text], .crm-field input[type=number], .crm-field input[type=email], .crm-field select, .crm-field textarea,
.fb-row input[type=text], .fb-row select, .fb-row textarea { font: inherit; font-size: 0.76rem; padding: 0.55rem 0.7rem; border: 1px solid var(--crm-line); border-radius: 10px; color: var(--crm-ink); background: #fff; width: 100%; min-width: 0; box-sizing: border-box; }
.crm-field input:focus, .crm-field select:focus, .crm-field textarea:focus, .fb-row input:focus, .fb-row select:focus, .fb-row textarea:focus { outline: 2px solid rgba(79, 70, 229, 0.25); border-color: var(--pv-indigo); }
.crm-check { display: flex; gap: 0.55rem; align-items: flex-start; font-size: 0.7rem; color: var(--crm-muted); margin: 0.2rem 0 0.5rem; cursor: pointer; }
.crm-check input[type=checkbox] { margin-top: 0.15rem; flex: none; }
.crm-check b { color: var(--crm-ink); display: block; }
.crm-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.8rem; }
.crm-savebar { display: flex; gap: 0.5rem; position: sticky; bottom: 0.6rem; padding: 0.6rem; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(6px); border: 1px solid var(--crm-line); border-radius: 14px; z-index: 5; }
.crm-sideacts { display: flex; gap: 0.4rem; margin: 0.6rem 0 0; }
.crm-sidenote { margin-top: 0.7rem; font-size: 0.68rem; }
.crm-hero { background: transparent; }

.fb-fields { display: grid; gap: 0.6rem; margin-bottom: 0.7rem; }
.fb-row { border: 1px solid var(--crm-line); border-radius: 13px; padding: 0.65rem; background: #fbfbff; display: grid; gap: 0.5rem; }
.fb-top { display: flex; gap: 0.5rem; align-items: center; }
.fb-num { width: 24px; height: 24px; border-radius: 50%; background: #ede9fe; color: var(--pv-indigo); font-size: 0.64rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.fb-move { display: inline-flex; gap: 0.2rem; flex: none; }
.fb-move button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--crm-line); background: #fff; color: var(--crm-muted); cursor: pointer; font-size: 0.8rem; line-height: 1; }
.fb-move button:hover:not(:disabled) { color: var(--pv-indigo); border-color: var(--pv-indigo); }
.fb-move button:disabled { opacity: 0.35; cursor: default; }

@media (max-width: 900px) { .crm-formpage { grid-template-columns: 1fr; } .crm-formcards { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .crm-two { grid-template-columns: 1fr; } }

/* ---- CRM settings ---- */
.crm-settings { display: grid; gap: 0.9rem; max-width: 760px; }
.crm-stagelist { display: grid; gap: 0.45rem; margin-bottom: 0.7rem; }
.crm-stagerow { display: flex; align-items: center; gap: 0.5rem; background: var(--crm-soft); border-radius: 11px; padding: 0.4rem 0.55rem; flex-wrap: wrap; }
.crm-stagerow .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.crm-stagerow input[type=text] { flex: 1 1 140px; min-width: 0; font: inherit; font-size: 0.76rem; padding: 0.45rem 0.6rem; border: 1px solid var(--crm-line); border-radius: 9px; background: #fff; }
.crm-stagerow input[type=color] { width: 36px; height: 32px; padding: 0; border: 1px solid var(--crm-line); border-radius: 8px; background: #fff; cursor: pointer; }
.crm-stagerow .mv { display: inline-flex; gap: 0.2rem; }
.crm-stagerow .mv button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--crm-line); background: #fff; color: var(--crm-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.crm-stagerow .mv button:hover { color: var(--pv-indigo); border-color: var(--pv-indigo); }
.crm-stagerow .hide { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.66rem; font-weight: 700; color: var(--crm-muted); }
.crm-stagerow .fixed { font-size: 0.62rem; color: var(--crm-muted); font-weight: 600; margin-left: auto; }
.crm-savebar.flat { position: static; background: transparent; border: 0; padding: 0; backdrop-filter: none; margin-top: 0.3rem; }

/* ---- Form editor, version 2: settings on the left, questions on the right, icons instead of sentences ---- */
.fm-top { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin: 0.1rem 0 0.7rem; }
.fm-top h2 { margin: 0; font-family: var(--font-heading); font-size: 1.05rem; font-weight: 800; }
.fm-link { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; background: var(--crm-soft); border-radius: 10px; padding: 0.25rem 0.3rem 0.25rem 0.7rem; font-size: 0.68rem; font-weight: 700; max-width: 100%; min-width: 0; }
.fm-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 340px; }
.fm-stats { display: flex; align-items: stretch; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.fm-stat { display: inline-flex; align-items: center; gap: 0.45rem; background: #fff; border: 1px solid var(--crm-line); border-left: 4px solid var(--c, var(--pv-indigo)); border-radius: 12px; padding: 0.4rem 0.8rem; text-decoration: none; color: inherit; }
.fm-stat.plain { border-left-color: #cbd5e1; }
a.fm-stat:hover { box-shadow: 0 6px 16px rgba(79, 70, 229, 0.12); }
.fm-stat i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.fm-stat strong { font-family: var(--font-heading); font-size: 1rem; }
.fm-stat small { font-size: 0.62rem; font-weight: 700; color: var(--crm-muted); }
.fm-stat .ci { color: var(--pv-indigo); }
.fm-stat-end { margin-left: auto; display: inline-flex; align-items: center; gap: 0.4rem; }

.fm-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0.9rem; align-items: start; }
.fm-left, .fm-right { display: grid; gap: 0.8rem; min-width: 0; align-content: start; }
.fm-card { background: #fff; border: 1px solid var(--crm-line); border-radius: 18px; padding: 0.85rem 0.95rem; display: grid; gap: 0.55rem; box-shadow: 0 2px 10px rgba(70, 80, 160, 0.05); }
.fm-card h3 { margin: 0 0 0.1rem; font-family: var(--font-heading); font-size: 0.86rem; font-weight: 800; display: flex; align-items: center; gap: 0.55rem; }
.fm-ico { width: 30px; height: 30px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.fm-ico.violet { background: #ede9fe; color: #6d28d9; } .fm-ico.blue { background: #dbeafe; color: #1d4ed8; } .fm-ico.amber { background: #fef3c7; color: #b45309; } .fm-ico.green { background: #dcfce7; color: #15803d; }
.fm-in, .fm-sel { display: flex; align-items: center; gap: 0.5rem; border: 1px solid var(--crm-line); border-radius: 11px; background: #fff; padding: 0 0.7rem; min-width: 0; }
.fm-in:focus-within, .fm-sel:focus-within { border-color: var(--pv-indigo); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12); }
.fm-in .ci, .fm-sel .ci { color: #a0a6c0; flex: none; }
.fm-in input, .fm-sel select { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 0.76rem; padding: 0.62rem 0; color: var(--crm-ink); }
.fm-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.fm-toggle { display: flex; align-items: center; gap: 0.6rem; font-size: 0.74rem; font-weight: 700; color: var(--crm-ink); cursor: pointer; padding: 0.1rem 0.2rem; }
.fm-toggle input[type=checkbox] { position: absolute; opacity: 0; }
.fm-toggle .track { width: 38px; height: 22px; border-radius: 99px; background: #cbd5e1; position: relative; transition: background .15s; flex: none; }
.fm-toggle .track i { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform .15s; }
.fm-toggle input:checked ~ .track { background: #16a34a; }
.fm-toggle input:checked ~ .track i { transform: translateX(16px); }
.fm-reveal textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 0.74rem; padding: 0.6rem 0.75rem; border: 1px solid var(--crm-line); border-radius: 11px; resize: vertical; }
.fm-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.fm-q h3 { position: sticky; top: 0; }
.fm-addq { margin-left: auto; padding: 0.45rem 0.8rem; }
.fm-save { grid-column: 1 / -1; position: sticky; bottom: 0.6rem; display: flex; gap: 0.5rem; justify-content: flex-end; }

/* The question builder, as icons */
.fb-fields { display: grid; gap: 0.55rem; }
.fb-row { border: 1px solid var(--crm-line); border-radius: 14px; padding: 0.55rem; background: #fbfbff; display: grid; gap: 0.45rem; }
.fb-row:focus-within { border-color: #a5b4fc; background: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.1); }
.fb-top { display: flex; gap: 0.45rem; align-items: center; }
.fb-label { flex: 1; min-width: 0; font: inherit; font-size: 0.8rem; font-weight: 700; border: 1px solid var(--crm-line); border-radius: 10px; padding: 0.5rem 0.65rem; background: #fff; }
.fb-req { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--crm-line); background: #fff; color: #cbd5e1; cursor: pointer; font-size: 0.9rem; line-height: 1; flex: none; }
.fb-req.on { background: #fef3c7; border-color: #f59e0b; color: #d97706; }
.fb-move { display: inline-flex; gap: 0.2rem; flex: none; }
.fb-move button { width: 28px; height: 30px; border-radius: 8px; border: 1px solid var(--crm-line); background: #fff; color: var(--crm-muted); cursor: pointer; font-size: 0.8rem; line-height: 1; }
.fb-move button:hover:not(:disabled) { color: var(--pv-indigo); border-color: var(--pv-indigo); }
.fb-move button.del:hover { color: #dc2626; border-color: #dc2626; }
.fb-move button:disabled { opacity: 0.3; cursor: default; }
.fb-types { display: flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.fb-types button { min-width: 32px; height: 30px; padding: 0 0.4rem; border-radius: 9px; border: 1px solid var(--crm-line); background: #fff; color: #64748b; cursor: pointer; font: 700 0.78rem var(--font-body); }
.fb-types button:hover { border-color: var(--pv-indigo); color: var(--pv-indigo); }
.fb-types button.on { background: var(--pv-indigo); border-color: var(--pv-indigo); color: #fff; box-shadow: 0 3px 8px rgba(79, 70, 229, 0.3); }
.fb-maps { margin-left: auto; font: inherit; font-size: 0.68rem; font-weight: 700; border: 1px solid var(--crm-line); border-radius: 9px; padding: 0.35rem 0.5rem; background: #fff; color: #475569; max-width: 150px; }
.fb-options, .fb-placeholder { font: inherit; font-size: 0.72rem; border: 1px solid var(--crm-line); border-radius: 10px; padding: 0.45rem 0.65rem; background: #fff; width: 100%; box-sizing: border-box; resize: vertical; }
.fb-num { width: 24px; height: 24px; border-radius: 50%; background: #ede9fe; color: var(--pv-indigo); font-size: 0.64rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
@media (max-width: 960px) { .fm-grid { grid-template-columns: 1fr; } .fm-link { margin-left: 0; } }
@media (max-width: 520px) { .fm-two { grid-template-columns: 1fr; } .fb-maps { margin-left: 0; max-width: none; flex: 1; } }


/* ---- Phone header: the active section as a pill (arrow opens the rest), settings stays, + opens Add lead / Import leads ---- */
.crm-pill { list-style: none; display: inline-flex; align-items: center; gap: 0.4rem; background: #fff; color: var(--pv-indigo); border: 1px solid var(--crm-line); border-radius: 10px; padding: 0.42rem 0.55rem 0.42rem 0.75rem; font-size: 0.74rem; font-weight: 800; cursor: pointer; box-shadow: 0 1px 4px rgba(30, 33, 48, 0.08); }
.crm-pill .chev { width: 0.9rem !important; height: 0.9rem !important; transition: transform 0.15s; }
.crm-menu[open] .crm-pill .chev { transform: rotate(90deg); }
.crm-menu-list { left: 0; right: auto; }
.crm-plus { display: none; position: relative; }
.crm-plus summary { list-style: none; cursor: pointer; }
.crm-plus summary::-webkit-details-marker { display: none; }
.crm-plus .crm-menu-list { right: 0; left: auto; position: absolute; top: calc(100% + 6px); z-index: 70; min-width: 180px; background: #fff; border: 1px solid var(--crm-line); border-radius: 12px; box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18); padding: 0.35rem; display: grid; }
.crm-plus .crm-menu-list button { display: flex; align-items: center; gap: 0.6rem; padding: 0.62rem 0.8rem; border: 0; background: none; border-radius: 8px; font: inherit; font-size: 0.78rem; font-weight: 700; color: var(--crm-ink); cursor: pointer; text-align: left; }
.crm-plus .crm-menu-list button:hover { background: var(--crm-soft); color: var(--pv-indigo); }
@media (max-width: 1000px) {
  .crm-hdr .crm-gear { display: inline-flex; }
  .crm-hdr .crm-lg { display: none; }
  .crm-hdr .crm-plus { display: block; }
  .crm-hdr .crm-head { justify-content: space-between; }
}
.crm-pagehead.end { justify-content: flex-end; margin: 0 0 0.6rem; }

@media (max-width: 1000px) { .crm-hdr .crm-actions { margin-left: auto; justify-content: flex-end; } }


/* ---- Plan: trial, usage and locked leads strip; locked sections ---- */
.crm-plan { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0 0 0.7rem; }
.crm-plan-chip { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.75rem; border-radius: 99px; font-size: 0.68rem; font-weight: 700; text-decoration: none; background: #fff; border: 1px solid var(--crm-line); color: var(--crm-ink); }
.crm-plan-chip em { font-style: normal; font-weight: 800; color: #fff; background: var(--pv-indigo); border-radius: 99px; padding: 0.05rem 0.5rem; font-size: 0.6rem; }
.crm-plan-chip.trial { background: linear-gradient(135deg, #eef2ff, #f5f3ff); border-color: #c7d2fe; color: #4338ca; }
.crm-plan-chip.lock { background: #fffbeb; border-color: #fcd34d; color: #92400e; }
.crm-plan-chip.lock:hover { background: #fef3c7; }
.crm-plan-chip.meter .bar { width: 64px; height: 7px; border-radius: 99px; background: #e5e7f3; overflow: hidden; display: block; }
.crm-plan-chip.meter .bar i { display: block; width: var(--p); height: 100%; background: linear-gradient(90deg, #6366f1, #8b5cf6); border-radius: 99px; }
.crm-plan-chip.meter.near { border-color: #fcd34d; } .crm-plan-chip.meter.near .bar i { background: #f59e0b; }
.crm-plan-chip.meter.full { border-color: #fca5a5; } .crm-plan-chip.meter.full .bar i { background: #ef4444; }
.crm-locked { opacity: 0.55; pointer-events: none; filter: grayscale(0.3); }
.crm-upgrade .body { justify-items: center; text-align: center; }
.crm-upgrade .crm-up-ico { font-size: 2rem; }
.crm-upgrade p { margin: 0; font-size: 0.8rem; color: var(--crm-ink); font-weight: 600; }

/* The header's actions must never take the full row on a phone (the generic .crm-actions rule does): they stay at the right, beside the section pill. */
.crm-hdr .crm-actions { width: auto; margin-left: auto; justify-content: flex-end; }
.crm-hdr .crm-menu { flex: 0 1 auto; min-width: 0; }
.crm-hdr .crm-pill { max-width: 100%; }
.crm-hdr .crm-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Use it on your website: click-to-view embed and API snippets */
.fm-share-btns { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.fm-share-btns .crm-btn[aria-expanded="true"] { background: var(--crm-soft); border-color: #c7cdf5; }
.fm-code { display: grid; gap: 0.45rem; padding-top: 0.2rem; }
.fm-code[hidden] { display: none; }
.fm-code p { margin: 0; font-size: 0.74rem; color: var(--crm-muted, #6b7280); line-height: 1.5; }
.fm-code pre { margin: 0; padding: 0.7rem 0.8rem; border-radius: 11px; background: #14172e; color: #e6e9ff; font: 0.7rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-x: auto; white-space: pre; }
.fm-code .crm-btn { justify-self: start; }
.fm-code-h { font-size: 0.68rem; font-weight: 700; color: var(--crm-muted, #6b7280); word-break: break-all; }

/* CRM settings: stages on the left, lost reasons and notifications on the right (one column on a phone) */
.crm-settings.two { max-width: none; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
@media (max-width: 960px) { .crm-settings.two { grid-template-columns: minmax(0, 1fr); } }
