/* LeadCRM — mobile-first. Navy #0A1940 + Gold #FCB707 */
:root {
  --navy: #0A1940; --navy-2: #13265c; --gold: #FCB707; --gold-soft: #fff5d6;
  --bg: #f4f6fb; --card: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e3e8f1;
  --lead: #2563eb; --qual: #b7791f; --conv: #15803d; --lost: #dc2626;
  --radius: 14px; --shadow: 0 1px 3px rgba(10,25,64,.08), 0 4px 14px rgba(10,25,64,.05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--navy-2); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 56px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.topbar .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--gold); color: var(--navy);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.topbar .t1 { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .t2 { font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back { background: none; border: 0; color: #fff; font-size: 22px; padding: 4px 8px 4px 0; cursor: pointer; }
.badge-admin { background: var(--gold); color: var(--navy); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; flex: none; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: calc(100vh - 56px); }
.side { display: none; }
main { flex: 1; min-width: 0; padding: 14px 14px calc(90px + var(--safe-b)); max-width: 980px; margin: 0 auto; width: 100%; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: var(--safe-b);
}
.bottomnav a { text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; padding: 8px 0 9px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bottomnav a .ic { font-size: 20px; line-height: 1; }
.bottomnav a.on { color: var(--navy); }
.bottomnav a.on .ic { color: var(--gold); }

@media (min-width: 900px) {
  .bottomnav { display: none; }
  .side { display: block; width: 230px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 16px 10px; }
  .side a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: var(--text);
    text-decoration: none; font-weight: 600; margin-bottom: 2px; }
  .side a:hover { background: var(--bg); }
  .side a.on { background: var(--navy); color: #fff; }
  .side a.on .ic { color: var(--gold); }
  .side .sep { height: 1px; background: var(--line); margin: 10px 6px; }
  main { padding: 22px 26px 40px; }
}

/* ---------- Cards, forms ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 15px; color: var(--navy); }
h2.page { font-size: 20px; margin: 4px 0 14px; color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
label.f { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 10px 0 5px; }
.inp, select.inp, textarea.inp {
  width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 11px; padding: 11px 12px; outline: none;
  min-height: 44px; font-size: 16px;
}
textarea.inp { min-height: 84px; resize: vertical; }
.inp:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(19,38,92,.12); }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; cursor: pointer;
  border-radius: 11px; padding: 11px 16px; font-weight: 700; min-height: 44px; text-decoration: none;
  background: var(--navy); color: #fff; transition: transform .05s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn.danger { background: #fff; color: var(--lost); border: 1.5px solid #f3c4c4; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 7px 12px; font-size: 13.5px; border-radius: 9px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(circle at 20% 0%, #1b2f6b 0, var(--navy) 55%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 26px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-card .logo { width: 52px; height: 52px; border-radius: 14px; background: var(--gold); color: var(--navy); display: grid; place-items: center;
  font-weight: 800; font-size: 20px; margin-bottom: 12px; }
.login-card h1 { margin: 0; font-size: 21px; color: var(--navy); }
.login-card p { margin: 4px 0 8px; }

/* ---------- Leads list ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.toolbar .search { flex: 1; }
.toolbar select { flex: none; width: auto; max-width: 150px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 12px; font-weight: 700;
  font-size: 13px; cursor: pointer; display: flex; gap: 6px; align-items: center; color: var(--text); }
.chip .n { background: var(--bg); border-radius: 99px; padding: 0 7px; font-size: 12px; color: var(--muted); }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.on .n { background: var(--gold); color: var(--navy); }
.listmeta { display: flex; justify-content: space-between; align-items: center; margin: 2px 2px 8px; font-size: 12.5px; color: var(--muted); }
.listmeta select { border: 0; background: none; font-weight: 700; color: var(--navy); font-size: 12.5px; }
.lead { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 13px; padding: 12px 14px; margin-bottom: 8px;
  box-shadow: var(--shadow); cursor: pointer; text-decoration: none; color: inherit; }
.lead:active { background: #fafbff; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gold-soft); color: var(--navy); font-weight: 800;
  display: grid; place-items: center; flex: none; font-size: 15px; }
.lead .mid { flex: 1; min-width: 0; }
.lead .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead .ph { font-size: 13px; color: var(--muted); }
.lead .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.lead .right { text-align: right; font-size: 12px; color: var(--muted); flex: none; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.st-Lead { background: #e8f0fe; color: var(--lead); }
.st-Qualified { background: #fff5d6; color: var(--qual); }
.st-Converted { background: #e3f6e8; color: var(--conv); }
.st-Lost { background: #fde8e8; color: var(--lost); }
.tag.fu { background: #eef2ff; color: #4338ca; }
.tag.fu.due { background: #fde8e8; color: var(--lost); }
.fab { position: fixed; right: 18px; bottom: calc(78px + var(--safe-b)); width: 56px; height: 56px; border-radius: 50%;
  background: var(--gold); color: var(--navy); font-size: 30px; font-weight: 700; border: 0; box-shadow: 0 8px 20px rgba(10,25,64,.25);
  display: grid; place-items: center; text-decoration: none; z-index: 15; }
@media (min-width: 900px) { .fab { bottom: 28px; right: 28px; } }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }
.empty .big { font-size: 40px; }

/* ---------- Lead detail ---------- */
.lhead { display: flex; gap: 14px; align-items: center; }
.lhead .avatar { width: 54px; height: 54px; font-size: 20px; }
.lhead .nm { font-size: 19px; font-weight: 800; color: var(--navy); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stage-btn { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 2px; font-weight: 700; font-size: 13px; cursor: pointer; }
.stage-btn.on.s-Lead { background: var(--lead); color: #fff; border-color: var(--lead); }
.stage-btn.on.s-Qualified { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.stage-btn.on.s-Converted { background: var(--conv); color: #fff; border-color: var(--conv); }
.stage-btn.on.s-Lost { background: var(--lost); color: #fff; border-color: var(--lost); }
.note-meta { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 14px; }
.kv .k { color: var(--muted); }
.kv .v { word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.timeline .when { font-size: 12px; color: var(--muted); }

/* ---------- Range picker, tables ---------- */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 12px; font-weight: 700; cursor: pointer; font-size: 13.5px; }
.seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tbl-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
table.tbl th, table.tbl td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; white-space: nowrap; }
table.tbl th { color: var(--muted); font-weight: 700; font-size: 12px; }
.item { display: flex; gap: 10px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .mid { flex: 1; min-width: 0; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--text); font-weight: 600; }
.menu a:last-child { border-bottom: 0; }
.menu a .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--gold-soft); display: grid; place-items: center; font-size: 17px; }
.menu a .go { margin-left: auto; color: var(--muted); }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--gold); width: 0; transition: width .2s; }
.notice { background: var(--gold-soft); border: 1px solid #f6dd8e; color: #6b4e00; border-radius: 11px; padding: 10px 12px; font-size: 13px; }
.notice.red { background: #fde8e8; border-color: #f3c4c4; color: #8a1c1c; }

/* ---------- Toast + modal ---------- */
#toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
#toast div { background: var(--navy); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); text-align: center; }
#toast div.err { background: var(--lost); }
.modal-bg { position: fixed; inset: 0; background: rgba(10,25,64,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 460px; border-radius: 18px 18px 0 0; padding: 20px 18px calc(18px + var(--safe-b)); max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 6px; color: var(--navy); }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--navy); border-radius: 50%; animation: sp .8s linear infinite; margin: 30px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
.foot { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 20px; }

/* ---------- Phase 2: chats ---------- */
.nbadge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 99px; background: #e11d48; color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; }
.bottomnav a { position: relative; }
.bottomnav a .nbadge { position: absolute; top: 3px; left: calc(50% + 6px); margin: 0; }
.ubadge { display: inline-block; min-width: 20px; padding: 0 6px; margin-top: 6px; border-radius: 99px; background: #16a34a; color: #fff; font-size: 11.5px; font-weight: 800; line-height: 20px; text-align: center; }
.lead .ph.unread { color: var(--text); font-weight: 700; }
.lead .ph { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick.q3 { grid-template-columns: repeat(3, 1fr); }
.pre { white-space: pre-wrap; }
.linkbtn { background: none; border: 0; color: var(--navy-2); font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0 2px; font-size: 12.5px; }

main.chat-main { padding: 0; max-width: none; }
.chat-wrap { display: flex; flex-direction: column; height: calc(100dvh - 56px); max-width: 900px; margin: 0 auto; background: #efeae2; }
@media (min-width: 900px) { .chat-wrap { height: calc(100vh - 56px); border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
.chat-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.stage-pill { border: 0; border-radius: 99px; padding: 7px 12px; font-weight: 800; font-size: 13px; cursor: pointer; }
.msgs { flex: 1; overflow-y: auto; padding: 10px 10px 4px; -webkit-overflow-scrolling: touch; }
.day { text-align: center; margin: 10px 0; }
.day span { background: #fff; color: var(--muted); font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.msg { display: flex; margin: 3px 0; }
.msg.out { justify-content: flex-end; }
.bub { max-width: 82%; padding: 7px 9px 5px; border-radius: 10px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.08); font-size: 14.5px; }
.msg.out .bub { background: #fff3c4; }
.msg.in .bub { border-top-left-radius: 3px; }
.msg.out .bub { border-top-right-radius: 3px; }
.bub .txt { white-space: pre-wrap; word-break: break-word; }
.bub .meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.bub .tk { font-weight: 700; letter-spacing: -2px; margin-left: 2px; }
.bub .tk .read { color: #0ea5e9; }
.bub .err { font-size: 12px; color: var(--lost); margin-top: 4px; }
.att-img { display: block; max-width: 240px; max-height: 300px; border-radius: 7px; margin-bottom: 4px; background: #ddd; }
.att.doc { display: block; padding: 9px 10px; background: rgba(10,25,64,.05); border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; margin-bottom: 4px; word-break: break-all; }
#cbox { background: #fff; border-top: 1px solid var(--line); padding: 8px 10px calc(8px + var(--safe-b)); position: relative; }
.composer { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; border: 1.5px solid var(--line); border-radius: 20px; padding: 10px 14px; resize: none; outline: none; font-size: 16px; max-height: 140px; min-height: 42px; line-height: 1.35; }
.composer textarea:focus { border-color: var(--navy-2); }
.ibtn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--bg); font-size: 19px; cursor: pointer; flex: none; }
.sbtn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--navy); color: var(--gold); font-size: 19px; cursor: pointer; flex: none; }
.sbtn[disabled] { opacity: .5; }
.wnote { text-align: center; margin-top: 4px; font-size: 11px; }
.closed { text-align: center; color: var(--muted); font-size: 13px; padding: 8px 6px; }
.attchip { display: inline-flex; gap: 6px; align-items: center; background: var(--gold-soft); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; margin-bottom: 6px; max-width: 100%; overflow: hidden; }
.sugg { position: absolute; left: 10px; right: 10px; bottom: 100%; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 -6px 20px rgba(10,25,64,.12); max-height: 260px; overflow-y: auto; }
.sugg button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.sugg button:hover { background: var(--bg); }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); } .dash2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .dash2 .card { margin-bottom: 0; } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: inherit; text-decoration: none; display: block; }
.stat .sl { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.stat .sv { font-size: 26px; font-weight: 800; color: var(--navy); margin: 2px 0; }
.stat .sv .pct { font-size: 13px; font-weight: 800; background: var(--gold); color: var(--navy); border-radius: 99px; padding: 2px 8px; margin-left: 8px; vertical-align: middle; }
.stat .ss { font-size: 12px; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hb { display: grid; grid-template-columns: 90px 1fr 48px; align-items: center; gap: 8px; font-size: 14px; }
.hb-t { background: var(--bg); border-radius: 99px; height: 12px; overflow: hidden; }
.hb-f { height: 100%; border-radius: 99px; }
.hb-n { text-align: right; font-weight: 700; color: var(--navy); }
.dash2 { margin-bottom: 12px; }

/* Phase 4 */
.rule { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.rule.off { opacity: .55; }
.rule-h { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.rule-a { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.linkbtn.red { color: #C0392B; }
.row2 { display: flex; gap: 8px; align-items: flex-end; }
.row2 > * { flex: 1; min-width: 0; }
.row2 > .btn { flex: none; }
.tplprev { background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; margin: 8px 0; }
.tplbadge { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.small.warn, .warn { color: #9A6700; }
.notice.small { font-size: 13px; }

/* Phase 10 — Ads Performance */
.adtop { margin-bottom: 10px; }
.vt { display: inline-flex; background: var(--navy); border-radius: 99px; padding: 3px; margin-bottom: 8px; }
.vt button { border: 0; background: transparent; color: #fff; font-weight: 700; padding: 7px 14px; border-radius: 99px; cursor: pointer; font-size: 13px; }
.vt button.on { background: var(--gold); color: var(--navy); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 6px 0 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 13px; font-weight: 700; font-size: 13px; cursor: pointer; color: var(--navy); }
.tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.chip-s { display: inline-block; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 3px 9px; background: #EEF1F6; color: #5E6985; margin-left: 4px; white-space: nowrap; }
.chip-s.ok { background: #E6F3EA; color: #3A7D51; }
.chip-s.warn { background: #FDFAE9; color: #8A5A00; }
.chip-s.red { background: #FBE9E7; color: #B03A2E; }
.ocard { display: block; text-decoration: none; color: inherit; }
.ocard.paused, .card.paused { border: 1.5px solid #B03A2E !important; }
.oh { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.oh .on { font-weight: 700; min-width: 0; word-break: break-word; }
.chips2 { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: 4px; flex: none; }
.orow { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.orow b { color: var(--navy); }
.m8 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 12px; }
@media (min-width: 700px) { .m8 { grid-template-columns: repeat(4, 1fr); } .qgrid { grid-template-columns: repeat(4, 1fr) !important; } .libgrid { grid-template-columns: repeat(3, 1fr) !important; } }
.m8 .k, .qgrid .k { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
.m8 .v, .qgrid .v { font-size: 16px; font-weight: 800; color: var(--navy); }
.iline { margin-top: 10px; font-size: 12px; color: #B03A2E; background: #FBE9E7; border-radius: 10px; padding: 6px 10px; }
.qd summary { cursor: pointer; list-style: none; }
.qd summary::-webkit-details-marker { display: none; }
.qd[open] summary { margin-bottom: 10px; }
.funnel { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.fs .fl { display: flex; justify-content: space-between; font-size: 13px; }
.fb { background: var(--bg); border-radius: 99px; height: 14px; overflow: hidden; margin: 3px 0; }
.fb > div { height: 100%; background: var(--navy); border-radius: 99px; }
.fs:nth-child(4) .fb > div { background: var(--gold); }
.fs:nth-child(5) .fb > div { background: #3A7D51; }
.qgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 12px; margin-bottom: 10px; }
.stlist > div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tbadge { display: inline-block; font-size: 10px; font-weight: 800; color: #fff; border-radius: 99px; padding: 2px 7px; vertical-align: middle; }
.tbadge.v { background: #953E75; } .tbadge.i { background: #B26424; }
.sec { margin: 14px 2px 8px; font-size: 15px; color: var(--navy); }
.libgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lib { text-decoration: none; color: inherit; padding: 8px !important; }
.lib img, .lib .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.hdr { padding: 12px 14px !important; }
.tl { border-left: 3px solid var(--gold); padding: 4px 0 8px 10px; margin-bottom: 6px; font-size: 14px; }
.sep2 { border-top: 1px solid var(--line); margin: 10px 0; }
.trow { display: grid; grid-template-columns: 120px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.trow .k { color: var(--muted); }
.tnote { margin-top: 4px; font-size: 12px !important; padding: 6px 8px !important; }
.prev { max-width: 100%; max-height: 420px; border-radius: 12px; display: block; }
.ctext { font-size: 14px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.pre { white-space: pre-wrap; }
.dtag { display: inline-block; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 2px 8px; background: #EEF1F6; color: var(--navy); }
.d-Scale { background: #E6F3EA; color: #3A7D51; } .d-Keep { background: #E8EEFA; color: #3B5BA9; } .d-Watch { background: #FDFAE9; color: #8A5A00; }
.d-Pause { background: #FBE9E7; color: #B03A2E; } .d-Wait { background: #EEF1F6; color: #5E6985; }
.cmpick { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 14px; }
td.best { color: #3A7D51; background: #E6F3EA; font-weight: 800; }
.arow { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.ck { display: block; font-size: 14px; padding: 3px 0; }

/* ---- Follow-ups (P) + notifications (Q) ---- */
.tag.fu.today { background: #fff4d6; color: #8a5a00; }
.tag.ok { background: #e7f7ee; color: #137a3e; }
.chip .cnt { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: rgba(10,25,64,.1); font-size: 11px; }
.chip.on .cnt { background: rgba(255,255,255,.25); }
.fu-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.fu-k { background: #fff; border: 1px solid #e5e8ef; border-radius: 12px; padding: 10px; text-align: center; }
.fu-k b { display: block; font-size: 22px; color: #0A1940; }
.fu-k span { font-size: 12px; color: #6b7280; }
.fu-k.on { border-color: #FCB707; background: #fffaf0; }
.fu-k.red b { color: #c62828; }
.furow { background: #fff; border: 1px solid #e5e8ef; border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.fu-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.fu-name { font-weight: 700; color: #0A1940; text-decoration: none; }
.fu-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-w { font-size: 11px; color: #6b7280; text-align: center; padding: 2px 0; }
.cal-c { aspect-ratio: 1 / 1; border: 1px solid #eef0f4; border-radius: 8px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; padding: 0; color: #0A1940; }
.cal-c.empty { border: none; background: transparent; cursor: default; }
.cal-c b { font-size: 11px; background: #0A1940; color: #FCB707; border-radius: 8px; padding: 0 6px; margin-top: 2px; }
.cal-c.has.late b { background: #c62828; color: #fff; }
.cal-c.today { border: 2px solid #FCB707; }
.cal-c.sel { background: #0A1940; color: #fff; }
.tgl { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid #f0f2f6; }
.tgl input { margin-top: 4px; width: 18px; height: 18px; accent-color: #0A1940; }
.custom-r .row2 { align-items: flex-end; }
h3.sec { margin: 14px 2px 8px; font-size: 15px; color: #0A1940; }
.bottomnav { grid-template-columns: repeat(5, 1fr) !important; }
.bottomnav a { font-size: 10.5px; white-space: nowrap; }
#fuTabs { flex-wrap: wrap; }

/* ---- R. Client profile + branding ---- */
.topbar img.logo.img { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; background: #fff; display: block; box-shadow: 0 0 0 1.5px rgba(255,255,255,.45); flex: none; }
.login-card img.logo.img { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; background: #fff; display: block; margin: 0 auto 10px; box-shadow: 0 2px 10px rgba(10,25,64,.12); }
.prof-head { display: flex; gap: 14px; align-items: center; }
.prof-logo img, .prof-logo .logo.big { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; border: 1px solid #e5e8ef; background: #fff; }
.prof-logo .logo.big { display: grid; place-items: center; background: #FCB707; color: #0A1940; font-weight: 800; font-size: 28px; border: none; }
.prof-head .btn { margin: 0 6px 6px 0; }
.lg-edit { margin-top: 12px; border-top: 1px solid #eef0f4; padding-top: 12px; }
#lgPrev { display: flex; gap: 14px; align-items: center; }
.lg-c { width: 110px; height: 110px; border-radius: 18px; border: 1px solid #e5e8ef;
  background: repeating-conic-gradient(#f1f3f7 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.lg-c.round { border-radius: 50%; }
.pkv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f0f2f6; }
.pkv:last-child { border-bottom: none; }
.pkv span { color: #6b7280; font-size: 13px; }
.pkv b { text-align: right; font-weight: 600; word-break: break-word; }

/* ---- S. WhatsApp report ---- */
.dash-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.dash-top .chips { margin-bottom: 0; }
.dash-top #waRep { white-space: nowrap; margin-bottom: 12px; }
@media (min-width: 900px) { .rep-stats { grid-template-columns: repeat(2, 1fr) !important; max-width: 520px; } }
.rep-txt { font-family: inherit; font-size: 14px; line-height: 1.5; min-height: 260px; }
#rr { margin-bottom: 12px; }

/* ---- T1. Call recordings ---- */
.rec-item { border: 1px solid #eef0f4; border-radius: 12px; padding: 10px; margin-bottom: 8px; display: grid; gap: 6px; }
.rec-item audio { width: 100%; height: 38px; }
.rec-item .rec-del { justify-self: start; }
.rec-meta { display: flex; flex-direction: column; gap: 2px; }
.rec-calls { margin: 6px 0 4px; display: grid; gap: 4px; }
.rec-call { padding: 6px 8px; border-radius: 8px; background: #f6f7fb; }
.rec-call.pending { background: #fff4d6; }
.rec-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.rec-choice .btn { width: 100%; }
label.radio { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid #e5e8ef; border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
label.radio input { width: 18px; height: 18px; accent-color: #0A1940; }
.cp-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; border-top: 1px solid #eef0f4; padding-top: 10px; }
.rec-tip { margin: 8px 0; text-align: left; }
.rec-tip ul { margin: 6px 0; padding-left: 18px; }
.rec-tip li { margin: 3px 0; }
.tag.rec { background: #eef2ff; }
td.warn { color: #c62828; font-weight: 700; }
.prob.open { border-left: 4px solid #c62828; }
.prob.resolved { opacity: .75; }

/* ---- Ads drill-down path (always visible) ---- */
.crumbs { position: sticky; top: 56px; z-index: 15; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(10,25,64,.08); }
.cr-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cr-level { margin-left: auto; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cr-path { margin-top: 6px; font-size: 12px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.cr-path::-webkit-scrollbar { display: none; }
.cr-path a { color: var(--navy); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.cr-cur { color: var(--muted); }
.cr-sep { color: var(--muted); margin: 0 6px; }
@media (min-width: 900px) { .crumbs { top: 64px; } }

/* ---- Auto backup status ---- */
.bk { border-radius: 12px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; border: 1px solid; }
.bk.ok { background: #e9f8ef; border-color: #b9e6cb; color: #145c33; }
.bk.warn { background: #fff7e0; border-color: #f3dd9b; color: #7a5300; }
.bk.bad { background: #fdecec; border-color: #f2b8b8; color: #9b1c1c; }
/* U. Call outcome */
.tag.again { background: #fff4d6; color: #8a5a00; }
.oc-list { display: grid; gap: 8px; margin: 12px 0; }
.oc-opt { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; font-weight: 600; background: #fff; }
.oc-opt input { width: 20px; height: 20px; accent-color: #0A1940; flex: none; }
.oc-opt em { display: block; font-style: normal; font-weight: 500; font-size: 12px; color: var(--muted); }
.oc-opt:has(input:checked) { border-color: #0A1940; background: #f3f5fa; }
.oc-q { margin-top: 8px; }
.oc-pend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.oc-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.oc-mv { display: flex; flex-direction: column; gap: 4px; }
.oc-f { display: grid; gap: 6px; }
@media (min-width: 720px) { .oc-f { grid-template-columns: 1fr 1fr; } }
button.oc-hb { width: 100%; background: none; border: 0; padding: 6px 4px; border-radius: 8px; cursor: pointer; font: inherit; color: inherit; text-align: left; grid-template-columns: 130px 1fr 48px; }
button.oc-hb:hover, button.oc-hb.on { background: #f3f5fa; }
.oc-lh { margin-top: 14px; }
.row-sel { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.row-sel select { max-width: 260px; }
.modal [hidden] { display: none !important; }
