/* EnHost - staff app and client portal: bottom tab bar on phones, side rail on wide screens (same design as EnCRM/EnAds, teal). */
:root {
  --bg: #f5f6fa; --card: #fff; --ink: #1d2030; --muted: #6b7083; --line: #e6e8ef; --accent: #0e7490; --accent-soft: #e6f6f9;
  --good: #15803d; --good-soft: #e7f6ec; --warn: #b45309; --warn-soft: #fff4e0; --bad: #b91c1c; --bad-soft: #fdecec;
  --radius: 14px; --nav-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 20px; margin: 0; } h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* layout */
.shell { min-height: 100vh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px); }
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 12px 16px 8px; display: flex; align-items: center; gap: 10px; }
.top .title { flex: 1; min-width: 0; } .top .title .sub { font-size: 12px; color: var(--muted); }
.top-acts { display: flex; gap: 8px; }
/* Phones: the buttons go on their own row under the greeting, so the name is not squeezed. */
@media (max-width: 600px) { .top { flex-wrap: wrap; } .top-acts { order: 3; flex-basis: 100%; } .top-acts .btn { flex: 1; justify-content: center; } }
.page { padding: 0 16px 16px; }
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: #fff; border-top: 1px solid var(--line); display: flex; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.nav a svg { width: 24px; height: 24px; }
.nav a.on { color: var(--accent); }
.nav a .dot { position: absolute; top: 8px; left: 50%; margin-left: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; line-height: 16px; text-align: center; padding: 0 4px; }
@media (min-width: 900px) {
  .shell { padding-bottom: 20px; padding-left: 92px; }
  .nav { top: 0; bottom: 0; right: auto; width: 84px; height: auto; flex-direction: column; justify-content: flex-start; padding-top: 14px; border-top: 0; border-right: 1px solid var(--line); }
  .nav a { flex: 0 0 72px; }
  .page, .top { padding-left: 20px; padding-right: 20px; }
}

