/* CRM look. Brand colours come from --brand (main) and --accent; the server sets them per installation
   (Settings > Branding), defaulting to the Credivo navy and gold.
   Layout: one centred column (max 820px), sticky light top bar, bottom tab bar on phones. */
:root {
  --brand: #24346e;
  --accent: #c9a24a;
  --navy: var(--brand);
  --navy-deep: color-mix(in srgb, var(--brand) 74%, #000);
  --green: #129252;
  --gold: var(--accent);

  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --text: #141a33;
  --text-2: #444b68;
  --muted: #6b7290;
  --line: #e3e6ef;
  --primary: var(--navy);
  --on-primary: #ffffff;
  --primary-soft: color-mix(in srgb, var(--brand) 10%, #fff);
  --gold-soft: color-mix(in srgb, var(--accent) 16%, #fff);
  --gold-ink: color-mix(in srgb, var(--accent) 58%, #000);
  --good: #129252;
  --good-soft: #e5f4ec;
  --warn: #b7791f;
  --warn-soft: #fbf1df;
  --red: #c8372d;
  --red-soft: #fbe9e7;
  --wa: #1fa855;
  --bubble-in: #ffffff;
  --bubble-out: #e3f3e9;
  --shadow: 0 1px 2px rgba(20, 26, 51, .05), 0 4px 16px rgba(20, 26, 51, .05);
  --shadow-lg: 0 10px 30px rgba(20, 26, 51, .14);
  --radius: 16px;
  --nav-h: 64px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1122;
    --surface: #141a30;
    --surface-2: #1b2340;
    --text: #e8ebf5;
    --text-2: #bcc3da;
    --muted: #8b93b0;
    --line: #263050;
    --primary: color-mix(in srgb, var(--brand) 45%, #fff);
    --on-primary: #0c1122;
    --primary-soft: color-mix(in srgb, var(--brand) 40%, #141a30);
    --gold-soft: color-mix(in srgb, var(--accent) 18%, #141a30);
    --gold-ink: color-mix(in srgb, var(--accent) 65%, #fff);
    --good: #35c27c;
    --good-soft: #15301f;
    --warn: #e3a94a;
    --warn-soft: #33270f;
    --red: #f06b61;
    --red-soft: #3a1c1a;
    --wa: #2ec66a;
    --bubble-in: #1b2340;
    --bubble-out: #173326;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1122; --surface: #141a30; --surface-2: #1b2340; --text: #e8ebf5; --text-2: #bcc3da; --muted: #8b93b0;
  --line: #263050; --primary: color-mix(in srgb, var(--brand) 45%, #fff); --on-primary: #0c1122;
  --primary-soft: color-mix(in srgb, var(--brand) 40%, #141a30); --gold-soft: color-mix(in srgb, var(--accent) 18%, #141a30); --gold-ink: color-mix(in srgb, var(--accent) 65%, #fff);
  --good: #35c27c; --good-soft: #15301f; --warn: #e3a94a; --warn-soft: #33270f; --red: #f06b61; --red-soft: #3a1c1a; --wa: #2ec66a;
  --bubble-in: #1b2340; --bubble-out: #173326; --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -.01em; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 24px; height: 24px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  min-height: 58px;
}
#topbar h1 { font-size: 17px; font-weight: 700; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
#brandMark { height: 30px; width: auto; max-width: 120px; object-fit: contain; display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #brandMark { content: url("/brand/mark_dark"); } }
:root[data-theme="dark"] #brandMark { content: url("/brand/mark_dark"); }
#whoami {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn {
  background: none; border: 0; color: var(--text); cursor: pointer; padding: 6px; margin-left: -6px;
  border-radius: 10px; display: flex; align-items: center;
}
.icon-btn:hover { background: var(--surface-2); }

#app { max-width: 820px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 28px); }

/* ---------- bottom tab bar ---------- */
#bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
}
#bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted); position: relative;
}
#bottomnav a > span { display: flex; align-items: center; justify-content: center; width: 52px; height: 28px; border-radius: 14px; transition: background .15s; }
#bottomnav a.active { color: var(--primary); }
#bottomnav a.active > span { background: var(--primary-soft); }
.badge {
  position: absolute; top: 4px; right: calc(50% - 26px);
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 6px;
  border: 2px solid var(--surface);
}

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 14px; border: 1px solid var(--line);
}
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 700; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 2px 10px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- buttons & inputs ---------- */
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: 12px; font-size: 14px; cursor: pointer; font-weight: 600; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; line-height: 1.2;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.call { background: var(--good); border-color: var(--good); color: #fff; }
.btn.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, var(--line)); background: var(--surface); }
.btn.ghost { background: var(--surface-2); border-color: transparent; }
.btn.small { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }

input, select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px;
  font-size: 15px; font-family: inherit; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
input[type="search"] { padding-left: 40px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236b7290' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 13px center; }
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 12px 0 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-2); font-family: inherit;
}
.chip.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip .n { opacity: .7; margin-left: 4px; }

/* Status: tinted pill with a dot; the label is always visible, so colour is never the only cue. */
.status {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  border-radius: 999px; padding: 3px 9px 3px 8px; white-space: nowrap;
  color: color-mix(in srgb, var(--c, #64748b) 80%, var(--text)); background: color-mix(in srgb, var(--c, #64748b) 14%, transparent);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c, #64748b); }

/* ---------- lead list ---------- */
.lead-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; transition: border-color .15s; }
.lead-item:hover { border-color: color-mix(in srgb, var(--primary) 25%, var(--line)); }
.lead-item .info { flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.lead-item .name { font-weight: 700; font-size: 15.5px; }
.lead-item .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.lead-item .meta span { display: inline-flex; align-items: center; gap: 4px; }
.lead-item .comment { font-size: 13px; color: var(--text-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.lead-item .actions { display: flex; flex-direction: column; gap: 8px; }
.lead-item .name { overflow-wrap: anywhere; line-height: 1.25; }
.round {
  width: 40px; height: 40px; border-radius: 12px; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.round.call { background: var(--good-soft); color: var(--good); }
.round.wa { background: color-mix(in srgb, var(--wa) 14%, transparent); color: var(--wa); }
.fu-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--warn); background: var(--warn-soft); border-radius: 8px; padding: 2px 8px; width: fit-content; }
.fu-chip.overdue { color: var(--red); background: var(--red-soft); }
.loan-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--gold-ink); }
.overdue { color: var(--red); font-weight: 600; }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; letter-spacing: .02em;
  background: color-mix(in srgb, var(--c, var(--navy)) 13%, var(--surface));
  color: color-mix(in srgb, var(--c, var(--navy)) 70%, var(--text));
  border: 1px solid color-mix(in srgb, var(--c, var(--navy)) 22%, transparent);
}
.avatar.lg { width: 58px; height: 58px; font-size: 21px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.card.profile-top { display: flex; }
.profile-actions .btn { padding: 12px 16px; }

/* ---------- dashboard ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 20px 18px 18px; margin-bottom: 8px; color: #fff;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ""; position: absolute; left: -12%; right: -12%; bottom: -74px; height: 90px; border-radius: 50%;
  border-top: 2px solid var(--gold); opacity: .6; pointer-events: none;
}
.hero .hello { font-size: 13px; opacity: .8; font-weight: 500; }
.hero h2 { margin: 2px 0 16px; font-size: 22px; font-weight: 800; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; position: relative; z-index: 1; }
.hero-stat {
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px;
  padding: 12px 10px; cursor: pointer; color: #fff; text-align: left; font-family: inherit;
}
.hero-stat:hover { background: rgba(255, 255, 255, .15); }
.hero-stat .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hero-stat .l { font-size: 12px; opacity: .85; margin-top: 4px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 600px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border-radius: 14px; padding: 13px 12px; cursor: pointer;
  box-shadow: var(--shadow); border: 1px solid var(--line); text-align: left; font-family: inherit; color: var(--text);
}
.stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.static { cursor: default; }

.pipeline { display: flex; flex-direction: column; }
.pipe-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 2px; border: 0; border-bottom: 1px solid var(--line);
  cursor: pointer; background: none; font: 600 14px var(--font); color: var(--text); text-align: left; width: 100%;
}
.pipe-row:last-child { border-bottom: 0; }
.pipe-row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.pipe-row .lbl { flex: 1; }
.pipe-row .cnt { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }
.pipe-row .pct { color: var(--muted); font-size: 12.5px; font-weight: 500; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.pipe-row .ico { color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.table-wrap { overflow-x: auto; }

/* ---------- lead page ---------- */
.profile { display: flex; flex-direction: column; gap: 14px; }
.profile-top { display: flex; gap: 14px; align-items: center; }
.profile .name { font-size: 20px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.profile .sub { color: var(--muted); font-size: 14px; display: flex; gap: 6px 12px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.profile .loanline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--gold-ink); background: var(--gold-soft); border-radius: 8px; padding: 4px 9px; width: fit-content; }
.profile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tabs {
  display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; margin: 0 0 14px;
  position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); z-index: 6; overflow-x: auto; scrollbar-width: none;
  border: 1px solid var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1; border: 0; background: none; padding: 9px 10px; border-radius: 10px; font: 600 13.5px var(--font); color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; font-size: 14px; align-items: center; }
.kv > div:nth-child(odd) { color: var(--muted); }
.kv > div:nth-child(even) { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 4px 0 16px 20px; border-left: 2px solid var(--line); position: relative; margin-left: 5px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--primary); border: 2px solid var(--surface);
}
.timeline li.t-call::before { background: var(--good); }
.timeline li.t-whatsapp::before { background: var(--wa); }
.timeline li.t-status::before, .timeline li.t-docs::before { background: var(--gold); }
.timeline .what { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.timeline .text { white-space: pre-wrap; margin-top: 3px; color: var(--text-2); }

.list-menu a, .list-menu button {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 14px 4px;
  border: 0; border-bottom: 1px solid var(--line); background: none; font: 600 15px var(--font); color: var(--text); cursor: pointer;
  text-align: left;
}
.list-menu a > span:last-child, .list-menu button > span:last-child { color: var(--muted); font-weight: 500; }
.list-menu .mi { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-weight: 600; }
.list-menu .mi .ico { color: var(--primary); }
.list-menu > :last-child { border-bottom: 0; }

/* ---------- modal & toast ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(12, 17, 34, .5); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center; animation: fadein .15s ease-out;
}
.modal-card {
  background: var(--surface); color: var(--text); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px)); box-shadow: var(--shadow-lg);
  animation: slideup .2s ease-out;
}
@media (min-width: 600px) { .modal { align-items: center; } .modal-card { border-radius: 22px; } }
.modal-card h2 { margin: 0 0 8px; font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@keyframes fadein { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(24px); opacity: .6; } }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px));
  background: #141a33; color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 60; font-size: 14px; font-weight: 500;
  max-width: 90vw; box-shadow: var(--shadow-lg);
}

/* ---------- login ---------- */
.login-wrap { max-width: 400px; margin: 8vh auto 0; }
.login-wrap .logo { text-align: center; margin-bottom: 22px; }
.login-wrap .logo img { width: 240px; max-width: 72%; height: auto; }
.login-wrap .tagline { color: var(--muted); font-size: 14px; margin-top: 8px; }
.login-wrap .card { padding: 22px; }
.login-wrap .card h2 { margin: 0; font-size: 20px; font-weight: 800; }
.gold-rule { height: 3px; width: 46px; border-radius: 3px; background: var(--gold); margin: 10px 0 4px; }
.logo-light { display: inline; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: inline; } }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline; }

.empty { text-align: center; padding: 36px 12px; color: var(--muted); }
.check { width: 20px; height: 20px; margin-top: 10px; flex: none; accent-color: var(--primary); }
.sticky-bar {
  position: sticky; bottom: calc(var(--nav-h) + 10px); background: var(--navy-deep); color: #fff;
  border-radius: 14px; padding: 10px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow-lg);
}
.sticky-bar select { width: auto; flex: 1; }

/* ---------- WhatsApp chats ---------- */
.chat-item { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.unread {
  background: var(--wa); color: #fff; border-radius: 12px; font-size: 12px; font-weight: 700;
  padding: 1px 7px; min-width: 20px; text-align: center; display: inline-block;
}
.unread-time { color: var(--wa); font-weight: 700; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px)); z-index: 15;
  width: 56px; height: 56px; border-radius: 18px; background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg);
}
.fab .ico { width: 26px; height: 26px; stroke-width: 2.2; }
.chat-sub {
  position: sticky; top: calc(58px + env(safe-area-inset-top, 0px)); z-index: 5; background: var(--bg); padding: 6px 0 10px; gap: 6px;
}
.msgs { display: flex; flex-direction: column; gap: 6px; padding-bottom: 120px; }
.bubble {
  max-width: 82%; padding: 8px 11px 6px; border-radius: 14px; box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
  word-wrap: break-word; overflow-wrap: anywhere; border: 1px solid var(--line);
}
.bubble.in { background: var(--bubble-in); align-self: flex-start; border-top-left-radius: 4px; }
.bubble.out { background: var(--bubble-out); align-self: flex-end; border-top-right-radius: 4px; border-color: transparent; }
.btext { white-space: pre-wrap; font-size: 15px; }
.bmeta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 3px; }
.small { font-size: 11px; }
.tk { color: #8696a0; letter-spacing: -3px; margin-left: 2px; }
.tk.read { color: #34b7f1; }
.tk.failed { color: var(--red); letter-spacing: 0; }
.media { max-width: 100%; max-height: 300px; border-radius: 10px; display: block; margin-bottom: 4px; }
.doc { display: flex; align-items: center; gap: 6px; padding: 9px; background: var(--surface-2); border-radius: 10px; margin-bottom: 4px; }
.day-sep { text-align: center; margin: 10px 0; }
.day-sep span { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px; }
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line);
}
.composer > * { max-width: 800px; margin: 0 auto; }
.composer .row { flex-wrap: nowrap; align-items: flex-end; }
.composer textarea { min-height: 44px; max-height: 140px; resize: none; padding: 11px 14px; border-radius: 22px; background: var(--surface-2); border-color: transparent; }
.composer #textRow .btn.small { width: 44px; height: 44px; padding: 0; border-radius: 50%; flex: none; }
#chSend { border-radius: 50%; width: 46px; height: 46px; padding: 0; flex: none; }
.win-bar { font-size: 13px; background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: 12px; padding: 10px 12px; }
.win-bar .btn { margin-top: 6px; }
.radio { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 15px; font-weight: 500; margin: 8px 0; }
.radio input { width: auto; accent-color: var(--primary); }
.steps { padding-left: 20px; line-height: 1.55; }
.steps li { margin-bottom: 8px; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }

