html,body{margin:0}
img{max-width:100%}
[hidden]{display:none!important}
/* Layout: shadcn/ui shell (sidebar + inset), zinc tokens, RTL. Pages carry data only; every explanation lives behind a "!" walkthrough. */
:root{
  --background:hsl(0 0% 100%); --foreground:hsl(240 10% 3.9%); --card:hsl(0 0% 100%); --card-foreground:hsl(240 10% 3.9%);
  --muted:hsl(240 4.8% 95.9%); --muted-foreground:hsl(240 3.8% 46.1%); --accent:hsl(240 4.8% 95.9%); --accent-foreground:hsl(240 5.9% 10%);
  --primary:hsl(240 5.9% 10%); --primary-foreground:hsl(0 0% 98%); --secondary:hsl(240 4.8% 95.9%); --secondary-foreground:hsl(240 5.9% 10%);
  --border:hsl(240 5.9% 90%); --input:hsl(240 5.9% 90%); --ring:hsl(240 5% 64.9%); --sidebar:hsl(0 0% 98%); --overlay:hsl(240 10% 3.9% / .5);
  --destructive:hsl(0 72% 51%); --destructive-soft:hsl(0 86% 97%); --success:hsl(142 72% 29%); --success-soft:hsl(141 84% 95%);
  --warning:hsl(32 95% 38%); --warning-soft:hsl(48 96% 93%); --info:hsl(221 83% 45%); --info-soft:hsl(214 95% 95%);
  --ch-whatsapp:hsl(160 84% 34%); --ch-telegram:hsl(199 89% 44%); --ch-instagram:hsl(330 81% 56%); --ch-bale:hsl(173 70% 30%);
  --ch-sms:hsl(38 92% 48%); --ch-email:hsl(215 16% 47%); --ch-call:hsl(221 83% 53%); --ch-meeting:hsl(262 83% 58%);
  --ch-visit:hsl(20 85% 50%); --ch-order:hsl(142 60% 38%); --ch-system:hsl(240 5% 65%); --ch-personal_phone:hsl(250 40% 45%); --ch-other:hsl(240 4% 55%);
  --radius:.5rem; --font:"Vazirmatn", Tahoma, "Segoe UI", sans-serif; --mono:ui-monospace,"SFMono-Regular",Consolas,monospace;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --background:hsl(240 10% 3.9%); --foreground:hsl(0 0% 98%); --card:hsl(240 10% 5.5%); --card-foreground:hsl(0 0% 98%);
  --muted:hsl(240 3.7% 15.9%); --muted-foreground:hsl(240 5% 64.9%); --accent:hsl(240 3.7% 15.9%); --accent-foreground:hsl(0 0% 98%);
  --primary:hsl(0 0% 98%); --primary-foreground:hsl(240 5.9% 10%); --secondary:hsl(240 3.7% 15.9%); --secondary-foreground:hsl(0 0% 98%);
  --border:hsl(240 3.7% 15.9%); --input:hsl(240 3.7% 15.9%); --ring:hsl(240 4.9% 83.9%); --sidebar:hsl(240 5.9% 7%); --overlay:hsl(0 0% 0% / .65);
  --destructive:hsl(0 84% 66%); --destructive-soft:hsl(0 50% 14%); --success:hsl(142 69% 58%); --success-soft:hsl(144 45% 12%);
  --warning:hsl(43 96% 58%); --warning-soft:hsl(38 50% 13%); --info:hsl(213 94% 68%); --info-soft:hsl(221 45% 15%);
  --ch-whatsapp:hsl(158 64% 52%); --ch-telegram:hsl(198 93% 60%); --ch-instagram:hsl(329 86% 70%); --ch-bale:hsl(173 60% 48%);
  --ch-sms:hsl(43 96% 56%); --ch-email:hsl(215 20% 65%); --ch-call:hsl(217 91% 65%); --ch-meeting:hsl(258 90% 72%);
  --ch-visit:hsl(24 90% 62%); --ch-order:hsl(142 55% 55%); --ch-system:hsl(240 5% 45%); --ch-personal_phone:hsl(250 60% 72%); --ch-other:hsl(240 5% 60%); color-scheme:dark}}