/* pieces */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px rgba(20,24,40,.05); margin-bottom: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .grid4 { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 1px 2px rgba(20,24,40,.05); }
.stat .lbl { font-size: 12px; color: var(--muted); font-weight: 600; } .stat .val { font-size: 21px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; } .stat .hint { font-size: 12px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 14px; font-weight: 600; cursor: pointer; min-height: 40px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; } .btn.bad { background: #fff; border-color: #f2c4c4; color: var(--bad); }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
/* Icons inside buttons (Call, WhatsApp…) stay icon-sized; button links are not underlined. */
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.sm svg { width: 16px; height: 16px; }
a.btn { text-decoration: none; color: inherit; } a.btn.primary, a.btn.good { color: #fff; }
.btn:disabled { opacity: .55; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: #fff; display: inline-flex; align-items: center; justify-content: center; position: relative; box-shadow: 0 1px 2px rgba(20,24,40,.06); cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; line-height: 16px; padding: 0 4px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f5; color: #4b5064; white-space: nowrap; }
.b-good { background: var(--good-soft); color: var(--good); } .b-warn { background: var(--warn-soft); color: var(--warn); } .b-bad { background: var(--bad-soft); color: var(--bad); } .b-acc { background: var(--accent-soft); color: var(--accent); }
.alert { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.alert.warn { background: var(--warn-soft); color: #7a3e06; } .alert.bad { background: var(--bad-soft); color: var(--bad); } .alert.info { background: var(--accent-soft); color: #155e75; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* forms */
.f { display: block; margin-bottom: 12px; }
.f > span { display: block; font-size: 13px; font-weight: 600; color: #464a5c; margin-bottom: 5px; }
.f input, .f select, .f textarea, .search { width: 100%; border: 1px solid #d7dae4; border-radius: 10px; padding: 10px 12px; background: #fff; min-height: 44px; outline: none; }
.f textarea { min-height: 80px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus, .search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint-text { font-size: 12px; color: var(--muted); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; font-weight: 600; font-size: 14px; }
.check input { width: 20px; height: 20px; }
.seg { display: flex; background: #e9ebf2; border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 7px 6px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20,24,40,.1); }
.req { color: var(--bad); }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: #464a5c; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { opacity: .65; margin-left: 4px; font-weight: 500; }

/* lists */
.item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; }
.item:last-child { border-bottom: 0; }
.item .main { flex: 1; min-width: 0; }
.item .t1 { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.item .side { text-align: right; flex: 0 0 auto; }
.item .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.item.off { opacity: .5; } .item.off .amt { text-decoration: line-through; }
.qa { display: flex; gap: 6px; }
.qa a { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.qa a svg { width: 20px; height: 20px; }
.qa .call { background: var(--accent-soft); color: var(--accent); } .qa .wa { background: #e5f8ec; color: #128c4a; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }

/* status colours */
.st-New { background: #e0ecff; color: #1d4ed8; } .st-Contact-Attempted { background: #fff4e0; color: #b45309; } .st-Contacted { background: #e6f4ff; color: #0369a1; }
.st-Qualified { background: #f0e8ff; color: #6d28d9; } .st-Follow-Up { background: #fff1d6; color: #a16207; } .st-Converted { background: var(--good-soft); color: var(--good); }
.st-Bad-Fit, .st-Not-Interested { background: #eef0f5; color: #6b7083; }

/* timeline */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--line); margin-left: 6px; }
.tl li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #c7cbe0; }
.tl li.status::before { background: var(--accent); } .tl li.whatsapp_in::before, .tl li.whatsapp::before { background: #25d366; }
.tl .when { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }

/* floating + action bars */
.fab { position: fixed; right: 18px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 25; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: #fff;
  box-shadow: 0 6px 18px rgba(14,116,144,.35); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.fab svg { width: 28px; height: 28px; }
.actionbar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 25; display: flex; gap: 8px; padding: 10px 12px; background: rgba(245,246,250,.96); border-top: 1px solid var(--line); }
.actionbar .btn { flex: 1; }
.has-actionbar { padding-bottom: 70px; }
@media (min-width: 900px) { .fab { bottom: 24px; } .actionbar { left: 84px; bottom: 0; } }

/* sheets (full-screen on phones, centred panel on wide screens) */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(15,18,30,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: 94vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .18s ease-out; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; border-radius: 18px 18px 0 0; }
.sheet-head h2 { flex: 1; margin: 0; }
.sheet-body { overflow-y: auto; padding: 16px; padding-bottom: calc(16px + var(--safe-b)); }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* duty switch */
.duty { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 6px 12px 6px 6px; font-weight: 700; font-size: 13px; cursor: pointer; background: #e9ebf2; color: #555b70; }
.duty .knob { width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.duty.on { background: var(--good); color: #fff; }

/* auth */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth .card { width: 100%; max-width: 380px; padding: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 18px; }
.brand img { width: 36px; height: 36px; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 80px); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
#toast div { background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 12px; font-size: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.2); pointer-events: auto; }
#toast div.err { background: var(--bad); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.tbl-wrap { overflow-x: auto; }
.shot { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.sug { border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: -8px; margin-bottom: 12px; max-height: 220px; overflow-y: auto; }
.sug div { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; } .sug div:last-child { border-bottom: 0; }
.picked { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
/* Plans: one row, left to right, scrolled sideways (swipe on phones). */
.plans { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding: 2px 2px 8px; margin: 0 -2px; -webkit-overflow-scrolling: touch; }
.plan { flex: 0 0 152px; scroll-snap-align: start; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 3px; min-height: 64px; }
.plan b { font-size: 15px; } .plan span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan small { font-size: 12px; color: #4b5064; line-height: 1.35; margin-top: 2px; white-space: pre-line; }
.plan.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); } .plan.on span { color: var(--accent); }
pre.code { background: #f0f1f6; padding: 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; font-size: 13px; }


/* ---------- EnHost ---------- */
.stats4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 700px) { .stats4 { grid-template-columns: repeat(4, 1fr); } }
.stat.link { cursor: pointer; color: inherit; } .stat.link:hover { box-shadow: 0 0 0 2px var(--accent-soft); }
.stat .val.warn { color: var(--warn); }
.shell.no-nav { padding-bottom: 20px; padding-left: 0; }
.logo-s img { width: 36px; height: 36px; display: block; border-radius: 10px; }
.page { max-width: 980px; }
@media (min-width: 900px) { .shell.no-nav .page, .shell.no-nav .top { max-width: 760px; margin: 0 auto; } }
.acts { margin: 4px 0 12px; }
.hist { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.hist li { padding: 8px 0; border-bottom: 1px solid var(--line); } .hist li:last-child { border-bottom: 0; }
.ctext { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.msgs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.msg { max-width: 88%; background: #fff; border-radius: 14px; padding: 10px 13px; box-shadow: 0 1px 2px rgba(20,24,40,.06); }
.msg.me { align-self: flex-end; background: var(--accent-soft); }
.msg.internal { background: #fff8e1; border: 1px dashed #e0b84f; }
.msg .who { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
a.file { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; background: #f0f2f7; border-radius: 8px; padding: 4px 8px; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.file svg { width: 14px; height: 14px; flex: none; }
.feat { list-style: none; padding: 0; margin: 10px 0 0; font-size: 14px; }
.feat li { padding: 4px 0 4px 22px; position: relative; }
.feat li::before { content: "✓"; position: absolute; left: 2px; color: var(--accent); font-weight: 800; }
.cycles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.cyc { position: relative; cursor: pointer; }
.cyc input { position: absolute; opacity: 0; }
.cyc span { display: flex; flex-direction: column; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.cyc small { color: var(--muted); font-size: 13px; }
.cyc input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.cyc input:focus-visible + span { outline: 2px solid var(--accent); }
details.more-f { margin-bottom: 12px; } details.more-f summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); }
.upi-btn { margin-top: 12px; }
.pre-l { white-space: pre-line; font-size: 14px; }
.due-soon { color: var(--warn); font-weight: 700; margin-top: 2px; }
.lrow { display: grid; grid-template-columns: 1fr 110px 70px; gap: 6px; margin-bottom: 6px; }
.prow { display: grid; grid-template-columns: 100px 1fr auto; gap: 6px; margin-bottom: 6px; }
.lrow input, .lrow select, .prow input, .mini-s { border: 1px solid #d7dae4; border-radius: 10px; padding: 8px 10px; min-height: 40px; background: #fff; width: 100%; min-width: 0; }
.mini-s { width: auto; min-height: 34px; padding: 5px 8px; font-size: 13px; }
.item .pri { color: var(--bad); font-weight: 800; margin-right: 4px; }
.item.off-n { opacity: .6; }
.proof { border: 2px solid var(--accent-soft); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.5); border-top-color: currentColor; border-radius: 50%; animation: rot 1s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes rot { to { transform: rotate(360deg); } }
.help { background: linear-gradient(135deg, #fff, var(--accent-soft)); }
tfoot td { border-bottom: 0 !important; }
@media (max-width: 600px) { .grid2.stack-m { grid-template-columns: 1fr; gap: 0; } .msg { max-width: 96%; } }.dcheck { display: flex; gap: 8px; } .dcheck input { flex: 1; min-width: 0; }
.dres { font-size: 14px; margin-top: 6px; min-height: 0; } .dres:empty { display: none; }
.dr-ok { color: var(--good); font-weight: 600; } .dr-bad { color: var(--bad); font-weight: 600; } .dr-warn { color: var(--warn); font-weight: 600; }.grid3 { display: grid; grid-template-columns: 1.3fr 1fr 0.8fr; gap: 10px; }
@media (max-width: 600px) { .grid3 { grid-template-columns: 1fr 1fr; } }
