:root {
  --navy: #17325F; --navy2: #21427a; --amber: #F2A541; --amberText: #B8741A; --blue: #1F56B3; --blueSoft: #E8EFFB;
  --bg: #F3F5F8; --card: #fff; --text: #172033; --mute: #5D6778; --line: #E3E7ED; --green: #1E7F46; --greenSoft: #E6F4EC;
  --red: #BE3427; --redSoft: #FBEAE8; --warnSoft: #FDF3E3; --r: 14px;
  --top: env(safe-area-inset-top, 0px); --bot: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; font-size: 16px; color: var(--text);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
body { padding-bottom: calc(64px + var(--bot)); overscroll-behavior-y: none; }
body.bare { padding-bottom: 0; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.hd { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding: calc(var(--top) + 10px) 16px 12px; }
.hd .row1 { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.hd h1 { font-size: 20px; margin: 0; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd .back, .hd .ib { background: none; border: 0; color: #fff; padding: 6px; margin: -6px; display: flex; align-items: center; border-radius: 10px; }
.hd .back svg { width: 26px; height: 26px; }
.hd .sub { color: #c9d4e8; font-size: 13px; margin-top: 2px; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #dfe7f5; background: rgba(255,255,255,.1); border: 0; border-radius: 99px; padding: 5px 10px; }
.hd .sync.mini { padding: 6px; } .hd .sync.mini span { display: none; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: #5fd08b; display: inline-block; }
.sync.off i { background: #f5b74e; } .sync.bad i { background: #ff7a6b; } .sync.busy i { background: #9bb8ff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.search { margin-top: 10px; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14); border-radius: 12px; padding: 0 12px; }
.search svg { width: 18px; height: 18px; color: #c9d4e8; flex: none; }
.search input { flex: 1; border: 0; background: none; color: #fff; padding: 11px 0; outline: none; min-width: 0; }
.search input::placeholder { color: #b8c4da; }

/* layout */
.pg { padding: 14px 14px 24px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: 0 1px 2px rgba(16,24,40,.06); margin-bottom: 12px; overflow: hidden; }
.card > h2, .sec { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); margin: 0; padding: 14px 16px 6px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.sec a, .sec button, .card > h2 a, .card > h2 button { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; color: var(--blue); background: none; border: 0; padding: 0; }
.pad { padding: 12px 16px; }
.mute { color: var(--mute); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.empty { text-align: center; color: var(--mute); padding: 26px 20px; font-size: 15px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* list rows */
.list { list-style: none; margin: 0; padding: 0; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); min-height: 58px; color: inherit; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.list > :first-child > .li, .list > .li:first-child { border-top: 0; }
.li:active { background: #f0f3f7; }
.li .main { flex: 1; min-width: 0; }
.li .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .s { color: var(--mute); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.li .end { text-align: right; flex: none; font-size: 14px; color: var(--mute); }
.li .end b { color: var(--text); display: block; font-weight: 600; }
.chev { width: 18px; height: 18px; color: #b4bcc8; flex: none; }
.av { width: 40px; height: 40px; border-radius: 50%; background: var(--blueSoft); color: var(--blue); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex: none; }
.av.co { border-radius: 11px; background: #EEF0F4; color: var(--navy); }
.av.lg { width: 64px; height: 64px; font-size: 22px; }
.letter { position: sticky; top: calc(var(--top) + 110px); background: var(--bg); color: var(--mute); font-size: 12px; font-weight: 700; padding: 6px 18px; }

/* tags, pills */
.tag { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 99px; padding: 3px 9px; background: #EEF0F4; color: #3d4757; margin: 2px 4px 2px 0; }
.tag.lead { background: var(--warnSoft); color: #8a5a10; } .tag.won { background: var(--greenSoft); color: var(--green); } .tag.lost { background: var(--redSoft); color: var(--red); }
.tag.blue { background: var(--blueSoft); color: var(--blue); } .tag.hot { background: var(--redSoft); color: var(--red); }

/* checkbox for tasks */
.ck { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #b9c1cd; background: #fff; flex: none; display: flex; align-items: center; justify-content: center; padding: 0; }
.ck svg { width: 16px; height: 16px; stroke-width: 3; color: #fff; opacity: 0; }
.ck.on { background: var(--green); border-color: var(--green); } .ck.on svg { opacity: 1; }
.due { font-size: 13px; color: var(--mute); } .due.late { color: var(--red); font-weight: 600; } .due.now { color: var(--amberText); font-weight: 600; }
.done .t { text-decoration: line-through; color: var(--mute); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: var(--r); padding: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.06); color: inherit; }
.stat b { display: block; font-size: 22px; font-weight: 700; } .stat span { font-size: 12.5px; color: var(--mute); }
.stat.red b { color: var(--red); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 600; background: var(--blue); color: #fff; min-height: 48px; }
.btn:active { filter: brightness(.92); }
.btn.sec2 { background: #E9EDF3; color: var(--text); }
.btn.ghost { background: none; color: var(--blue); padding: 10px 12px; min-height: 40px; }
.btn.danger { background: var(--redSoft); color: var(--red); }
.btn.amber { background: var(--amber); color: #2b1d05; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; }
.btn svg { width: 20px; height: 20px; }
.ai-btn { background: linear-gradient(135deg, #1F56B3, #5a3fc0); }

/* contact hero */
.hero { background: var(--card); padding: 18px 16px 16px; text-align: center; border-radius: 0 0 22px 22px; box-shadow: 0 1px 2px rgba(16,24,40,.06); margin: -14px -14px 14px; }
.hero .av { margin: 0 auto 10px; }
.hero h2 { margin: 0; font-size: 22px; }
.hero .s { color: var(--mute); margin-top: 3px; }
.acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 5px; background: var(--blueSoft); color: var(--blue); border: 0; border-radius: 14px; padding: 11px 4px 9px; font-size: 12.5px; font-weight: 600; }
.act svg { width: 22px; height: 22px; }
.act.off { background: #F1F3F6; color: #a9b1bd; pointer-events: none; }
.acts2 { display: flex; gap: 8px; overflow-x: auto; margin: 12px -2px 0; padding: 0 2px 2px; scrollbar-width: none; }
.acts2::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 8px 13px; font-size: 14px; font-weight: 600; color: var(--text); }
.chip svg { width: 16px; height: 16px; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip .n { background: rgba(0,0,0,.07); border-radius: 99px; padding: 0 7px; font-size: 12px; }
.chip.on .n { background: rgba(255,255,255,.2); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 14px 10px; margin: 0 -14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

/* details */
.kv { display: flex; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); align-items: baseline; }
.kv:first-of-type { border-top: 0; }
.kv .k { width: 34%; color: var(--mute); font-size: 14px; flex: none; }
.kv .v { flex: 1; min-width: 0; word-break: break-word; }

/* timeline */
.tl { list-style: none; margin: 0; padding: 6px 16px 10px; }
.tl li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.tl li:first-child { border-top: 0; }
.tl .ic { width: 32px; height: 32px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: #EEF0F4; color: var(--navy); }
.tl .ic svg { width: 17px; height: 17px; }
.tl .ic.call { background: var(--greenSoft); color: var(--green); } .tl .ic.email { background: var(--blueSoft); color: var(--blue); }
.tl .ic.meeting { background: #F1ECFB; color: #5b3fb0; } .tl .ic.task { background: var(--warnSoft); color: var(--amberText); }
.tl .b { flex: 1; min-width: 0; }
.tl .h { font-weight: 600; font-size: 15px; } .tl .w { color: var(--mute); font-size: 12.5px; margin-top: 1px; }
.tl .x { margin-top: 4px; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; color: #2c3547; }
.tl .x.clip { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* AI */
.aicard { background: linear-gradient(135deg, #F2F6FF, #F6F1FF); border: 1px solid #DCE4F8; }
.aicard .pad > p { margin: 0 0 8px; line-height: 1.45; }
.aicard ul { margin: 6px 0 0; padding-left: 18px; } .aicard li { margin: 3px 0; }
.spark { color: #5a3fc0; }
.health { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.health.good { background: var(--greenSoft); color: var(--green); } .health.watch { background: var(--warnSoft); color: #8a5a10; } .health.at_risk { background: var(--redSoft); color: var(--red); }
.askbar { display: flex; gap: 8px; }
.askbar input { flex: 1; }
.metric { font-size: 30px; font-weight: 800; color: var(--navy); }
.loading { display: inline-block; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.loading.dark { border-color: #c8d0dc; border-top-color: var(--blue); }
@keyframes spin { to { transform: rotate(360deg); } }

/* forms */
.f { display: block; margin-bottom: 14px; }
.f > span { display: block; font-size: 13.5px; color: var(--mute); margin-bottom: 5px; font-weight: 600; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; border: 1px solid #d3d9e2; background: #fff; border-radius: 11px; padding: 12px 13px; font-size: 16px; outline: none; appearance: none; -webkit-appearance: none; min-height: 48px; }
select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235D6778' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 36px; }
textarea { min-height: 110px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,86,179,.15); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chk { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; }
.chk input { width: 22px; height: 22px; accent-color: var(--blue); }
.seg { display: flex; background: #E7EBF1; border-radius: 11px; padding: 3px; gap: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 9px 4px; font-weight: 600; font-size: 14px; color: var(--mute); }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* bottom sheet */
.scrim { position: fixed; inset: 0; background: rgba(10,18,35,.45); z-index: 60; opacity: 0; transition: opacity .2s; }
.scrim.in { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--bg); border-radius: 20px 20px 0 0; max-height: calc(100% - var(--top) - 24px); display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -8px 30px rgba(0,0,0,.15); }
.sheet.in { transform: none; }
.sheet .sh { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); background: #fff; border-radius: 20px 20px 0 0; }
.sheet .sh h3 { flex: 1; margin: 0; font-size: 17px; }
.sheet .grab { position: absolute; top: 5px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: #cfd5de; }
.sheet .sb { overflow-y: auto; padding: 16px 16px calc(16px + var(--bot)); -webkit-overflow-scrolling: touch; }
.sheet .sf { padding: 10px 16px calc(10px + var(--bot)); border-top: 1px solid var(--line); background: #fff; display: flex; gap: 10px; }
.sheet .sf .btn { flex: 1; }
.menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: #fff; border: 0; border-radius: 14px; padding: 14px; text-align: left; font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,.06); min-height: 86px; }
.menu .mbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: #fff; border-radius: 14px; padding: 14px; font-weight: 600; box-shadow: 0 1px 2px rgba(16,24,40,.06); min-height: 86px; }
.menu .mbtn small { font-weight: 400; color: var(--mute); font-size: 12.5px; } .menu .mbtn svg { color: #5a3fc0; }
.menu button svg { color: var(--blue); } .menu button small { font-weight: 400; color: var(--mute); font-size: 12.5px; }
.menu button.ai svg { color: #5a3fc0; }

/* tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + var(--bot)); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: #8a93a3; padding: 4px 0; }
.tabs a svg { width: 25px; height: 25px; }
.tabs a.on { color: var(--navy); }
.tabs a.on svg { color: var(--blue); }
.fab { position: fixed; right: 18px; bottom: calc(80px + var(--bot)); z-index: 31; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--amber); color: #2b1d05;
  box-shadow: 0 6px 16px rgba(242,165,65,.45), 0 2px 4px rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center; }
.fab svg { width: 28px; height: 28px; stroke-width: 2.6; }

.toast { position: fixed; left: 50%; top: calc(var(--top) + 64px); transform: translate(-50%, -12px); background: #1b2336; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14.5px;
  opacity: 0; transition: all .2s; pointer-events: none; z-index: 90; max-width: calc(100% - 32px); text-align: center; }
.toast.in { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); }
.banner { margin: 0 0 12px; padding: 11px 14px; border-radius: 12px; font-size: 14px; background: var(--warnSoft); color: #6d4708; }
.banner.bad { background: var(--redSoft); color: var(--red); }

/* deals */
.stagebar { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 4px; margin: 0 -14px 10px; scrollbar-width: none; }
.stagebar::-webkit-scrollbar { display: none; }
.stagebar .chip { flex-direction: column; align-items: flex-start; gap: 1px; border-radius: 12px; padding: 8px 12px; }
.stagebar .chip small { font-weight: 500; font-size: 12px; opacity: .8; }
.amt { font-weight: 700; color: var(--text); }
.steps { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.steps::-webkit-scrollbar { display: none; }
.steps button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 12px; font-size: 13.5px; font-weight: 600; color: var(--mute); }
.steps button.past { background: var(--blueSoft); color: var(--blue); border-color: transparent; }
.steps button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.big { font-size: 30px; font-weight: 800; margin: 2px 0; }
.rot { color: var(--red); font-size: 12.5px; font-weight: 600; }

/* pairing / welcome */
.welcome { min-height: 100vh; min-height: 100dvh; background: linear-gradient(170deg, #17325F 0%, #1d3e74 55%, #F3F5F8 55.1%); padding: calc(var(--top) + 40px) 20px 30px; }
.welcome .logo { display: flex; align-items: center; gap: 12px; color: #fff; font-size: 24px; font-weight: 800; }
.welcome .logo img { width: 52px; height: 52px; border-radius: 13px; }
.welcome h1 { color: #fff; font-size: 27px; margin: 26px 0 8px; line-height: 1.2; }
.welcome .lede { color: #cdd8ec; margin: 0 0 22px; line-height: 1.45; }
.welcome .card { padding: 18px; }
.welcome ol { padding-left: 20px; margin: 8px 0 0; line-height: 1.55; }
.welcome .or { text-align: center; color: var(--mute); font-size: 13px; margin: 16px 0; }
.lock { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--mute); margin-top: 14px; }
.lock svg { width: 18px; height: 18px; flex: none; color: var(--green); margin-top: 1px; }

@media (min-width: 700px) {
  body { max-width: 560px; margin: 0 auto; box-shadow: 0 0 0 1px var(--line); }
  .tabs, .sheet { max-width: 560px; margin: 0 auto; }
  .fab { right: calc(50% - 262px); }
}
@media (prefers-reduced-motion: reduce) { .sheet, .scrim, .toast { transition: none; } }
