@font-face{font-family:Sora;src:url(/fonts/sora-variable-latin.woff2) format("woff2");font-weight:100 800;font-display:swap}
@font-face{font-family:Inter;src:url(/fonts/inter-variable-latin.woff2) format("woff2");font-weight:100 900;font-display:swap}
:root{
  --navy:#0A2540;--navy2:#0F3052;--blue:#148CC6;--btn:#0C77AE;--btnh:#0A6696;--ice:#E8F4FB;--ice2:#D3EAF7;
  --y:#FFC72C;--yd:#E5A800;--ink:#0D1B2A;--text:#33404F;--muted:#5A6878;--line:#E2E8EE;--mist:#F4F7FA;--white:#fff;
  --ok:#11713A;--okbg:#DDF5E6;--bad:#B42318;--badbg:#FDE7E5;--warnbg:#FFF3CD;--warn:#7A5A00;
  --s-new:#148CC6;--s-quote_sent:#7A5AF8;--s-approved:#12B76A;--s-ready:#F79009;--s-completed:#0A2540;--s-lost:#98A2B3;
  --r:12px;--sh:0 1px 2px rgba(10,37,64,.06),0 2px 8px rgba(10,37,64,.05);
  --safe-b:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{background:var(--mist);font:15px/1.5 Inter,system-ui,-apple-system,Segoe UI,Arial,sans-serif;color:var(--text);-webkit-tap-highlight-color:transparent}
h1,h2,h3,h4{font-family:Sora,Inter,sans-serif;color:var(--navy);line-height:1.25;margin:0}
h1{font-size:22px}h2{font-size:18px}h3{font-size:16px}
a{color:var(--btn)}
svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:0 0 auto}
[hidden]{display:none!important}
.muted{color:var(--muted)}.small{font-size:13px}.nowrap{white-space:nowrap}.right{text-align:right}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.row.between{justify-content:space-between}.grow{flex:1 1 auto;min-width:0}
.stack>*+*{margin-top:12px}