/* ---------- loan details, reports, auto-reply ---------- */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.doc-chip {
  text-align: left; border: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent); background: var(--surface); color: var(--muted); border-radius: 12px;
  padding: 10px 11px; font: 600 13px var(--font); cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.doc-chip.done { border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); background: var(--good-soft); color: var(--good); }
.cibil { font-weight: 800; padding: 2px 9px; border-radius: 8px; }
.cibil.good { background: var(--good-soft); color: var(--good); }
.cibil.mid { background: var(--warn-soft); color: var(--warn); }
.cibil.bad { background: var(--red-soft); color: var(--red); }
.day-chip { display: inline-flex; align-items: center; gap: 4px; }
.day-chip input { width: auto; margin: 0; }

/* ---------- office PC documents ---------- */
.od-list { display: flex; flex-direction: column; }
.od-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.od-row:last-child { border-bottom: 0; }
.od-row .row.between { flex-wrap: nowrap; }
.od-row b { min-width: 0; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 6px; }
.od-row b.ok { color: var(--good); }
.od-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.od-file { position: relative; display: inline-flex; }
.od-file a { display: flex; flex-direction: column; align-items: center; width: 86px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface-2); }
.od-file img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.od-icon { display: flex; align-items: center; justify-content: center; height: 72px; color: var(--primary); }
.od-icon .ico { width: 34px; height: 34px; }
.od-name { font-size: 11px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; margin-top: 3px; }
.od-del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); background: var(--red); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.od-del .ico { width: 12px; height: 12px; stroke-width: 3; }
.save-office { margin-top: 6px; }
.ask-box { display: flex; align-items: center; gap: 12px; background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); border-radius: 14px; padding: 12px; margin: 4px 0 6px; }
.ask-box b { font-size: 14px; }
.warn-card { display: flex; align-items: center; gap: 12px; color: var(--text); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); background: var(--red-soft); }
.install-btn { margin-top: 14px; }
.install-card { display: flex; align-items: center; gap: 10px; border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); background: var(--primary-soft); }
.install-card > .ico { color: var(--primary); }
.install-card .grow { display: flex; flex-direction: column; }
.install-card .btn.ghost { width: 34px; height: 34px; padding: 0; }
.stale-card { margin-top: 12px; border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: var(--warn-soft); }
.stale-card > .ico { color: var(--warn); }
.auto-card label:first-of-type { margin-top: 14px; }
.auto-head { display: flex; gap: 12px; align-items: flex-start; }
.auto-head .grow { display: flex; flex-direction: column; gap: 3px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.rule-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.rule-row > :nth-child(3) { grid-column: 1; }
.rule-row .btn.small { justify-self: end; width: 40px; height: 40px; padding: 0; }
.rule-val > * { width: 100%; }
.today-box { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin: 12px 0 10px; font-size: 13.5px; }
.color-in { width: 46px; height: 44px; padding: 3px; flex: none; cursor: pointer; }
.warn-card > .ico { color: var(--red); }
.warn-card .grow { display: flex; flex-direction: column; }
.link-row { display: flex; align-items: center; gap: 8px; padding: 10px 2px; border-bottom: 1px dashed var(--line); }
.link-row .btn.small { width: 36px; height: 36px; padding: 0; }
.saved-office { margin-top: 6px; font-size: 13px; color: var(--good); background: var(--good-soft); border: 1px solid color-mix(in srgb, var(--good) 30%, transparent); border-radius: 10px; padding: 5px 9px; }
.link-btn { background: none; border: 0; padding: 0 0 0 4px; color: var(--primary); text-decoration: underline; cursor: pointer; font: 600 12px var(--font); }

/* send location */
.loc-list { display: flex; flex-direction: column; gap: 8px; }
.loc-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.loc-row .grow { min-width: 0; overflow-wrap: anywhere; }
.loc-row .btn { min-height: 44px; }
.check-line { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-weight: 500; min-height: 44px; }
.check-line input { width: 20px; height: 20px; flex: none; }
.assign-list { display: flex; flex-direction: column; }
.assign-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 2px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.assign-row:last-child { border-bottom: 0; }
.assign-row .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.assign-row .cnt { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.assign-row > .ico { color: var(--muted); }
.list-menu .push-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.list-menu .push-row .mi > span { display: flex; flex-direction: column; gap: 2px; font-weight: 500; }

/* scan physical papers */
.scan-cta { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); background: var(--primary-soft); }
.scan-cta > .ico:first-child { color: var(--primary); width: 26px; height: 26px; }
.scan-cta .grow { display: flex; flex-direction: column; gap: 2px; }
.scan-list { margin-top: 6px; }
.scan-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.scan-row .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.scan-row > .ico:last-child { color: var(--primary); }
.scan-head { gap: 10px; flex-wrap: nowrap; }
.scan-head .btn { flex: none; white-space: nowrap; }

/* edit a saved office photo */
.od-file { flex-direction: column; gap: 4px; }
.od-edit { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 86px; min-height: 32px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--primary); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.od-edit .ico { width: 13px; height: 13px; }
.od-view { margin: 12px 0; background: var(--surface-2); border-radius: 12px; display: flex; justify-content: center; align-items: center; min-height: 200px; overflow: hidden; }
.od-view img { max-width: 100%; max-height: 62vh; object-fit: contain; display: block; }

/* lead score, hot list, voice note */
.score-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--warn-soft); color: var(--gold-ink); white-space: nowrap; }
.score-chip.hi { background: var(--red-soft); color: var(--red); }
.hot-list { padding-top: 6px; padding-bottom: 10px; }
.hot-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.hot-row .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mic-wrap { display: inline-flex; align-items: center; gap: 4px; }
.mic-btn { min-height: 36px; }
.mic-btn.on { background: var(--red); color: #fff; border-color: var(--red); animation: micPulse 1.2s ease-in-out infinite; }
@keyframes micPulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--red) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .mic-btn.on { animation: none; } }
.mic-lang { min-width: 36px; min-height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.note-box { margin: 8px 0; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--text); font-size: 13.5px; line-height: 1.45; }