:root[data-theme="dark"]{
  --background:hsl(240 10% 3.9%); --foreground:hsl(0 0% 98%); --card:hsl(240 10% 5.5%); --card-foreground:hsl(0 0% 98%);
  --muted:hsl(240 3.7% 15.9%); --muted-foreground:hsl(240 5% 64.9%); --accent:hsl(240 3.7% 15.9%); --accent-foreground:hsl(0 0% 98%);
  --primary:hsl(0 0% 98%); --primary-foreground:hsl(240 5.9% 10%); --secondary:hsl(240 3.7% 15.9%); --secondary-foreground:hsl(0 0% 98%);
  --border:hsl(240 3.7% 15.9%); --input:hsl(240 3.7% 15.9%); --ring:hsl(240 4.9% 83.9%); --sidebar:hsl(240 5.9% 7%); --overlay:hsl(0 0% 0% / .65);
  --destructive:hsl(0 84% 66%); --destructive-soft:hsl(0 50% 14%); --success:hsl(142 69% 58%); --success-soft:hsl(144 45% 12%);
  --warning:hsl(43 96% 58%); --warning-soft:hsl(38 50% 13%); --info:hsl(213 94% 68%); --info-soft:hsl(221 45% 15%);
  --ch-whatsapp:hsl(158 64% 52%); --ch-telegram:hsl(198 93% 60%); --ch-instagram:hsl(329 86% 70%); --ch-bale:hsl(173 60% 48%);
  --ch-sms:hsl(43 96% 56%); --ch-email:hsl(215 20% 65%); --ch-call:hsl(217 91% 65%); --ch-meeting:hsl(258 90% 72%);
  --ch-visit:hsl(24 90% 62%); --ch-order:hsl(142 55% 55%); --ch-system:hsl(240 5% 45%); --ch-personal_phone:hsl(250 60% 72%); --ch-other:hsl(240 5% 60%); color-scheme:dark}