/* ---- top bar */
.topbar{position:sticky;top:0;z-index:30;background:var(--navy);color:#fff;display:flex;align-items:center;gap:16px;padding:10px 16px;padding-top:max(10px,env(safe-area-inset-top));border-bottom:3px solid var(--y)}
.brand{display:flex;align-items:center;gap:8px;text-decoration:none;color:var(--y);font:700 13px Sora;letter-spacing:.08em}
.brand img{height:30px;width:auto}
.topnav{display:flex;gap:4px;margin-left:12px}
.topnav a{color:#C9D7E5;text-decoration:none;padding:8px 12px;border-radius:8px;font-weight:600}
.topnav a.on,.topnav a:hover{background:var(--navy2);color:#fff}
.topright{margin-left:auto;display:flex;align-items:center;gap:6px}
.iconbtn{position:relative;display:grid;place-items:center;width:40px;height:40px;border-radius:10px;border:0;background:transparent;color:#fff;cursor:pointer}
.iconbtn:hover{background:var(--navy2)}
.badge{position:absolute;top:3px;right:2px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--y);color:var(--navy);font:800 11px/18px Inter;text-align:center}
.avatar{width:36px;height:36px;border-radius:50%;border:2px solid var(--y);background:var(--blue);color:#fff;font:700 14px Sora;cursor:pointer}

/* ---- bottom nav (mobile) */
.bottomnav{display:none}
@media (max-width:820px){
  .topnav,#newLeadTop,.topbar .bell{display:none}
  .topbar{padding:8px 12px;padding-top:max(8px,env(safe-area-inset-top))}
  .bottomnav{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:30;background:#fff;border-top:1px solid var(--line);padding:6px 4px calc(6px + var(--safe-b));justify-content:space-around;align-items:center;box-shadow:0 -2px 12px rgba(10,37,64,.08)}
  .bottomnav a{position:relative;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11px;font-weight:600;color:var(--muted);text-decoration:none;padding:4px 10px;min-width:60px}
  .bottomnav a.on{color:var(--btn)}
  .bottomnav .badge{top:-2px;right:12px}
  .fab{width:54px;height:54px;border-radius:50%;border:0;background:var(--y);color:var(--navy);display:grid;place-items:center;margin-top:-26px;box-shadow:0 4px 14px rgba(229,168,0,.45);cursor:pointer}
  .fab svg{width:26px;height:26px;stroke-width:2.6}
  .view{padding-bottom:calc(86px + var(--safe-b))!important}
}

/* ---- layout */
.view{padding:18px 16px 40px;max-width:1500px;margin:0 auto}
.narrow{max-width:900px;margin:0 auto}
.card{background:#fff;border-radius:var(--r);box-shadow:var(--sh);padding:16px}
.card+.card{margin-top:14px}
.card h3{margin-bottom:10px}
.cardhead{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.cardhead h3{margin:0}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media (max-width:820px){.grid2{grid-template-columns:1fr}}
.pagehead{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.back{display:inline-flex;align-items:center;gap:4px;text-decoration:none;font-weight:600;color:var(--muted)}

/* ---- buttons & forms */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:42px;padding:9px 16px;border-radius:10px;border:1.5px solid transparent;background:var(--btn);color:#fff;font:600 15px Inter;cursor:pointer;text-decoration:none;white-space:nowrap}
.btn:hover{background:var(--btnh)}
.btn svg{width:18px;height:18px}
.btn.sec{background:#fff;color:var(--navy);border-color:#C9D4DF}.btn.sec:hover{background:var(--mist)}
.btn.y{background:var(--y);color:var(--navy)}.btn.y:hover{background:var(--yd)}
.btn.ok{background:var(--ok)}.btn.danger{background:#fff;color:var(--bad);border-color:#F4B4AE}.btn.danger:hover{background:var(--badbg)}
.btn.ghost{background:transparent;color:var(--btn);padding:6px 10px;min-height:34px}
.btn.sm{min-height:34px;padding:6px 12px;font-size:14px}
.btn.block{width:100%}
.btn:disabled{opacity:.55;cursor:default}
label.f{display:block;font-weight:600;color:var(--navy);font-size:13px;margin-bottom:4px}
.field{margin-bottom:12px}
input[type=text],input[type=email],input[type=tel],input[type=number],input[type=password],input[type=date],input[type=search],select,textarea{
  width:100%;font:inherit;font-size:16px;color:var(--ink);background:#fff;padding:10px 12px;border:1.5px solid #C9D4DF;border-radius:10px;outline:none;min-height:44px}
textarea{min-height:90px;resize:vertical}
textarea.code{font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;min-height:260px}
input:focus,select:focus,textarea:focus{border-color:var(--blue);box-shadow:0 0 0 3px var(--ice2)}
.check{display:flex;align-items:center;gap:8px;font-weight:500;cursor:pointer;margin:6px 0}
.check input{width:20px;height:20px}
.fgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:0 12px}
.hint{font-size:12.5px;color:var(--muted);margin-top:4px}

/* ---- kpis */
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-bottom:14px}
.kpi{background:#fff;border-radius:var(--r);box-shadow:var(--sh);padding:12px 14px}
.kpi b{display:block;font:700 22px Sora;color:var(--navy)}
.kpi span{font-size:12.5px;color:var(--muted);font-weight:600}
@media (max-width:820px){.kpis{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;margin:0 -16px 12px;padding:0 16px 4px}.kpi{flex:0 0 38%;scroll-snap-align:start;padding:9px 12px}.kpi b{font-size:18px}.kpi span{font-size:11.5px;line-height:1.3;display:block}}

/* ---- board */
.boardbar{display:flex;gap:10px;align-items:center;margin-bottom:12px;flex-wrap:wrap}
.boardbar input{max-width:340px}
.stagetabs{display:none}
.board{display:grid;grid-template-columns:repeat(6,minmax(210px,1fr));gap:12px;align-items:start;overflow-x:auto;padding-bottom:10px}
.col{background:#E9EEF3;border-radius:var(--r);display:flex;flex-direction:column;max-height:calc(100vh - 250px);min-height:200px}
.colhead{padding:12px 12px 8px;border-top:4px solid var(--c);border-radius:var(--r) var(--r) 0 0}
.colhead h3{font-size:14.5px;display:flex;justify-content:space-between;align-items:center}
.colhead .cnt{background:#fff;color:var(--navy);border-radius:99px;padding:1px 9px;font:700 12px Inter}
.colstats{display:flex;gap:10px;font-size:12px;color:var(--muted);margin-top:4px;flex-wrap:wrap}
.colstats b{color:var(--navy)}
.colbody{padding:4px 8px 10px;overflow-y:auto;flex:1;min-height:80px}
.lcard{background:#fff;border-radius:10px;padding:10px 12px;margin-top:8px;box-shadow:0 1px 2px rgba(10,37,64,.08);cursor:pointer;border-left:4px solid var(--c);user-select:none;-webkit-user-select:none;touch-action:pan-y}
.lcard:hover{box-shadow:0 2px 8px rgba(10,37,64,.14)}
.lcard .nm{font-weight:700;color:var(--ink);display:flex;justify-content:space-between;gap:6px}
.lcard .nm span:last-child{font-weight:700;color:var(--navy);white-space:nowrap}
.lcard .sub{font-size:13px;color:var(--muted);margin-top:2px}
.lcard .tags{display:flex;gap:5px;flex-wrap:wrap;margin-top:6px}
.tag{display:inline-flex;align-items:center;gap:3px;font-size:11.5px;font-weight:700;padding:2px 7px;border-radius:6px;background:var(--mist);color:var(--muted)}
.tag.blue{background:var(--ice);color:var(--btn)}.tag.green{background:var(--okbg);color:var(--ok)}.tag.amber{background:var(--warnbg);color:var(--warn)}.tag.red{background:var(--badbg);color:var(--bad)}.tag.purple{background:#EEE9FE;color:#5B3FD6}
.sortable-ghost{opacity:.35}.sortable-chosen{box-shadow:0 8px 24px rgba(10,37,64,.25)!important}
.sortable-drag{transform:rotate(2deg)}
.empty{font-size:13px;color:var(--muted);text-align:center;padding:16px 6px}
@media (max-width:820px){
  .stagetabs{display:flex;gap:6px;overflow-x:auto;margin:0 -16px 10px;padding:0 16px 4px;scrollbar-width:none}
  .stagetabs button{flex:0 0 auto;border:0;border-radius:99px;padding:7px 12px;font:600 13px Inter;background:#fff;color:var(--navy);box-shadow:var(--sh);display:flex;gap:6px;align-items:center}
  .stagetabs button i{width:8px;height:8px;border-radius:50%;background:var(--c)}
  .stagetabs button.on{background:var(--navy);color:#fff}
  .board{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;margin:0 -16px;padding:0 16px 10px;gap:10px;scrollbar-width:none}
  .col{flex:0 0 86vw;scroll-snap-align:center;max-height:calc(100vh - 290px - var(--safe-b))}
}

/* ---- lead page */
.leadhead{display:flex;gap:12px;align-items:flex-start;justify-content:space-between;flex-wrap:wrap}
.stagepill{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:99px;background:var(--mist);font-weight:700;font-size:13px;color:var(--navy)}
.stagepill i{width:9px;height:9px;border-radius:50%;background:var(--c)}
.actions{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:14px 0}
.actions a,.actions button{display:flex;flex-direction:column;align-items:center;gap:4px;padding:10px 4px;border-radius:12px;background:#fff;box-shadow:var(--sh);color:var(--navy);font-weight:600;font-size:12.5px;text-decoration:none;border:0;cursor:pointer}
.actions svg{color:var(--btn)}
.dl{display:grid;grid-template-columns:120px 1fr;gap:6px 12px;font-size:14px}
.dl dt{color:var(--muted);font-weight:600}.dl dd{margin:0;color:var(--ink);word-break:break-word}
@media (max-width:520px){.dl{grid-template-columns:96px 1fr}}
.qrow{display:flex;gap:10px;align-items:center;padding:10px 0;border-top:1px solid var(--line);flex-wrap:wrap}
.qrow:first-of-type{border-top:0}
.photos{display:grid;grid-template-columns:repeat(auto-fill,minmax(96px,1fr));gap:8px}
.photos .ph{position:relative;aspect-ratio:1;border-radius:10px;overflow:hidden;background:var(--mist)}
.photos img{width:100%;height:100%;object-fit:cover;display:block;cursor:zoom-in}
.photos .del{position:absolute;top:4px;right:4px;width:28px;height:28px;border-radius:50%;border:0;background:rgba(10,37,64,.75);color:#fff;font-size:16px;line-height:28px;cursor:pointer}
.upload{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;aspect-ratio:1;border-radius:10px;border:2px dashed #9FB3C6;color:var(--btn);font-weight:600;font-size:12.5px;cursor:pointer;text-align:center;padding:6px}
.timeline{list-style:none;margin:0;padding:0}
.timeline li{position:relative;padding:0 0 14px 22px;font-size:14px}
.timeline li:before{content:"";position:absolute;left:5px;top:7px;width:8px;height:8px;border-radius:50%;background:var(--blue)}
.timeline li:after{content:"";position:absolute;left:8.5px;top:17px;bottom:0;width:1px;background:var(--line)}
.timeline li.note:before{background:var(--y)}.timeline li.signed:before{background:#12B76A}.timeline li.viewed:before{background:#7A5AF8}.timeline li.complete:before{background:var(--navy)}
.timeline .when{font-size:12px;color:var(--muted)}
.timeline .msg{white-space:pre-line;color:var(--ink)}
.completebar{background:linear-gradient(90deg,var(--navy),var(--navy2));color:#fff;border-radius:var(--r);padding:14px 16px;display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:14px}
.completebar h3{color:#fff}

/* ---- quote editor */
.item{border:1.5px solid var(--line);border-radius:12px;padding:12px;margin-bottom:10px;background:#fff}
.item .ihead{display:flex;gap:8px;align-items:center;margin-bottom:8px}
.item .ihead input{font-weight:600}
.dims3{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.dims3 label{font-size:12px;font-weight:700;color:var(--navy);display:block;margin-bottom:3px}
.dims3 input{padding:9px 10px}
@media (max-width:520px){.dims3{grid-template-columns:1fr 1fr 1fr .7fr;gap:6px}.dims3 label{font-size:11px}.dims3 input{padding:8px 6px}}
.calc{display:flex;flex-wrap:wrap;gap:6px 14px;margin-top:10px;font-size:13px;color:var(--muted)}
.calc b{color:var(--navy)}
.calc .amt{margin-left:auto;font:700 17px Sora;color:var(--navy)}
.xbtn{border:0;background:transparent;color:var(--muted);width:36px;height:36px;border-radius:8px;cursor:pointer;font-size:20px;flex:0 0 36px}
.xbtn:hover{background:var(--badbg);color:var(--bad)}
.totals{position:sticky;bottom:0;z-index:5;background:#fff;border-top:3px solid var(--y);border-radius:var(--r) var(--r) 0 0;box-shadow:0 -4px 16px rgba(10,37,64,.1);padding:12px 16px;margin:14px -16px -40px;display:flex;align-items:center;gap:12px;flex-wrap:wrap}
@media (max-width:820px){.totals{bottom:calc(66px + var(--safe-b));margin-bottom:0;border-radius:0}}
.totals .t{font:700 22px Sora;color:var(--navy)}
.totals .tsub{font-size:12.5px;color:var(--muted)}
.locked{background:var(--okbg);color:var(--ok);border-radius:10px;padding:10px 12px;font-weight:600;margin-bottom:12px}
.diagram{max-width:280px;width:100%}

/* ---- find */
.seg{display:inline-flex;background:#E9EEF3;border-radius:10px;padding:3px}
.seg button{border:0;background:transparent;padding:8px 14px;border-radius:8px;font:600 14px Inter;color:var(--muted);cursor:pointer}
.seg button.on{background:#fff;color:var(--navy);box-shadow:var(--sh)}
.rlist .ri{display:flex;gap:12px;align-items:center;padding:12px 0;border-top:1px solid var(--line)}
.rlist .ri:first-child{border-top:0}
.dist{flex:0 0 58px;text-align:center;font:700 16px Sora;color:var(--navy)}.dist small{display:block;font:600 11px Inter;color:var(--muted)}
.ri .acts{display:flex;gap:6px}
.ri .acts a{display:grid;place-items:center;width:40px;height:40px;border-radius:10px;background:var(--ice);color:var(--btn)}

/* ---- alerts */
.nlist .n{display:flex;gap:10px;padding:12px 4px;border-top:1px solid var(--line);text-decoration:none;color:var(--ink);align-items:flex-start}
.nlist .n:first-child{border-top:0}
.nlist .n.unread{background:var(--ice);border-radius:10px;padding-left:10px}
.nlist .dot{width:10px;height:10px;border-radius:50%;margin-top:6px;background:var(--c,var(--blue));flex:0 0 10px}

/* ---- settings */
.tabs{display:flex;gap:4px;overflow-x:auto;border-bottom:1px solid var(--line);margin-bottom:14px;scrollbar-width:none}
.tabs button{border:0;background:transparent;padding:10px 14px;font:600 14px Inter;color:var(--muted);border-bottom:3px solid transparent;cursor:pointer;white-space:nowrap}
.tabs button.on{color:var(--navy);border-bottom-color:var(--y)}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0 10px}
.chips button{border:1px solid var(--ice2);background:var(--ice);color:var(--btn);border-radius:7px;padding:3px 8px;font:600 12px ui-monospace,Menlo,monospace;cursor:pointer}
iframe.preview{width:100%;height:560px;border:1px solid var(--line);border-radius:10px;background:#fff}
.radio{display:flex;gap:10px;align-items:flex-start;padding:10px 12px;border:1.5px solid var(--line);border-radius:10px;margin-bottom:8px;cursor:pointer}
.radio input{margin-top:3px;width:18px;height:18px}
.radio.on{border-color:var(--blue);background:var(--ice)}
.utable{width:100%;border-collapse:collapse;font-size:14px}.utable td,.utable th{padding:9px 6px;border-top:1px solid var(--line);text-align:left}
.codebox{font:13px ui-monospace,Menlo,monospace;background:var(--navy);color:#E8F4FB;border-radius:10px;padding:12px;overflow-x:auto;white-space:pre}

/* ---- modal / toast */
.mback{position:fixed;inset:0;z-index:60;background:rgba(10,37,64,.55);display:flex;align-items:center;justify-content:center;padding:16px;animation:fade .15s}
.modal{background:#fff;border-radius:16px;width:100%;max-width:560px;max-height:calc(100vh - 32px);display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0,0,0,.3)}
.modal.wide{max-width:900px}
.mhead{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid var(--line)}
.mbody{padding:16px;overflow-y:auto}
.mfoot{display:flex;gap:8px;justify-content:flex-end;padding:12px 16px;border-top:1px solid var(--line);flex-wrap:wrap}
@media (max-width:620px){.mback{align-items:flex-end;padding:0}.modal{border-radius:16px 16px 0 0;max-height:94vh;padding-bottom:var(--safe-b)}.mfoot .btn{flex:1}}
@keyframes fade{from{opacity:0}}
.toasts{position:fixed;z-index:80;top:max(14px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);display:flex;flex-direction:column;gap:8px;width:min(440px,calc(100vw - 24px))}
.toast{background:var(--navy);color:#fff;border-radius:12px;padding:12px 14px;box-shadow:0 8px 28px rgba(0,0,0,.25);font-weight:600;display:flex;gap:10px;align-items:center;animation:fade .2s;cursor:pointer}
.toast.err{background:var(--bad)}.toast.ok{background:var(--ok)}
.toast.alert{background:#fff;color:var(--navy);border-left:5px solid var(--y)}
.lightbox{position:fixed;inset:0;z-index:90;background:rgba(0,0,0,.92);display:flex;align-items:center;justify-content:center}
.lightbox img{max-width:96vw;max-height:92vh;border-radius:6px}

/* ---- auth */
.auth{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;background:var(--navy) url() center/cover}
.authcard{background:#fff;border-radius:18px;padding:28px 24px;width:100%;max-width:400px;box-shadow:0 20px 60px rgba(0,0,0,.3);border-top:6px solid var(--y)}
.authcard img{height:44px;margin-bottom:14px}
.authcard h1{margin-bottom:6px}
.err{color:var(--bad);font-weight:600;font-size:14px;min-height:20px;margin-top:8px}
.spinner{width:28px;height:28px;border:3px solid var(--ice2);border-top-color:var(--btn);border-radius:50%;animation:spin .8s linear infinite;margin:40px auto}
@keyframes spin{to{transform:rotate(360deg)}}