/* business words */
.list-edit { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.list-row, .field-row, .status-row { display: flex; align-items: center; gap: 8px; }
.list-row input, .field-row input { flex: 1; min-width: 0; }
.field-row, .status-row { margin-bottom: 8px; }
.status-row input { flex: 1; min-width: 0; }
.status-row .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.status-row .muted { flex: 0 0 34%; }

/* compliance calendar */
.comp-cta { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.comp-cta > .ico:first-child { color: var(--primary); }
.comp-cta .grow { display: flex; flex-direction: column; gap: 2px; }
.comp-list { padding-top: 4px; padding-bottom: 4px; }
.comp-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.comp-row:last-child { border-bottom: 0; }
.comp-row.done { opacity: .75; }
.comp-date { flex: none; width: 46px; text-align: center; border-radius: 12px; background: var(--surface-2); padding: 6px 0; line-height: 1.1; }
.comp-date b { display: block; font-size: 18px; }
.comp-date span { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.comp-row.late .comp-date { background: var(--red-soft); color: var(--red); }
.comp-row.late .comp-date span { color: var(--red); }
.comp-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.comp-info a { color: var(--text); text-decoration: none; }
.comp-acts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.plan-chip { display: inline-flex; align-items: center; gap: 6px; padding-right: 4px; }
.plan-x { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.plan-x:hover { background: var(--surface-2); color: var(--red); }

/* fees and billing */
.bill-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.bill-sum > div, .bill-cards .card { display: flex; flex-direction: column; gap: 2px; }
.bill-sum b, .bill-cards b { font-size: 18px; }
.bill-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.bill-cards .card { margin: 0; padding: 12px 14px; }
.ok { color: var(--good); }
.bill-list { padding-top: 2px; padding-bottom: 2px; }
.bill-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; padding: 10px 0; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.bill-row:last-child { border-bottom: 0; }
.bill-row .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bill-row .grow .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bill-amt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.item-head, .item-row { display: grid; grid-template-columns: 1fr 52px 88px 36px; gap: 6px; align-items: center; }
.item-row { margin-bottom: 6px; }
.item-row input { min-width: 0; padding-left: 8px; padding-right: 8px; }
.bill-total { margin: 12px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); text-align: right; }
.pay-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* ---------- computer (Windows / Mac): sidebar menu, wide pages ---------- */
#bottomnav .side-brand { display: none; }
#bottomnav a > span.nav-label { display: block; width: auto; height: auto; background: none; border-radius: 0; }
@media (max-width: 1023px) {
  .side-extra { display: none !important; }
  #bottomnav.chat-hide { display: none; }
}
@media (min-width: 1024px) {
  :root { --side-w: 236px; }
  body:has(#bottomnav:not(.hidden)) { padding-left: var(--side-w); }
  #bottomnav {
    top: 0; bottom: 0; right: auto; width: var(--side-w); height: auto; padding: 18px 12px;
    flex-direction: column; justify-content: flex-start; gap: 2px; overflow-y: auto;
    border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
  }
  #bottomnav .side-brand { display: flex; flex: none; align-items: center; padding: 2px 10px 18px; }
  #bottomnav a > span.nav-label { display: inline; width: auto; height: auto; border-radius: 0; white-space: nowrap; }
  #bottomnav a > span:first-child { flex: none; }
  .side-brand img { max-width: 160px; max-height: 44px; width: auto; height: auto; object-fit: contain; }
  #bottomnav a:not(.side-brand) {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px;
    padding: 0 12px; border-radius: 12px; font-size: 14.5px; font-weight: 600; color: var(--text-2);
  }
  #bottomnav a > span:first-child { width: auto; height: auto; background: none !important; }
  #bottomnav a:not(.side-brand):hover { background: var(--surface-2); color: var(--text); }
  #bottomnav a.active { background: var(--primary-soft); color: var(--primary); }
  #bottomnav a[data-nav="more"] { margin-top: auto; }
  #bottomnav .badge { position: static; margin-left: auto; border: 0; }
  #brandMark { display: none; }
  #topbar { padding-left: 32px; padding-right: 32px; }
  #app { max-width: 1180px; padding: 24px 32px 48px; }
  .toast { bottom: 28px; }
  .fab { right: 32px; bottom: 32px; }
  .sticky-bar { bottom: 16px; }
  .composer { left: var(--side-w); }
  .composer > * { max-width: 1000px; }
  .chat-sub { top: 58px; }
  /* lists use the width: cards side by side */
  #list { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; align-items: start; }
  #list > .card { margin: 0; }
  #list > .empty { grid-column: 1 / -1; }
  .lead-item:hover, .bill-row:hover, .comp-row:hover, .hot-row:hover { background: var(--surface-2); }
  .bill-row, .comp-row, .hot-row { padding-left: 8px; padding-right: 8px; border-radius: 10px; }
  .bill-cards { grid-template-columns: repeat(4, 1fr); }
  #leadForm .form-grid { grid-template-columns: repeat(3, 1fr); }
  .modal-card { max-width: 640px; }
  .kbd-hint { display: block; }
}
:root[data-theme="dark"] .side-brand img { content: url("/brand/logo_dark"); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .side-brand img { content: url("/brand/logo_dark"); } }
.kbd-hint { display: none; }
.fail-why { font-size: 12px; color: var(--red); margin-top: 4px; text-align: right; }
.fail-why:empty { display: none; }