*{box-sizing:border-box;border-color:var(--border)}
html,body{height:100%}
body{background:var(--background);color:var(--foreground);font-family:var(--font);font-size:14px;line-height:1.6;direction:rtl;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
svg.i{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.shell{display:grid;grid-template-columns:256px 1fr;min-height:100%}
.sidebar{background:var(--sidebar);border-left:1px solid var(--border);display:flex;flex-direction:column;position:sticky;top:0;height:100vh;padding:8px;overflow-y:auto}
.sb-head{padding:8px;display:flex;flex-direction:column;gap:6px}
.sb-label{font-size:12px;color:var(--muted-foreground);padding:8px 8px 4px;font-weight:500}
.sb-nav{display:flex;flex-direction:column;gap:2px;padding:0 0 8px}
.sb-item{all:unset;box-sizing:border-box;display:flex;align-items:center;gap:8px;height:34px;padding:0 8px;border-radius:calc(var(--radius) - 2px);cursor:pointer;font-size:13.5px;color:var(--foreground)}
.sb-item:hover{background:var(--accent)}
.sb-item[aria-current="true"]{background:var(--accent);font-weight:600}
.sb-item:focus-visible{outline:2px solid var(--ring)}
.sb-item .count{margin-inline-start:auto;font-size:11.5px;color:var(--muted-foreground);font-variant-numeric:tabular-nums}
.sb-foot{margin-top:auto;border-top:1px solid var(--border);padding:8px;display:flex;flex-direction:column;gap:6px}
.switcher{display:flex;align-items:center;gap:10px;padding:6px;border-radius:var(--radius)}
.switcher .logo{width:32px;height:32px;border-radius:calc(var(--radius) - 2px);background:var(--primary);color:var(--primary-foreground);display:grid;place-items:center;font-weight:800;flex:none}
.switcher b{display:block;font-size:13.5px;line-height:1.3}
.switcher span{font-size:12px;color:var(--muted-foreground)}
.inset{min-width:0;display:flex;flex-direction:column}
.topbar{position:sticky;top:env(safe-area-inset-top,0px);z-index:5;background:var(--background);border-bottom:1px solid var(--border);height:56px;display:flex;align-items:center;gap:12px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset-top,0px);z-index:10;background:var(--background)}
.crumb{display:flex;align-items:center;gap:6px;font-size:13.5px;color:var(--muted-foreground);min-width:0}
.crumb b{color:var(--foreground);font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.crumb svg{transform:scaleX(-1);width:14px;height:14px}
.search-btn{margin-inline-start:auto;display:flex;align-items:center;gap:8px;height:34px;padding:0 10px;border:1px solid var(--input);border-radius:var(--radius);background:var(--background);color:var(--muted-foreground);cursor:pointer;min-width:220px;font-size:13px}
.search-btn:hover{background:var(--accent)}
.kbd{margin-inline-start:auto;font-family:var(--mono);font-size:10.5px;border:1px solid var(--border);background:var(--muted);border-radius:4px;padding:0 5px;direction:ltr}
.content{padding-block:24px 64px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px))}
.page{max-width:1240px;margin-inline:auto;display:flex;flex-direction:column;gap:18px}
.ph{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}
.ph .tt{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.ph h1{margin:0;font-size:22px;font-weight:700;letter-spacing:-.2px}
.ph .sub{font-size:13px;color:var(--muted-foreground)}
.hbtn{all:unset;cursor:pointer;width:20px;height:20px;border-radius:9999px;border:1.5px solid var(--muted-foreground);color:var(--muted-foreground);display:inline-grid;place-items:center;font-size:12px;font-weight:800;line-height:1;flex:none}
.hbtn:hover{border-color:var(--foreground);color:var(--foreground)}
.hbtn:focus-visible{outline:2px solid var(--ring);outline-offset:2px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:36px;padding:0 14px;border-radius:var(--radius);border:1px solid transparent;background:var(--primary);color:var(--primary-foreground);font-size:13.5px;font-weight:500;cursor:pointer;white-space:nowrap}
.btn:hover{opacity:.9}
.btn.outline{background:var(--background);color:var(--foreground);border-color:var(--input)}
.btn.outline:hover{background:var(--accent);opacity:1}
.btn.ghost{background:transparent;color:var(--foreground)}
.btn.ghost:hover{background:var(--accent);opacity:1}
.btn.danger{background:var(--destructive);color:#fff}
.btn.sm{height:30px;padding:0 10px;font-size:12.5px}
.btn.icon{width:32px;height:32px;padding:0}
.btn:focus-visible,.input:focus-visible,.select:focus-visible,.textarea:focus-visible,.tab:focus-visible,.switch:focus-visible,.chip:focus-visible{outline:none;box-shadow:0 0 0 2px var(--background),0 0 0 4px var(--ring)}
.badge{display:inline-flex;align-items:center;gap:4px;border-radius:9999px;border:1px solid transparent;padding:1px 9px;font-size:11.5px;font-weight:600;white-space:nowrap;line-height:1.6}
.badge.secondary{background:var(--secondary);color:var(--secondary-foreground)}
.badge.outline{border-color:var(--border);color:var(--foreground);font-weight:500}
.badge.destructive{background:var(--destructive-soft);color:var(--destructive)}
.badge.success{background:var(--success-soft);color:var(--success)}
.badge.warning{background:var(--warning-soft);color:var(--warning)}
.badge.info{background:var(--info-soft);color:var(--info)}
.dot{width:8px;height:8px;border-radius:2px;display:inline-block;flex:none}
.card{background:var(--card);color:var(--card-foreground);border:1px solid var(--border);border-radius:calc(var(--radius) + 4px);min-width:0}
.card-h{padding:16px 20px 0;display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.card-h .ct{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.card-t{font-size:15px;font-weight:600;margin:0}
.card-d{font-size:12.5px;color:var(--muted-foreground)}
.card-c{padding:14px 20px 18px}
.card-c.flush{padding:10px 0 4px}
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.kpi{padding:14px 18px;display:flex;flex-direction:column;gap:2px}
.kpi .l{font-size:12.5px;color:var(--muted-foreground);display:flex;justify-content:space-between;align-items:center;gap:6px}
.kpi .n{font-size:24px;font-weight:700;font-variant-numeric:tabular-nums;letter-spacing:-.3px}
.kpi .s{font-size:12px;color:var(--muted-foreground)}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.grid32{display:grid;grid-template-columns:2fr 1fr;gap:16px}
.input,.select,.textarea{height:36px;border:1px solid var(--input);background:var(--background);border-radius:var(--radius);padding:0 10px;font-size:13.5px;min-width:0;max-width:100%}
.textarea{height:auto;min-height:110px;padding:8px 10px;line-height:1.8;resize:vertical;width:100%}
.input.w{width:100%}
.label{font-size:13px;font-weight:500}
.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.hint{font-size:12px;color:var(--muted-foreground)}
.toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.toolbar .input[type=search]{flex:1 1 240px}
.sep{height:1px;background:var(--border);border:0;margin:0}
.muted{color:var(--muted-foreground)}
.small{font-size:12.5px}
.mono{font-family:var(--mono);font-size:11.5px;direction:ltr;unicode-bidi:isolate;color:var(--muted-foreground)}
.mono.ink{color:var(--foreground)}
.num{font-variant-numeric:tabular-nums}
.nowrap{white-space:nowrap}
.flag{color:var(--destructive);font-weight:600}
.avatar{width:32px;height:32px;border-radius:9999px;background:var(--muted);display:grid;place-items:center;font-size:12px;font-weight:700;flex:none}
.avatar.sm{width:26px;height:26px;font-size:11px}
.tw{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:13.5px}
th{height:40px;padding:0 12px;text-align:right;font-weight:500;color:var(--muted-foreground);font-size:12.5px;white-space:nowrap;border-bottom:1px solid var(--border)}
td{padding:9px 12px;border-bottom:1px solid var(--border);vertical-align:middle}
tbody tr:last-child td{border-bottom:0}
tbody tr.click{cursor:pointer}
tbody tr.click:hover td{background:color-mix(in srgb,var(--muted) 60%,transparent)}
tr.base td{background:var(--muted);font-weight:600}
tr.rv td{background:color-mix(in srgb,var(--warning-soft) 70%,transparent)}
tr.x td{opacity:.5;text-decoration:line-through}
.who{display:flex;align-items:center;gap:10px;min-width:0}
.who b{font-weight:600;display:block;line-height:1.35;white-space:nowrap}
.who span{font-size:12px;color:var(--muted-foreground)}
.tabs{display:inline-flex;background:var(--muted);border-radius:var(--radius);padding:3px;gap:2px;flex-wrap:wrap}
.tab{all:unset;cursor:pointer;padding:4px 12px;border-radius:calc(var(--radius) - 2px);font-size:13px;font-weight:500;color:var(--muted-foreground)}
.tab[aria-selected="true"]{background:var(--background);color:var(--foreground);box-shadow:0 1px 2px hsl(0 0% 0% / .08)}
.chip{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;border:1px solid var(--border);border-radius:9999px;padding:4px 12px;font-size:13px;background:var(--background)}
.chip:hover{background:var(--accent)}
.chip[aria-pressed="true"]{background:var(--primary);color:var(--primary-foreground);border-color:var(--primary)}
.queue{display:flex;flex-direction:column}
.q{display:grid;grid-template-columns:auto 1fr auto;gap:14px;align-items:center;padding:12px 20px;border-top:1px solid var(--border);cursor:pointer}
.q:hover{background:color-mix(in srgb,var(--muted) 55%,transparent)}
.q .why{font-size:13px;margin-top:2px}
.q .do{display:flex;align-items:center;gap:6px;font-size:12.5px;color:var(--muted-foreground);margin-top:4px;flex-wrap:wrap}
.pri{width:4px;align-self:stretch;border-radius:2px}
.prob{display:flex;align-items:center;gap:8px;min-width:104px}
.bar{flex:1;height:6px;background:var(--muted);border-radius:9999px;overflow:hidden;min-width:40px}
.bar b{display:block;height:100%;background:var(--primary);border-radius:9999px}
.trend{font-size:12px;font-variant-numeric:tabular-nums;white-space:nowrap}
.trend.up{color:var(--success)}.trend.down{color:var(--destructive)}
.timer{font-variant-numeric:tabular-nums;font-weight:700;white-space:nowrap}
.timer.over{color:var(--destructive)}
.chg{display:flex;flex-direction:column;line-height:1.35}
.chg s{color:var(--muted-foreground);font-size:11.5px}
.chg b{font-weight:600}
.chg.up b{color:var(--success)}.chg.down b{color:var(--destructive)}
.tl{display:flex;flex-direction:column}
.tl-i{display:grid;grid-template-columns:28px 1fr;gap:12px;position:relative;padding-bottom:16px}
.tl-i::before{content:"";position:absolute;right:13px;top:28px;bottom:0;width:1px;background:var(--border)}
.tl-i:last-child::before{display:none}
.tl-ic{width:28px;height:28px;border-radius:9999px;display:grid;place-items:center;border:1px solid var(--border);background:var(--card)}
.tl-ic svg{width:14px;height:14px}
.tl-b{min-width:0}
.tl-b .meta{font-size:12px;color:var(--muted-foreground);display:flex;gap:6px;flex-wrap:wrap;align-items:center}
.tl-b .body{margin-top:4px;font-size:13.5px}
.quote{border-inline-start:2px solid var(--border);padding-inline-start:10px}
.taarof{margin-top:6px;font-size:12.5px;border:1px dashed var(--warning);background:var(--warning-soft);border-radius:var(--radius);padding:6px 10px}
dialog{border:0;padding:0;background:transparent;color:var(--foreground);max-width:none;max-height:none}
dialog::backdrop{background:var(--overlay)}
dialog.sheet{margin:0;inset-inline-start:auto;inset-inline-end:0;inset-block:0;height:100%;width:min(800px,100vw);background:var(--background);border-inline-start:1px solid var(--border);box-shadow:0 10px 40px hsl(0 0% 0% / .2);overflow-y:auto}
.sh-head{position:sticky;top:0;background:var(--background);z-index:2;padding:18px 22px 14px;border-bottom:1px solid var(--border);display:flex;flex-direction:column;gap:12px}
.sh-top{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.sh-top h2{margin:0;font-size:18px;font-weight:700}
.sh-body{padding:18px 22px 40px;display:flex;flex-direction:column;gap:18px}
.sh-body h3{margin:0 0 8px;font-size:14px;font-weight:600;display:flex;align-items:center;gap:8px}
.facts{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.fact{border:1px solid var(--border);border-radius:var(--radius);padding:10px 12px;display:flex;flex-direction:column;gap:2px;min-width:0}
.fact span{font-size:11.5px;color:var(--muted-foreground)}
.fact b{font-size:15px;font-weight:700;font-variant-numeric:tabular-nums}
.fact em{font-style:normal;font-size:11.5px}
.known{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
.known>div{border:1px solid var(--border);border-radius:var(--radius);padding:9px 12px;display:flex;flex-direction:column;gap:3px;min-width:0}
.known span{font-size:11.5px;color:var(--muted-foreground)}
.known b{font-weight:600;font-size:13.5px;overflow-wrap:anywhere}
.known i{font-style:normal;font-size:11.5px;color:var(--muted-foreground)}
.known .none b{color:var(--muted-foreground);font-weight:400}
.wlist{display:flex;flex-direction:column;gap:8px}
.witem{display:grid;grid-template-columns:auto 1fr;gap:10px;align-items:start;border:1px solid var(--border);border-radius:var(--radius);padding:10px 12px}
.witem .act{font-size:12.5px;color:var(--muted-foreground);margin-top:2px}
.factors{display:grid;grid-template-columns:1fr 1fr;gap:4px 16px}
.factor{display:flex;justify-content:space-between;gap:8px;font-size:13px;padding:5px 0;border-bottom:1px dashed var(--border)}
.factor b{font-variant-numeric:tabular-nums;white-space:nowrap}
.factor b.pos{color:var(--success)}.factor b.neg{color:var(--destructive)}
dialog.cmd{margin:12vh auto auto;width:min(560px,calc(100vw - 32px));background:var(--background);border:1px solid var(--border);border-radius:calc(var(--radius) + 4px);box-shadow:0 20px 50px hsl(0 0% 0% / .25);overflow:hidden}
.cmd-in{display:flex;align-items:center;gap:8px;padding:0 14px;border-bottom:1px solid var(--border);height:48px}
.cmd-in input{all:unset;flex:1;font-size:14px}
.cmd-list{max-height:min(380px,60vh);overflow-y:auto;padding:6px}
.cmd-g{font-size:11.5px;color:var(--muted-foreground);padding:8px 8px 4px;font-weight:600}
.cmd-o{display:flex;align-items:center;gap:10px;padding:8px;border-radius:calc(var(--radius) - 2px);cursor:pointer;font-size:13.5px}
.cmd-o[aria-selected="true"],.cmd-o:hover{background:var(--accent)}
.cmd-o .muted{margin-inline-start:auto;font-size:12px}
.brief{border:1px solid var(--border);border-radius:calc(var(--radius) + 4px);overflow:hidden}
.brief-h{display:flex;align-items:center;gap:8px;padding:10px 14px;background:var(--muted);font-size:12.5px;font-weight:600;flex-wrap:wrap}
.brief ul{margin:0;padding:12px 14px 14px;padding-inline-start:32px;display:flex;flex-direction:column;gap:8px;font-size:13.5px}
.notice{display:flex;gap:10px;align-items:flex-start;border:1px solid var(--border);border-radius:var(--radius);padding:10px 14px;font-size:13px;background:var(--card)}
.notice svg{margin-top:3px}
.notice.warn{border-color:var(--warning);background:var(--warning-soft)}
.notice.bad{border-color:var(--destructive);background:var(--destructive-soft)}
.notice.ok{border-color:var(--success);background:var(--success-soft)}
.player{display:flex;align-items:center;gap:10px;border:1px solid var(--border);border-radius:var(--radius);padding:10px 12px}
.player canvas{flex:1;min-width:0;height:40px;cursor:pointer}
.play{all:unset;cursor:pointer;width:32px;height:32px;border-radius:9999px;background:var(--primary);color:var(--primary-foreground);display:grid;place-items:center;flex:none}
.segs{display:flex;flex-direction:column;gap:2px;max-height:260px;overflow-y:auto;margin-top:8px}
.seg{display:grid;grid-template-columns:46px 56px 1fr auto;gap:8px;padding:6px 8px;border-radius:6px;cursor:pointer;font-size:13px;align-items:start}
.seg:hover{background:var(--muted)}.seg.on{background:var(--accent)}
.seg .t{font-family:var(--mono);font-size:11px;color:var(--muted-foreground);direction:ltr}
.seg .s{font-size:12px;color:var(--muted-foreground)}
.seg.customer .s{color:var(--foreground);font-weight:600}
.sent{display:inline-flex;direction:ltr;width:56px;height:6px;background:var(--muted);border-radius:9999px;position:relative;overflow:hidden;vertical-align:middle}
.sent::after{content:"";position:absolute;left:50%;top:0;bottom:0;width:1px;background:var(--border)}
.sent b{position:absolute;top:0;bottom:0}
pre.json{direction:ltr;text-align:left;font-family:var(--mono);font-size:11.5px;background:var(--muted);border-radius:var(--radius);padding:12px;overflow:auto;max-height:320px;margin:0;white-space:pre}
.kv{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:8px}
.kv div{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:var(--radius);padding:8px 10px;min-width:0}
.kv span{font-size:11.5px;color:var(--muted-foreground)}
.kv b{font-weight:500;font-size:13px;overflow-wrap:anywhere;white-space:pre-wrap}
.kb-layout{display:grid;grid-template-columns:280px 1fr;gap:16px;align-items:start}
.kb-list{display:flex;flex-direction:column;padding:6px}
.kb-g{font-size:11.5px;color:var(--muted-foreground);font-weight:600;padding:10px 12px 4px}
.kb-it{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:3px;padding:10px 12px;border-radius:var(--radius)}
.kb-it:hover,.kb-it[aria-current="true"]{background:var(--accent)}
.kb-it .top{display:flex;justify-content:space-between;align-items:center;gap:6px}
.doc{display:flex;align-items:center;gap:10px;border:1px solid var(--border);border-radius:var(--radius);padding:10px 12px}
.doc .grow{flex:1;min-width:0}
.doc b{font-weight:600;font-size:13px;display:block}
.fields2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.vers{display:flex;flex-direction:column}
.ver{display:flex;gap:12px;padding:10px 0;border-top:1px solid var(--border);align-items:flex-start}
.ver:first-child{border-top:0}
.switch{all:unset;cursor:pointer;width:36px;height:20px;border-radius:9999px;background:var(--input);position:relative;display:inline-block;flex:none}
.switch::after{content:"";position:absolute;top:2px;right:2px;width:16px;height:16px;border-radius:9999px;background:var(--background);box-shadow:0 1px 2px hsl(0 0% 0% / .2);transition:transform .15s}
.switch[aria-checked="true"]{background:var(--primary)}
.switch[aria-checked="true"]::after{transform:translateX(-16px)}
.chart{width:100%;height:auto;display:block}
.chart text{font-family:var(--font);font-size:10px;fill:var(--muted-foreground)}
.legend{display:flex;flex-wrap:wrap;gap:14px;font-size:12px;color:var(--muted-foreground)}
.legend span{display:inline-flex;align-items:center;gap:6px}
.legend .ln{width:14px;height:2px;background:var(--foreground);opacity:.7}
.legend .band{width:12px;height:10px;background:var(--destructive);opacity:.18;border-radius:2px}
.legend .cal{width:0;height:10px;border-inline-start:1px dashed var(--muted-foreground)}
.hbars{display:flex;flex-direction:column;gap:8px}
.hb{display:grid;grid-template-columns:150px 1fr 48px;gap:10px;align-items:center;font-size:13px}
.hb .tr{height:10px;background:var(--muted);border-radius:4px;overflow:hidden}
.hb .tr b{display:block;height:100%;background:var(--primary);border-radius:4px}
.hb.censored .tr b{background:repeating-linear-gradient(45deg,var(--muted-foreground) 0 4px,transparent 4px 8px)}
.heat td.h{text-align:center;font-variant-numeric:tabular-nums}
.heat td.h span{display:inline-block;min-width:44px;border-radius:6px;padding:2px 6px}
.gantt{display:flex;flex-direction:column;gap:6px}
.gantt .gr{display:grid;grid-template-columns:170px 1fr;gap:10px;align-items:center}
.gantt .cells{display:grid;grid-template-columns:repeat(120,minmax(0,1fr));gap:1px;direction:ltr;min-width:0}
.gantt .cells i{height:16px;border-radius:1px}
.gantt .cells i.q{background:var(--muted)}
.gantt .cells i.ok{background:var(--success);opacity:.55}
.gantt .cells i.late{background:var(--warning)}
.gantt .cells i.lost{background:var(--destructive)}
.gantt .cells i.partial{background:repeating-linear-gradient(45deg,var(--destructive) 0 2px,var(--warning-soft) 2px 4px)}
.idchips{display:flex;flex-wrap:wrap;gap:6px}
.idc{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--border);border-radius:9999px;padding:1px 8px;font-size:12px}
.idc.pending{border-style:dashed;border-color:var(--warning)}
details.acc{border-bottom:1px solid var(--border)}
details.acc summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:10px;padding:12px 20px;font-size:13.5px;flex-wrap:wrap}
details.acc summary::-webkit-details-marker{display:none}
details.acc summary::after{content:"";margin-inline-start:auto;width:8px;height:8px;border-left:2px solid var(--muted-foreground);border-bottom:2px solid var(--muted-foreground);transform:rotate(-45deg);transition:transform .15s}
details.acc[open] summary::after{transform:rotate(135deg)}
details.acc>div{padding:0 20px 14px}
/* entry */
.form{display:flex;flex-direction:column;gap:16px}
.frow{display:grid;grid-template-columns:120px 1fr;gap:12px;align-items:start}
.frow>.label{padding-top:6px}
.frow .toolbar{gap:6px}
.drop{border:2px dashed var(--border);border-radius:calc(var(--radius) + 4px);padding:26px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--muted-foreground);cursor:pointer}
.drop.on,.drop:hover{border-color:var(--ring);background:var(--muted)}
.inv{display:grid;grid-template-columns:repeat(5,1fr);gap:10px}
.inv>div{border:1px solid var(--border);border-radius:var(--radius);padding:10px 12px;display:flex;flex-direction:column}
.inv span{font-size:11.5px;color:var(--muted-foreground)}
.inv b{font-size:20px;font-weight:700;font-variant-numeric:tabular-nums}
.inv .ok b{color:var(--success)}.inv .rv b{color:var(--warning)}.inv .lost b{color:var(--success)}
.saved{font-size:12px;color:var(--muted-foreground);display:inline-flex;align-items:center;gap:6px}
.saved i{width:7px;height:7px;border-radius:9999px;background:var(--success);display:inline-block}
.warns{display:flex;flex-wrap:wrap;gap:6px}
/* walkthrough */
.wt{position:fixed;z-index:70;bottom:calc(20px + env(safe-area-inset-bottom,0px));left:calc(20px + env(safe-area-inset-left,0px));width:min(360px,calc(100vw - 40px));background:var(--card);border:1px solid var(--border);border-radius:calc(var(--radius) + 4px);box-shadow:0 16px 40px hsl(0 0% 0% / .22);display:flex;flex-direction:column}
.wt-h{display:flex;align-items:center;gap:8px;padding:12px 14px 0}
.wt-h b{flex:1;font-size:14px}
.wt-b{padding:8px 14px 4px;font-size:13.5px;line-height:1.9}
.wt-b h4{margin:0 0 4px;font-size:13.5px}
.wt-f{display:flex;gap:8px;justify-content:space-between;align-items:center;padding:10px 14px 14px}
.wt-dots{display:flex;gap:4px}
.wt-dots i{width:6px;height:6px;border-radius:9999px;background:var(--border)}
.wt-dots i.on{background:var(--foreground)}
.wt-on{outline:2px solid var(--info)!important;outline-offset:4px;border-radius:var(--radius);transition:outline-color .2s}
.toast{position:fixed;bottom:calc(20px + env(safe-area-inset-bottom,0px));right:calc(20px + env(safe-area-inset-right,0px));background:var(--foreground);color:var(--background);padding:10px 16px;border-radius:var(--radius);font-size:13px;opacity:0;transform:translateY(8px);transition:.2s;pointer-events:none;z-index:80;display:flex;align-items:center;gap:12px}
.toast.on{opacity:1;transform:none}
.toast.act{pointer-events:auto}
.toast button{all:unset;cursor:pointer;font-weight:700;text-decoration:underline}
.empty{padding:28px 20px;text-align:center;color:var(--muted-foreground);display:flex;flex-direction:column;gap:10px;align-items:center}
@media (max-width:1000px){.kpis{grid-template-columns:repeat(2,1fr)}.grid32,.kb-layout{grid-template-columns:1fr}.facts{grid-template-columns:repeat(2,1fr)}.inv{grid-template-columns:repeat(2,1fr)}}
@media (max-width:860px){
  .shell{grid-template-columns:1fr}
  .sidebar{position:static;height:auto;border-left:0;border-bottom:1px solid var(--border);padding-left:max(8px,env(safe-area-inset-left,0px));padding-right:max(8px,env(safe-area-inset-right,0px))}
  .sb-nav{flex-direction:row;overflow-x:auto}.sb-item{white-space:nowrap;flex:none}.sb-label{display:none}.sb-foot{margin-top:0}
  .grid2,.fields2,.known,.factors{grid-template-columns:1fr}
  .frow{grid-template-columns:1fr;gap:6px}.frow>.label{padding-top:0}
  .search-btn{min-width:0}.search-btn .txt{display:none}
  .q{grid-template-columns:auto 1fr;padding:12px 16px}.q>.prob,.q>.tm{grid-column:2}
  .seg{grid-template-columns:40px 1fr}.seg .s{grid-column:2}
  .gantt .gr{grid-template-columns:1fr}.hb{grid-template-columns:110px 1fr 40px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}

/* shared bank list: chips wrap inside their cell */
td.bkc{white-space:normal;min-width:120px;line-height:2}
td.bkc .badge{margin:0 0 2px 4px}
