/* Mio CRM (crm.miosynergy.com): loaded after app.css on CRM pages. */
.panel-crm, .crm-lp { --brand: #3B2F8F; --crm-soft: #f1effb; }
.logo-crm .mark { background: #3B2F8F; color: #fff; text-transform: lowercase; }
.crm-r { text-align: right; align-items: flex-end; }

/* Stage pill: <span class="crm-stage" style="--c:#hex"> */
.crm-stage { --c: #64748B; display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-weight: 700; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 12%, white); color: color-mix(in srgb, var(--c) 75%, black); }
.crm-stage::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* Avatars & small buttons */
.crm-av { flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--crm-soft); color: var(--brand); font-weight: 800; font-size: 1rem; text-transform: uppercase; }
.crm-av.sm { width: 26px; height: 26px; font-size: .85rem; }
.crm-av.lg { width: 54px; height: 54px; font-size: 1.4rem; font-family: var(--font-display); }
.crm-icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; list-style: none; padding: 0; font: inherit; }
.crm-icon-btn:hover { background: var(--paper); color: var(--brand); }
.crm-icon-btn::-webkit-details-marker { display: none; }
.crm-x { background: none; border: 0; font-size: 1.3rem; color: var(--muted); cursor: pointer; padding: 4px 8px; }

/* Dashboard */
.crm-stats .stat { text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.crm-stats a.stat:hover { border-color: var(--brand); transform: translateY(-1px); }
.crm-stats .stat { flex-basis: 160px; }
.stat.crm-alert { border-color: #f5b700; background: #fffbea; }
.crm-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.crm-line:first-of-type { border-top: 0; }
.crm-line.late .crm-line-main strong { color: var(--deal); }
.crm-line-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.crm-line-main .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.crm-line-main:hover strong { color: var(--brand); }
.crm-funnel { display: flex; flex-direction: column; gap: 8px; }
.crm-funnel-row { display: grid; grid-template-columns: minmax(80px, 130px) 1fr 36px; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); }
.crm-funnel-row strong { text-align: right; }
.crm-funnel-bar { height: 12px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.crm-funnel-bar i { display: block; height: 100%; min-width: 4px; border-radius: 99px; background: var(--c, var(--brand)); }
.crm-funnel-row:hover span:first-child { color: var(--brand); }
.crm-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 40px 20px; color: var(--muted); }
.crm-empty > i { font-size: 2.4rem; color: color-mix(in srgb, var(--brand) 45%, white); }

/* Tabs with counts, filters, tables */
.crm-tabs { margin: -4px 0; }
.crm-tabs .count { background: var(--line); color: var(--ink); font-size: .9rem; }
.crm-tabs a.on .count { background: #fff; color: var(--ink); }
.crm-tabs .count.bad { background: var(--deal); color: #fff; }
.crm-filters { justify-content: flex-start; }
.crm-filters input[type=search] { flex: 1 1 220px; max-width: 320px; }
.crm-filters select { width: auto; flex: 0 1 auto; max-width: 180px; }
.crm-tick { width: 34px; }
.crm-table td { vertical-align: middle; }
.crm-bulk { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; background: var(--crm-soft); border-bottom: 1px solid var(--line); }
.crm-bulk[hidden] { display: none; }
.crm-bulk select { width: auto; max-width: 180px; padding: 6px 10px; }
.crm-pages { padding: 12px 14px; border-top: 1px solid var(--line); }

/* Pipeline board */
.crm-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; scroll-snap-type: x proximity; min-height: 60vh; }
.crm-col { --c: #64748B; flex: 0 0 272px; scroll-snap-align: start; background: color-mix(in srgb, var(--c) 6%, var(--paper)); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.crm-col > header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px 10px; border-top: 4px solid var(--c); border-radius: var(--radius) var(--radius) 0 0; }
.crm-col > header strong { flex: 1 1 auto; }
.crm-col > header small { flex-basis: 100%; color: var(--muted); }
.crm-col-n { background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; font-weight: 700; }
.crm-col-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; border-radius: 0 0 var(--radius) var(--radius); transition: background .15s; }
.crm-col-body.over { background: color-mix(in srgb, var(--c) 16%, transparent); outline: 2px dashed var(--c); outline-offset: -6px; }
.crm-col-empty { color: var(--muted); text-align: center; padding: 18px 6px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.crm-col-won .crm-card, .crm-col-lost .crm-card { opacity: .85; }
.crm-card { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 1px 2px rgb(0 0 0 / 5%); cursor: grab; transition: box-shadow .15s, transform .15s; }
.crm-card:hover { box-shadow: 0 6px 16px -6px rgb(0 0 0 / 22%); }
.crm-card.dragging { opacity: .45; transform: rotate(1.5deg); }
.crm-card.moved { animation: crm-pop .5s ease; }
@keyframes crm-pop { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 45%, transparent); } 100% { box-shadow: 0 1px 2px rgb(0 0 0 / 5%); } }
.crm-card-name { font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.3; }
.crm-card-name:hover { color: var(--brand); }
.crm-card-co { color: var(--muted); font-size: .95rem; }
.crm-card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: .95rem; color: var(--muted); }
.crm-card-val { color: var(--ink); font-weight: 700; }
.crm-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.crm-card-foot .crm-av { margin-right: auto; }
.crm-move { position: relative; }
.crm-move > div { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px -8px rgb(0 0 0 / 25%); padding: 6px; display: flex; flex-direction: column; }
.crm-move button { background: none; border: 0; text-align: left; font: inherit; padding: 8px 10px; border-radius: 7px; cursor: pointer; color: var(--ink); }
.crm-move button:hover { background: var(--paper); color: var(--brand); }

/* Sheets (call outcome, lost reason) */
.crm-sheet { border: 0; border-radius: 18px; padding: 22px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 45%); color: var(--ink); }
.crm-sheet::backdrop { background: rgb(15 20 25 / 45%); }
.crm-sheet h2 { font-size: 1.3rem; }
.crm-outcomes, .crm-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.crm-outcomes label, .crm-quick label { flex-direction: row; display: inline-flex; font-weight: 600; cursor: pointer; }
.crm-outcomes input, .crm-quick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.crm-outcomes span, .crm-quick span { padding: 8px 14px; border-radius: 99px; border: 1px solid #cfccc4; background: var(--surface); transition: background .12s, border-color .12s; }
.crm-quick span { padding: 6px 12px; }
.crm-outcomes input:checked + span, .crm-quick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.crm-outcomes input:focus-visible + span, .crm-quick input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.crm-next { display: flex; flex-direction: column; gap: 10px; background: var(--paper); border-radius: 12px; padding: 12px 14px; }
.crm-next legend { float: left; width: 100%; margin: 0; }

/* Lead page */
.crm-lead-head { display: flex; flex-direction: column; gap: 10px; }
.crm-lead-head > a { text-decoration: none; }
.crm-lead-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.crm-lead-title .stack { flex: 1 1 260px; min-width: 0; }
.crm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.crm-steps { display: flex; flex-wrap: wrap; gap: 4px; }
.crm-step { --c: #64748B; flex: 1 1 100px; position: relative; font: inherit; font-weight: 700; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; border-radius: 8px; transition: background .12s; }
.crm-step:hover:not(:disabled) { background: color-mix(in srgb, var(--c) 10%, white); color: var(--ink); }
.crm-step.past { background: color-mix(in srgb, var(--c) 14%, white); color: color-mix(in srgb, var(--c) 70%, black); border-color: color-mix(in srgb, var(--c) 30%, white); }
.crm-step.on { background: var(--c); color: #fff; border-color: var(--c); cursor: default; opacity: 1; }
.crm-step-won:not(.on) { color: var(--good); }
.crm-step-lost:not(.on) { color: var(--deal); }
.crm-lost-why { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 12px; background: #fdecea; border-radius: 10px; margin-top: 4px; }
.crm-lost-why[hidden] { display: none; }
.crm-lost-why label { flex: 1 1 200px; }
.crm-lost-why input { flex: 1 1 200px; width: auto; }
.crm-lost-why input[hidden] { display: none; }
.crm-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.crm-ev { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.crm-ev::before { content: ""; position: absolute; left: 15px; top: 40px; bottom: -4px; width: 2px; background: var(--line); }
.crm-ev:last-child::before { display: none; }
.crm-ev > div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.crm-ev p { white-space: normal; overflow-wrap: anywhere; background: var(--paper); border-radius: 10px; padding: 8px 12px; margin: 4px 0; }
.crm-ev-ic { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); color: var(--muted); z-index: 1; }
.crm-ev-note .crm-ev-ic { background: #fff4d1; color: #7a5a00; }
.crm-ev-call .crm-ev-ic, .crm-ev-whatsapp .crm-ev-ic, .crm-ev-email .crm-ev-ic { background: var(--crm-soft); color: var(--brand); }
.crm-ev-won .crm-ev-ic { background: #e8f5ec; color: var(--good); }
.crm-ev-lost .crm-ev-ic { background: #fdecea; color: var(--deal); }
.crm-ev-enquiry .crm-ev-ic, .crm-ev-created .crm-ev-ic { background: #e0f2fe; color: #0369a1; }
.crm-details > summary { list-style: none; cursor: pointer; }
.crm-details > summary::-webkit-details-marker { display: none; }
.crm-details:not([open]) > summary h2::after { content: " +"; color: var(--muted); }

/* Today's calls */
.crm-calls { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.crm-call { display: flex; flex-direction: column; gap: 10px; }
.crm-call.late { border-left: 4px solid var(--deal); }
.crm-call-top { display: flex; align-items: center; gap: 10px; }
.crm-call-who { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); }
.crm-call-due { color: var(--muted); }
.crm-call-due strong { color: var(--ink); }
.crm-call-due strong.deal { color: var(--deal); }
.crm-call-note { background: var(--paper); border-radius: 10px; padding: 8px 12px; }
.crm-call-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crm-done { flex: 1 1 260px; flex-wrap: nowrap; }
.crm-done input { flex: 1 1 auto; padding: 8px 10px; }

/* Team, settings, plan, switch */
.crm-team td { vertical-align: middle; }
.crm-team tr.muted td { opacity: .7; }
.crm-team .badge { margin: 2px 4px 0 0; }
.crm-edit { position: relative; display: inline-block; text-align: left; }
.crm-edit > summary { list-style: none; }
.crm-edit > summary::-webkit-details-marker { display: none; }
.crm-edit-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 280px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: 0 16px 40px -10px rgb(0 0 0 / 28%); }
.crm-roles { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.crm-radio .check { font-weight: 600; }
.crm-stage-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.crm-stage-row { display: flex; align-items: center; gap: 8px; }
.crm-stage-row input[type=color] { width: 38px; height: 38px; padding: 2px; border: 1px solid #cfccc4; border-radius: 8px; background: #fff; flex: none; cursor: pointer; }
.crm-stage-row input:not([type]) { flex: 1 1 auto; }
.crm-stage-tools { display: flex; gap: 4px; flex: none; }
.crm-stage-row:first-child [data-up], .crm-stage-row:last-child [data-down] { visibility: hidden; }
.crm-plan-now { font-family: var(--font-display); font-size: 1.6rem; }
.crm-meter { height: 10px; border-radius: 99px; background: var(--paper); overflow: hidden; }
.crm-meter span { display: block; height: 100%; width: var(--p); background: var(--brand); border-radius: 99px; }
.crm-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.crm-plan.on, .crm-plan.hot { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.crm-plan-price { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.crm-switch { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.crm-switch-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; }
.crm-switch-row.on { border-color: var(--brand); }

/* Toast */
.crm-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; box-shadow: 0 12px 30px -8px rgb(0 0 0 / 40%); font-weight: 600; max-width: calc(100vw - 32px); }
.crm-toast.bad { background: var(--deal); }
.crm-toast[hidden] { display: none; }

/* Public pages: landing mock board, sign in */
.crm-mock-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 14px; }
.crm-mock-col { display: flex; flex-direction: column; gap: 6px; background: var(--paper); border-radius: 10px; padding: 8px; min-width: 0; }
.crm-mock-col b { --c: #64748B; font-size: .9rem; border-top: 3px solid var(--c); padding-top: 4px; }
.crm-mock-col i { font-style: normal; font-size: .9rem; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 6px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-auth { max-width: 440px; margin: 40px auto; }

/* Phones */
.crm-hide-sm { display: inline; }
@media (max-width: 700px) {
  .crm-hide-sm { display: none !important; }
  .crm-col { flex-basis: 84vw; max-height: none; }
  .crm-board { min-height: 0; margin: 0 -16px; padding: 0 16px 12px; }
  .crm-step { flex: 1 1 30%; padding: 8px; font-size: .95rem; }
  .crm-actions .btn { flex: 1 1 40%; }
  .crm-calls { grid-template-columns: 1fr; }
  .crm-filters select { flex: 1 1 45%; max-width: none; }
  .crm-filters input[type=search] { max-width: none; flex-basis: 100%; }
  .crm-sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .crm-mock-board { grid-template-columns: repeat(2, 1fr); }
  /* lists become stacked rows */
  .crm-table thead, .crm-team thead { display: none; }
  .crm-table, .crm-table tbody, .crm-team, .crm-team tbody { display: block; }
  .crm-table tr { display: grid; grid-template-columns: 30px 1fr auto; gap: 4px 10px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: center; }
  .crm-table td { border: 0; padding: 0; }
  .crm-table td.crm-tick { grid-row: span 3; align-self: start; }
  .crm-table td:nth-child(2) { grid-column: 2 / 4; }
  .crm-table td:nth-child(3) { grid-column: 2; }
  .crm-table td:nth-child(4) { grid-column: 3; text-align: right; }
  .crm-table td:nth-child(5), .crm-table td:nth-child(6) { display: none; }
  .crm-table td:nth-child(7) { grid-column: 2 / 4; text-align: left; font-weight: 700; }
  .crm-table td:nth-child(7):empty { display: none; }
  .crm-team tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 14px; border-top: 1px solid var(--line); }
  .crm-team td { border: 0; padding: 0; }
  .crm-team td:first-child { grid-column: 1 / 3; }
  .crm-team td:nth-child(3) { display: none; }
  .crm-team td:nth-child(4)::after { content: " open leads"; color: var(--muted); }
  .crm-team td:nth-child(4):empty::after { content: none; }
  .crm-team td:nth-child(5) { grid-column: 1 / 3; text-align: left; }
  .crm-edit-pop { text-align: left; }
  .crm-edit-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; }
  .crm-funnel-row { grid-template-columns: 96px 1fr 30px; }
}
@media (prefers-reduced-motion: reduce) { .crm-card, .crm-card.moved { transition: none; animation: none; } }

/* ---------- Phase 2: sources, messages, field sales, automation, reports ---------- */
.crm-h2 { margin: 22px 0 10px; font-size: 1.15rem; }
.crm-narrow { max-width: 760px; }
.crm-pad { padding: 12px 16px; }
.crm-big { font-size: 2rem; font-family: var(--font-display); }
.crm-src-grid, .crm-ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 14px; }
.crm-src-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.crm-src-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.crm-src-card .badge { align-self: flex-start; }
.crm-src-ic { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--crm-soft); color: var(--brand); flex: none; }
.crm-src-ic.lg { width: 44px; height: 44px; font-size: 1.3rem; }
.crm-copy { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: end; }
.crm-copy input, .crm-copy textarea { grid-column: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; background: var(--paper); }
.crm-copy .btn { grid-column: 2; }
.crm-steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.crm-help { border-top: 1px solid var(--line); padding-top: 8px; }
.crm-help summary { cursor: pointer; }
.crm-code { background: #111827; color: #e5e7eb; padding: 12px; border-radius: 10px; overflow-x: auto; font-size: .85rem; white-space: pre; }
.crm-import th { min-width: 150px; vertical-align: top; }
.crm-import th select { margin-top: 4px; width: 100%; }
.crm-vars { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crm-chip { border: 1px solid var(--line); background: var(--paper); border-radius: 99px; padding: 2px 10px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--ink); }
.crm-chip:hover { border-color: var(--brand); color: var(--brand); }
.crm-dl dt { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; margin-top: 6px; }
.crm-dl dd { margin: 0; color: var(--muted); }
.crm-msg > summary, .crm-details > summary { cursor: pointer; list-style: none; }
.crm-msg > summary::-webkit-details-marker { display: none; }
.crm-score { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: .8rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.crm-score-hot { background: #fff1ec; color: #c2410c; }
.crm-score-warm { background: #fff8e1; color: #a16207; }
.crm-score-cold { background: #eef4fb; color: #3b6aa0; }
.crm-daybar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.crm-daybar > .stack { flex: 1 1 260px; }
.crm-live { color: #16a34a; font-size: .6rem; vertical-align: middle; }
.crm-visit-in { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.crm-visit-done, .crm-visit-cancelled { opacity: .85; }
.crm-visit-photo { max-width: 220px; max-height: 160px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; display: block; margin-top: 6px; }
.crm-visit-photo.sm { max-width: 140px; max-height: 100px; }
.crm-map { height: min(70vh, 560px); border-radius: var(--radius); z-index: 0; }
.crm-pin span { --c: #3B2F8F; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; font: 800 .8rem/1 var(--font-body, sans-serif); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.crm-rule { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.crm-rule-main { flex: 1 1 340px; }
.crm-action { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.crm-action:first-of-type { border-top: 0; }
.crm-action select, .crm-action input { width: auto; max-width: 100%; flex: 0 1 auto; }
.crm-action[hidden], [data-for-kind][hidden], [data-for-trigger][hidden] { display: none !important; }
.crm-checks { gap: 4px 14px; }
.crm-bar { --c: var(--brand); display: inline-block; vertical-align: middle; width: 120px; height: 10px; background: var(--paper); border-radius: 99px; overflow: hidden; margin-right: 6px; }
.crm-bar i { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.crm-bar-cell { white-space: nowrap; }
.crm-bar-row { display: grid; grid-template-columns: minmax(120px, 1fr) auto auto; gap: 8px; align-items: center; padding: 4px 0; }
.crm-daily { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding: 16px; border-bottom: 1px solid var(--line); }
.crm-daily span { flex: 1 1 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; min-width: 3px; }
.crm-daily i { display: block; background: color-mix(in srgb, var(--brand) 70%, white); border-radius: 3px 3px 0 0; min-height: 2px; }
.crm-daily b { position: absolute; top: -2px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: #16a34a; }
.crm-range select, .crm-range input { width: auto; }
@media (max-width: 640px) { .crm-copy { grid-template-columns: 1fr; } .crm-copy .btn { grid-column: 1; justify-self: start; } .crm-bar { width: 70px; } }

/* Inbox: WhatsApp chats and emails. Two panes on wide screens; list or conversation on phones. */
.ibx { display: grid; grid-template-columns: minmax(270px, 340px) 1fr; height: calc(100vh - 150px); min-height: 480px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.ibx-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.ibx-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 6px; }
.ibx-side-head h1 { font-size: 1.25rem; margin: 0; }
.ibx-tabs { display: flex; gap: 2px; padding: 0 10px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.ibx-tabs a { padding: 8px 8px; white-space: nowrap; font-size: .9rem; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
.ibx-tabs a span { font-weight: 700; font-size: .78rem; color: var(--muted); }
.ibx-tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.ibx-filter { display: flex; gap: 6px; padding: 8px 10px; }
.ibx-filter select { flex: 0 1 40%; min-width: 0; }
.ibx-filter input { flex: 1 1 auto; min-width: 0; }
.ibx-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.ibx-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); align-items: flex-start; }
.ibx-item:hover { background: var(--paper); }
.ibx-item.on { background: var(--crm-soft); box-shadow: inset 3px 0 0 var(--brand); }
.ibx-item.unread .ibx-item-top strong, .ibx-item.unread .ibx-snip { color: var(--ink); font-weight: 700; }
.ibx-ic { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 1.05rem; }
.ibx-whatsapp { background: #e7f8ee; color: #128c4a; }
.ibx-email { background: var(--crm-soft); color: var(--brand); }
.ibx-item-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ibx-item-top { display: flex; justify-content: space-between; gap: 8px; }
.ibx-item-top strong, .ibx-subj, .ibx-snip, .ibx-item-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ibx-subj { font-size: .9rem; font-weight: 600; }
.ibx-snip { font-size: .88rem; }
.ibx-badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #25a55f; color: #fff; font-size: .75rem; font-weight: 800; display: grid; place-items: center; align-self: center; }
.ibx-none { padding: 18px 14px; }

.ibx-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.ibx-empty { margin: auto; max-width: 440px; padding: 24px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ibx-empty-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; background: var(--crm-soft); color: var(--brand); }
.ibx-empty .center { justify-content: center; }
.ibx-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ibx-back { display: none; color: var(--ink); padding: 4px 6px; }
.ibx-who { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; }
.ibx-who > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ibx-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ibx-tools form { margin: 0; }
.ibx-assign select { padding: 5px 8px; font-size: .88rem; max-width: 170px; }
.ibx-msgs { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-height: 0;
  background: #efeae2 radial-gradient(circle at 1px 1px, rgb(0 0 0 / 4%) 1px, transparent 0) 0 0 / 18px 18px; }
.ibx-msgs.mail { background: var(--paper); gap: 12px; }
.ibx-day { align-self: center; margin: 8px 0 4px; }
.ibx-day span { background: rgb(255 255 255 / 85%); color: var(--muted); font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgb(0 0 0 / 6%); }
.ibx-sys { align-self: center; font-size: .78rem; color: var(--muted); background: rgb(255 255 255 / 70%); padding: 2px 10px; border-radius: 8px; }
.ibx-bubble { max-width: min(78%, 560px); padding: 6px 9px 4px; border-radius: 10px; box-shadow: 0 1px 1px rgb(0 0 0 / 8%); display: flex; flex-direction: column; gap: 4px; word-wrap: break-word; overflow-wrap: anywhere; }
.ibx-bubble.in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.ibx-bubble.out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.ibx-bubble.failed { background: #fdecea; }
.ibx-text { white-space: normal; line-height: 1.4; }
.ibx-foot { align-self: flex-end; font-size: .72rem; color: var(--muted); display: flex; gap: 4px; align-items: center; }
.ibx-tick { color: var(--muted); }
.ibx-tick.read { color: #2b9be0; }
.ibx-tick.bad { color: var(--deal); font-weight: 700; }
.ibx-tpl { color: var(--muted); font-weight: 700; }
.ibx-media img { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; }
.ibx-bubble audio { max-width: 260px; }
.ibx-bubble video { max-width: 100%; max-height: 320px; border-radius: 6px; }
.ibx-file { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 8px; background: rgb(0 0 0 / 5%); text-decoration: none; color: var(--ink); max-width: 100%; }
.ibx-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ibx-mail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ibx-mail.out { border-left: 3px solid var(--brand); }
.ibx-mail-head { display: flex; justify-content: space-between; gap: 10px; }
.ibx-mail-head small { overflow-wrap: anywhere; }
.ibx-mail-subj { margin: 0; font-weight: 700; }
.ibx-mail-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.ibx-mail-text br { display: none; }
.ibx-frame { width: 100%; height: 160px; border: 0; background: #fff; border-radius: 6px; }
.ibx-files { display: flex; flex-wrap: wrap; gap: 6px; }
.ibx-quote summary { cursor: pointer; }
.ibx-compose { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.ibx-wa-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.ibx-wa-form textarea { flex: 1 1 200px; resize: none; min-height: 42px; max-height: 260px; }
.ibx-wa-form .ibx-picked { flex-basis: 100%; }
.ibx-attach { display: grid; place-items: center; width: 40px; height: 42px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 1.15rem; }
.ibx-attach:hover { color: var(--brand); background: var(--paper); }
.ibx-window { margin: 0; }
.ibx-warn { margin: 0; padding: 8px 12px; border-radius: 8px; background: #fff7e0; color: #6b4e00; }
.ibx-main > .ibx-warn { margin: 0; border-radius: 0; }
.ibx-tpl-box summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.ibx-tpl-box form { margin-top: 8px; }
.ibx-tpl-preview { margin: 0; padding: 8px 10px; background: #d9fdd3; border-radius: 8px; white-space: normal; }
.ibx-tpl-preview mark { background: #fff3b0; padding: 0 2px; border-radius: 3px; }
.ibx-tpl-preview mark.empty { background: #fde2e2; }
.ibx-mail-form { max-height: 50vh; overflow-y: auto; }
.ibx-line { flex-direction: row; align-items: center; gap: 8px; font-size: .9rem; }
.ibx-line input { flex: 1 1 auto; }
.ibx-mail-form textarea { resize: vertical; }
.ibx-provider { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.ibx-provider label { flex-direction: row; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.ibx-provider label:has(input:checked) { border-color: var(--brand); background: var(--crm-soft); }
.ibx-provider span { display: flex; flex-direction: column; gap: 2px; }
.ibx-srv > label:nth-child(2), .ibx-srv > label:nth-child(3) { flex: 0 1 120px; }
.ibx-steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.ibx-tpl-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.crm-conv-link { text-decoration: none; color: var(--ink); }
.crm-conv-link:hover strong { color: var(--brand); }
.btn.busy { opacity: .6; pointer-events: none; }
@media (max-width: 800px) {
  .ibx { grid-template-columns: 1fr; height: calc(100vh - 130px); border-radius: 0; margin: 0 -16px; border-left: 0; border-right: 0; }
  .ibx-side { border-right: 0; }
  .ibx.has-conv .ibx-side { display: none; }
  .ibx:not(.has-conv) .ibx-main { display: none; }
  .ibx-back { display: inline-block; }
  .ibx-bubble { max-width: 88%; }
  .ibx-tools { width: 100%; }
}

/* Calls (Exotel) */
.crm-rec { height: 32px; max-width: 260px; display: block; margin-top: 6px; }
td .crm-rec { margin-top: 0; }
.crm-call-missed td { background: #fff5f5; }

/* WhatsApp campaigns, auto-replies, quick replies */
.crm-camp { display: flex; flex-direction: column; gap: 16px; }
.crm-camp-count { margin: 0; font-size: 1.05rem; }
.ibx-rule { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.ibx-quick-menu { position: absolute; z-index: 70; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px -10px rgb(0 0 0 / 35%); padding: 4px; display: flex; flex-direction: column; }
.ibx-quick-menu[hidden] { display: none; }
.ibx-quick-menu button { all: unset; cursor: pointer; padding: 7px 10px; border-radius: 7px; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ibx-quick-menu button span { color: var(--muted); }
.ibx-quick-menu button.on, .ibx-quick-menu button:hover { background: var(--crm-soft); }

/* Quotes */
.crm-quote-lines input, .crm-quote-lines select { width: 100%; min-width: 0; }
.crm-quote-lines td:first-child { min-width: 220px; }
.crm-quote-total strong { font-size: 1.3rem; }

/* AI help */
.ai-box{border:1px dashed var(--line,#d9d6e8);border-radius:10px;padding:6px 10px;background:color-mix(in srgb,var(--brand,#3B2F8F) 4%,transparent)}
.ai-box summary{cursor:pointer;display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.ai-box summary [data-ai-left]{margin-left:auto}
.ai-box .ai-row{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}
.ai-box .ai-row input{flex:1 1 220px;min-width:0}
.ai-box .ai-row select{flex:0 0 auto;width:auto}
.ai-box .ai-err{color:var(--bad,#b42318);margin:6px 0 0}
.ai-box .ai-note{margin:6px 0 2px}
.ai-box .link{background:none;border:0;padding:0;color:var(--brand,#3B2F8F);text-decoration:underline;cursor:pointer;font:inherit}
.ibx-compose[data-compose="whatsapp"] .ai-box{margin:6px 0}
.ai-card .ai-next{margin:0}
.ai-card textarea{resize:vertical}

