:root{--navy:#0D1B2E;--navy2:#1A2A42;--teal:#0891B2;--teal2:#14B8A6;--gold:#D97706;--ok:#059669;--red:#DC2626;--bg:#F8FAFC;--card:#fff;--line:#E2E8F0;--tx:#0F172A;--mut:#64748B;--alt:#F8FAFC}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:"Segoe UI",system-ui,-apple-system,Roboto,sans-serif;font-size:14px;color:var(--tx);background:var(--bg);-webkit-text-size-adjust:100%}
.hidden{display:none!important}
.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.muted{color:var(--mut)}.small{font-size:12px}.mono{font-family:"JetBrains Mono",Consolas,monospace}
.ok-text{color:var(--ok);font-weight:600}
.ico{width:26px;height:26px;fill:currentColor;flex:none}.ico-s{width:16px;height:16px;fill:currentColor;vertical-align:-3px}
button{font:inherit;cursor:pointer}
.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:14px 16px;margin:0 0 12px}
.card-title{font-weight:700;font-size:13px;margin:0 0 8px;color:var(--navy)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--line);background:#fff;color:var(--tx);border-radius:8px;padding:8px 14px;font-weight:600;min-height:38px;transition:transform .08s,background .15s}
.btn:active{transform:scale(.97)}.btn:hover{background:#F1F5F9}
.btn-primary{background:var(--teal);border-color:var(--teal);color:#fff}.btn-primary:hover{background:#0E7490}
.btn-danger{background:#fff;border-color:#FCA5A5;color:var(--red)}.btn-danger:hover{background:#FEF2F2}
.btn-ghost{background:transparent}.btn-s{padding:4px 10px;min-height:30px;font-size:12px}
.btn[disabled],.btn-big[disabled]{opacity:.5;cursor:not-allowed}
.inp{width:100%;border:1px solid #CBD5E1;border-radius:8px;padding:10px 12px;font:inherit;background:#fff;min-height:42px}
.inp:focus{outline:none;border-color:var(--teal);box-shadow:0 0 0 3px rgba(8,145,178,.15)}
.fld{display:block;margin:10px 0 0}.fld-l{display:block;font-size:12px;font-weight:600;color:var(--mut);margin-bottom:4px}
.pill{display:inline-block;padding:2px 10px;border-radius:999px;font-size:11px;font-weight:700}
.pill-ok{background:#D1FAE5;color:#065F46}.pill-wait{background:#FEF3C7;color:#92400E}.pill-late{background:#FEE2E2;color:#991B1B}.pill-info{background:#CFFAFE;color:#155E75}.pill-gray{background:#E2E8F0;color:#334155}
.row{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 0;border-bottom:1px solid var(--line)}.row:last-child{border-bottom:0}
.toast{position:fixed;left:50%;bottom:calc(20px + env(safe-area-inset-bottom));transform:translateX(-50%);background:var(--navy);color:#fff;padding:12px 18px;border-radius:10px;font-weight:600;z-index:50;max-width:90vw;box-shadow:0 8px 24px rgba(0,0,0,.25)}
.hint{margin-top:10px;background:#FFFBEB;border:1px solid #FDE68A;color:#92400E;padding:8px 10px;border-radius:8px;font-size:12px}
.steps{padding-left:20px;line-height:1.7}

/* ---------- client portal ---------- */
body.portal{padding-bottom:40px}
.p-head{background:var(--navy);color:#fff;padding:calc(14px + env(safe-area-inset-top)) 16px 14px}
.p-brand{display:flex;align-items:center;gap:12px;max-width:560px;margin:0 auto}
.p-logo{width:40px;height:40px;border-radius:10px;background:var(--teal);display:grid;place-items:center;font-weight:800;font-size:20px}
.p-firm{font-weight:700;font-size:15px}.p-who{font-size:12px;opacity:.75}
.p-main{max-width:560px;margin:0 auto;padding:16px}
.p-title{font-size:22px;margin:4px 0 6px}.p-sub{color:var(--mut);margin:0 0 16px;line-height:1.5}
.p-fatal{border-color:#FCA5A5;background:#FEF2F2;color:#991B1B;font-weight:600;text-align:center;padding:24px}
.btn-big{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:64px;border-radius:14px;font-size:17px;font-weight:700;border:2px solid var(--teal);margin:0 0 12px;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}
.btn-big.btn-primary{background:var(--teal);color:#fff}.btn-big.btn-ghost{background:#fff;color:var(--teal)}
.draft-top{display:flex;gap:12px;align-items:center}.draft-meta{flex:1;min-width:0}.draft-name{font-weight:700}
.thumb{width:64px;height:84px;object-fit:cover;border-radius:6px;border:1px solid var(--line);background:#F1F5F9}
.thumb-pdf{display:grid;place-items:center;font-weight:800;color:var(--mut)}

/* ---------- office app ---------- */
.auth{min-height:100vh;display:grid;place-items:center;padding:16px;background:linear-gradient(135deg,var(--navy),var(--navy2))}
.auth-card{width:100%;max-width:400px;background:#fff;border-radius:16px;padding:28px}
.auth-logo{display:flex;align-items:center;gap:10px;margin-bottom:14px}.auth-logo .p-logo{color:#fff}
.auth h1{font-size:20px;margin:0 0 4px}.auth .btn-primary{width:100%;margin-top:16px;min-height:44px}
.err{color:var(--red);font-size:13px;margin-top:10px;font-weight:600;min-height:18px}
.qr{display:block;margin:10px auto;width:200px;height:200px;image-rendering:pixelated}
.secret{font-family:Consolas,monospace;font-size:15px;letter-spacing:2px;word-break:break-all;background:#F1F5F9;padding:8px;border-radius:8px;text-align:center}
.codes{display:grid;grid-template-columns:1fr 1fr;gap:6px;font-family:Consolas,monospace;margin:10px 0}.codes div{background:#F1F5F9;padding:6px;border-radius:6px;text-align:center}
.shell{display:grid;grid-template-columns:230px 1fr;min-height:100vh}
.side{background:var(--navy);color:#CBD5E1;padding:16px 0;position:sticky;top:0;height:100vh;display:flex;flex-direction:column}
.side .brand{display:flex;gap:10px;align-items:center;padding:0 16px 16px;color:#fff;font-weight:700}
.side .brand .p-logo{width:34px;height:34px;font-size:17px}
.nav{display:block;width:100%;text-align:left;background:none;border:0;border-left:4px solid transparent;color:#CBD5E1;padding:11px 16px;font-size:13px}
.nav:hover{background:var(--navy2)}.nav.on{background:var(--navy2);border-left-color:var(--teal2);color:#fff;font-weight:700}
.side .who .btn{color:#fff;border-color:#3B5170;margin-top:8px}.side .who .btn:hover{background:var(--navy2)}
.pill+.pill{margin-left:6px}
.side .sp{flex:1}.side .who{padding:12px 16px;font-size:12px;border-top:1px solid #243650}
.main{padding:20px 24px 50px;min-width:0}
.page-h{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px;border-bottom:2px solid var(--teal);padding-bottom:8px}
.page-h h2{margin:0;font-size:18px}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin-bottom:14px}
.kpi{background:#fff;border:1px solid var(--line);border-radius:12px;padding:14px;border-top:3px solid var(--teal)}
.kpi b{display:block;font-size:26px;font-family:"JetBrains Mono",Consolas,monospace}.kpi span{font-size:12px;color:var(--mut)}
.kpi.warn{border-top-color:var(--gold)}.kpi.bad{border-top-color:var(--red)}.kpi.good{border-top-color:var(--ok)}
.alert{background:#FEF2F2;border:1px solid #FECACA;color:#991B1B;border-radius:10px;padding:10px 14px;margin-bottom:12px;font-weight:600}
.alert.info{background:#ECFEFF;border-color:#A5F3FC;color:#155E75}
table{width:100%;border-collapse:collapse;background:#fff;border:1px solid var(--line);border-radius:10px;overflow:hidden}
th{background:var(--navy);color:#fff;text-align:left;font-size:12px;padding:9px 10px}
td{padding:9px 10px;border-top:1px solid var(--line);font-size:13px;vertical-align:middle}
tbody tr:nth-child(odd){background:var(--alt)}tr.late{background:#FEF2F2!important}
.tbl-wrap{overflow-x:auto}
.toolbar{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}.toolbar .inp{max-width:260px}
.empty{text-align:center;color:var(--mut);padding:30px}
.modal-bg{position:fixed;inset:0;background:rgba(15,23,42,.55);display:grid;place-items:center;padding:16px;z-index:40}
.modal{background:#fff;border-radius:14px;padding:20px;width:100%;max-width:520px;max-height:92vh;overflow:auto}
.modal.wide{max-width:900px}.modal h3{margin:0 0 8px}
.split{display:grid;grid-template-columns:1fr 1fr;gap:16px}.split img{width:100%;border:1px solid var(--line);border-radius:8px}
.linkbox{font-family:Consolas,monospace;font-size:12px;background:#F1F5F9;padding:8px;border-radius:8px;word-break:break-all}
.statusbar{position:fixed;left:230px;right:0;bottom:0;background:var(--navy);color:#CBD5E1;font-size:11px;padding:4px 14px}
@media(max-width:820px){.shell{grid-template-columns:1fr}.side{position:static;height:auto;flex-direction:row;overflow-x:auto;padding:0}.side .brand,.side .who,.side .sp{display:none}.nav{border-left:0;border-bottom:3px solid transparent;white-space:nowrap}.nav.on{border-bottom-color:var(--teal2)}.split{grid-template-columns:1fr}.main{padding:14px}.statusbar{left:0}}
.btn-wide{width:100%;margin-top:14px;min-height:46px}

.tbl-wrap + .toolbar,.tbl-wrap + p + .toolbar{margin-top:14px}

/* ===== Identity + motion (v2.1) ===== */
.p-logo{background:url(/brand/logo_icon_160.png?v=3) center/contain no-repeat;border-radius:12px;font-size:0;color:transparent;box-shadow:0 4px 16px rgba(217,119,6,.35);animation:logoBreath 5s ease-in-out infinite}
.auth-logo{flex-direction:column;text-align:center;gap:8px}.auth-logo .p-logo{width:120px;height:120px;border-radius:24px}
@keyframes logoBreath{0%,100%{transform:scale(1)}50%{transform:scale(1.05)}}
@keyframes rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
@keyframes fade{from{opacity:0}to{opacity:1}}
@keyframes pop{0%{opacity:0;transform:scale(.92) translateY(10px)}100%{opacity:1;transform:none}}
@keyframes shim{0%{background-position:-400px 0}100%{background-position:400px 0}}
@keyframes spin{to{transform:rotate(360deg)}}
@keyframes drift{0%,100%{transform:translate(0,0)}50%{transform:translate(40px,-30px)}}
@keyframes floatY{0%,100%{transform:translateY(0) rotate(var(--r,0deg))}50%{transform:translateY(-16px) rotate(var(--r,0deg))}}
@keyframes sweep{0%{top:4%}100%{top:94%}}
@keyframes barGo{0%{width:6%}50%{width:72%}100%{width:96%}}
@keyframes drawCk{to{stroke-dashoffset:0}}
@keyframes spark{0%{opacity:0;transform:translate(0,0) scale(.4)}30%{opacity:1}100%{opacity:0;transform:translate(-26px,-14px) scale(1)}}
@keyframes ripple{to{transform:scale(8);opacity:0}}
@keyframes toastIn{from{opacity:0;transform:translateY(16px) scale(.96)}to{opacity:1;transform:none}}
@keyframes stepIn{from{opacity:0;transform:translateX(-8px)}to{opacity:1;transform:none}}

/* splash */
#splash{position:fixed;inset:0;z-index:999;background:radial-gradient(ellipse at 50% 40%,#17365A,#0A1524 70%);display:grid;place-items:center;overflow:hidden;transition:opacity .5s,visibility .5s}
#splash.out{opacity:0;visibility:hidden}
#splash .gl{position:absolute;border-radius:50%;filter:blur(70px);opacity:.35;animation:drift 9s ease-in-out infinite}
#splash .g1{width:340px;height:340px;background:#14B8A6;left:12%;top:18%}
#splash .g2{width:300px;height:300px;background:#D97706;right:10%;bottom:12%;animation-delay:-4s;opacity:.22}
#splash .rc{position:absolute;width:70px;height:92px;border-radius:8px;background:linear-gradient(#FBF7EA,#E9E1CB);opacity:.1;--r:-12deg;animation:floatY 6s ease-in-out infinite}
#splash .r1{left:18%;bottom:20%}#splash .r2{right:20%;top:16%;--r:14deg;animation-delay:-2s}#splash .r3{left:60%;bottom:12%;--r:6deg;animation-delay:-3.5s;width:50px;height:66px}
#splash .box{position:relative;text-align:center;animation:pop .8s cubic-bezier(.2,.8,.2,1) both}
#splash img.lg{width:min(340px,72vw);height:auto;animation:logoBreath 4s ease-in-out infinite}
#splash .bar{width:min(260px,60vw);height:4px;border-radius:4px;background:rgba(255,255,255,.12);margin:26px auto 0;overflow:hidden}
#splash .bar i{display:block;height:100%;width:6%;border-radius:4px;background:linear-gradient(90deg,#14B8A6,#FFD166);animation:barGo 1.4s ease-out forwards}

/* busy overlay */
#busy{position:fixed;inset:0;z-index:900;background:rgba(10,21,36,.72);backdrop-filter:blur(3px);display:grid;place-items:center;animation:fade .2s}
#busy.hidden{display:none}
#busy .bx{width:min(380px,90vw);background:#0F2038;color:#E6EEF6;border:1px solid #23405F;border-radius:16px;padding:24px;box-shadow:0 24px 60px rgba(0,0,0,.5);animation:pop .3s both}
#busy .bt{font-weight:700;font-size:15px;margin-bottom:14px;display:flex;align-items:center;gap:10px}
#busy .bt:before{content:"";width:18px;height:18px;border-radius:50%;border:3px solid #23405F;border-top-color:#14B8A6;animation:spin .8s linear infinite}
#busy .bb{height:6px;border-radius:6px;background:#1B3350;overflow:hidden}
#busy .bb i{display:block;height:100%;width:6%;border-radius:6px;background:linear-gradient(90deg,#14B8A6,#FFD166);animation:barGo 12s cubic-bezier(.1,.6,.3,1) forwards;position:relative}
#busy .bb i:after{content:"";position:absolute;right:0;top:50%;width:6px;height:6px;margin-top:-3px;border-radius:50%;background:#FFD166;box-shadow:0 0 10px 3px #FFD166;animation:spark 1s infinite}
#busy ul{list-style:none;margin:14px 0 0;padding:0;font-size:13px}
#busy li{padding:5px 0;color:#7F97B0;display:flex;gap:8px;align-items:center;animation:stepIn .3s both}
#busy li.on{color:#fff}#busy li.done{color:#3EE6B8}
#busy li:before{content:"";width:8px;height:8px;border-radius:50%;background:currentColor;opacity:.5}
#busy li.done:before{opacity:1}

/* receipt scan line */
.scanbox{position:relative;display:block;max-width:100%;overflow:hidden;border-radius:8px}
.scanbox img{display:block;max-width:100%}
.scanbox.on:after{content:"";position:absolute;left:0;right:0;height:3px;background:linear-gradient(90deg,transparent,#14B8A6,#FFD166,#14B8A6,transparent);box-shadow:0 0 18px 6px rgba(20,184,166,.55);animation:sweep 1.4s ease-in-out infinite alternate}

/* skeleton */
.sk{border-radius:10px;background:linear-gradient(90deg,#E8EEF5 25%,#F4F8FC 50%,#E8EEF5 75%);background-size:800px 100%;animation:shim 1.3s linear infinite}
.sk-kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin-bottom:16px}
.sk-kpis .sk{height:84px}.sk-row{height:38px;margin-bottom:8px}

/* entrances */
.main>*{animation:rise .35s both}
.kpi{animation:rise .45s both;transition:transform .2s,box-shadow .2s}
.kpi:nth-child(2){animation-delay:.06s}.kpi:nth-child(3){animation-delay:.12s}.kpi:nth-child(4){animation-delay:.18s}.kpi:nth-child(5){animation-delay:.24s}.kpi:nth-child(6){animation-delay:.3s}
.kpi:hover{transform:translateY(-3px);box-shadow:0 10px 24px rgba(13,27,46,.12)}
tbody tr{animation:fade .3s both}tbody tr:hover{background:#EEF6F8}
.modal{animation:pop .25s both}.modal-bg{animation:fade .2s both}
.toast:not(.hidden){animation:toastIn .3s both}

/* nav icons */
.nav{display:flex;align-items:center;gap:10px;transition:background .15s,padding-left .15s}
.nav:hover{padding-left:20px}
.nav svg{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.nav.on svg{stroke:#3EE6B8}

/* buttons */
.btn,.btn-big{position:relative;overflow:hidden;transition:transform .12s,box-shadow .2s,filter .2s}
.btn:active,.btn-big:active{transform:scale(.97)}
.btn-primary:hover:not(:disabled){filter:brightness(1.08);box-shadow:0 6px 16px rgba(8,145,178,.35)}
.rip{position:absolute;border-radius:50%;background:rgba(255,255,255,.45);width:20px;height:20px;margin:-10px 0 0 -10px;pointer-events:none;animation:ripple .6s ease-out forwards}

/* success + empty */
.okck{width:64px;height:64px;display:block;margin:6px auto}
.okck circle{fill:none;stroke:#059669;stroke-width:4;opacity:.25}
.okck path{fill:none;stroke:#059669;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:60;stroke-dashoffset:60;animation:drawCk .6s .1s forwards}
.empty{animation:fade .4s both}
div.empty:before{content:"";display:block;width:54px;height:54px;margin:0 auto 10px;background:url(/brand/mark.svg) center/contain no-repeat;opacity:.55;animation:floatY 3.5s ease-in-out infinite}

@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
@keyframes splashOut{to{opacity:0;visibility:hidden;pointer-events:none}}
#splash{animation:splashOut .5s 4s forwards}
#splash.out{pointer-events:none}

/* password field: eye + strength meter */
.pw-wrap{position:relative}.pw-wrap .inp{padding-right:46px}
.pw-eye{position:absolute;right:4px;top:50%;transform:translateY(-50%);width:38px;height:38px;border:0;background:transparent;border-radius:8px;cursor:pointer;color:#64748B;display:grid;place-items:center}
.pw-eye:hover{background:#EEF6F8;color:#0891B2}
.pw-eye svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.pw-eye .sl{opacity:0;transition:opacity .15s}.pw-eye.on .sl{opacity:1}
.pw-meter{display:grid;grid-template-columns:repeat(4,1fr);gap:4px;margin-top:8px}
.pw-meter i{height:6px;border-radius:4px;background:#E2E8F0;transition:background .25s}
.pw-meter.s1 i:nth-child(-n+1){background:#DC2626}
.pw-meter.s2 i:nth-child(-n+2){background:#D97706}
.pw-meter.s3 i:nth-child(-n+3){background:#14B8A6}
.pw-meter.s4 i{background:#059669}
.pw-lab{font-size:12px;font-weight:600;margin-top:4px;min-height:16px;color:#64748B}
.pw-lab.s1{color:#DC2626}.pw-lab.s2{color:#B45309}.pw-lab.s3{color:#0F766E}.pw-lab.s4{color:#059669}
.err.okm{color:#065F46}
@media(max-width:700px){.tbl-wrap table{overflow:visible}.tbl-wrap td:last-child:has(>button){position:sticky;right:0;background:#fff;box-shadow:-6px 0 8px -4px rgba(13,27,46,.18);padding:6px 8px;text-align:center}.tbl-wrap td:last-child:has(>button)>button{display:block;width:100%;margin:4px 0}}
.read-status{font-size:14px;font-weight:600;border-radius:10px;padding:9px 12px;margin:8px 0}
.read-status:empty{display:none}
.read-status.reading{background:#ECFEFF;color:#0E7490}
.read-status.done{background:#ECFDF5;color:#047857}
.read-status.none{background:#FFFBEB;color:#92400E}
/* phone comfort: 16px fields stop iOS from zooming in, darker teal reads better under white text */
.side .nav-out{display:none}
@media(max-width:820px){.inp{font-size:16px}.shell{align-content:start}.side{display:grid;grid-template-columns:repeat(4,1fr);overflow:visible}.side .nav{min-width:0;min-height:52px;flex-direction:column;justify-content:center;gap:4px;padding:8px 2px;font-size:12px}.side .nav:hover{padding-left:2px}.side .nav-out{display:flex}}
.btn-primary,.btn-big.btn-primary{background:#0E7490;border-color:#0E7490}.btn-primary:hover{background:#155E75}
.btn-big{border-color:#0E7490}.btn-big.btn-ghost{color:#0E7490}
.btn:focus-visible,.nav:focus-visible,a:focus-visible,.btn-big:has(+ input:focus-visible){outline:3px solid var(--gold);outline-offset:2px}
.modal:focus{outline:none}
