/* NOX Invoice — mobile-first UI. Brand colours come from /brand/theme.css (CSS variables). */
:root{--primary:#4cbb17;--primary-rgb:76,187,23;--secondary:#1b3a6b;--secondary-rgb:27,58,107;--accent:#ffc107;--text:#1f2328;
--font:'Inter',system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;--bg:#f3f5f8;--card:#fff;--line:#e4e8ee;--muted:#6b7280;
--red:#dc3545;--green:#198754;--amber:#b7791f;--radius:12px;--shadow:0 1px 2px rgba(16,24,40,.06),0 1px 3px rgba(16,24,40,.08);--side:248px}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;font:14px/1.5 var(--font);color:var(--text);background:var(--bg)}
a{color:var(--secondary);text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%}
h1,h2,h3,h4{margin:0;line-height:1.25;color:var(--secondary)}
h1{font-size:20px}h2{font-size:17px}h3{font-size:15px}h4{font-size:13px}
[x-cloak]{display:none!important}

/* ---------- shell ---------- */
.shell{display:flex;min-height:100vh}
.side{width:var(--side);background:#fff;border-right:1px solid var(--line);position:fixed;inset:0 auto 0 0;overflow-y:auto;z-index:40;display:flex;flex-direction:column}
.side .brand{display:flex;align-items:center;gap:10px;padding:14px 16px;border-bottom:1px solid var(--line);min-height:62px}
.side .brand img{max-height:34px;max-width:150px;object-fit:contain}
.side .brand b{color:var(--secondary);font-size:15px;line-height:1.2}
.nav{padding:8px 10px 24px;flex:1}
.nav .sec{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);padding:14px 10px 4px;font-weight:600}
.nav a{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;color:#374151;font-weight:500}
.nav a:hover{background:rgba(var(--primary-rgb),.08);text-decoration:none}
.nav a.on{background:rgba(var(--primary-rgb),.14);color:var(--secondary);font-weight:600}
.nav a svg{width:18px;height:18px;flex:0 0 18px;opacity:.75}
.main{flex:1;margin-left:var(--side);min-width:0;display:flex;flex-direction:column}
.top{position:sticky;top:0;z-index:30;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:10px;padding:10px 20px;min-height:58px}
.top .title{flex:1;font-weight:600;color:var(--secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.top .menu-btn{display:none}
.content{padding:20px;max-width:1280px;width:100%;margin:0 auto 90px}
.banner{background:#fff4d6;border-bottom:1px solid #f3dfa2;padding:8px 20px;font-size:13px;color:#7a5a00}
.bottom{display:none}
.fab{display:none}
.overlay{display:none}

@media (max-width:900px){
  .side{transform:translateX(-100%);transition:transform .2s;box-shadow:0 0 30px rgba(0,0,0,.2)}
  .side.open{transform:none}
  .overlay.open{display:block;position:fixed;inset:0;background:rgba(0,0,0,.35);z-index:35}
  .main{margin-left:0}
  .top{padding:8px 12px}
  .top .menu-btn{display:inline-flex}
  .content{padding:12px 12px 100px}
  .bottom{display:flex;position:fixed;bottom:0;left:0;right:0;background:#fff;border-top:1px solid var(--line);z-index:30;padding:4px 4px calc(4px + env(safe-area-inset-bottom))}
  .bottom a{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:11px;color:var(--muted);padding:6px 0;text-decoration:none}
  .bottom a.on{color:var(--secondary);font-weight:600}
  .bottom svg{width:22px;height:22px}
  .bottom .plus{margin-top:-22px}
  .bottom .plus span{width:52px;height:52px;border-radius:50%;background:var(--primary);color:#fff;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 14px rgba(var(--primary-rgb),.45)}
  .hide-sm{display:none!important}
}
@media (min-width:901px){.show-sm{display:none!important}}

/* ---------- elements ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px;margin-bottom:16px}
.card.flush{padding:0;overflow:hidden}
.card-h{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;flex-wrap:wrap}
.bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.bar h1{flex:1;min-width:160px}
.grid{display:grid;gap:16px}
.g2{grid-template-columns:repeat(2,minmax(0,1fr))}.g3{grid-template-columns:repeat(3,minmax(0,1fr))}.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media (max-width:900px){.g3,.g4{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:600px){.g2{grid-template-columns:1fr}.g3,.g4{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}}
.stat{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:14px;box-shadow:var(--shadow)}
.stat .k{font-size:12px;color:var(--muted);font-weight:500}
.stat .v{font-size:20px;font-weight:700;color:var(--secondary);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stat.green .v{color:var(--green)}.stat.red .v{color:var(--red)}
@media (max-width:600px){.stat .v{font-size:16px}}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:9px 14px;border-radius:8px;border:1px solid #cfd6de;background:#fff;color:var(--text);font:inherit;font-weight:500;cursor:pointer;white-space:nowrap;text-decoration:none!important;line-height:1.2}
.btn:hover{border-color:#9aa4ae}
.btn.primary{background:var(--primary);border-color:var(--primary);color:#fff;font-weight:600}
.btn.primary:hover{filter:brightness(.94)}
.btn.dark{background:var(--secondary);border-color:var(--secondary);color:#fff}
.btn.danger{color:var(--red);border-color:#f1c4c7}
.btn.ghost{border-color:transparent;background:transparent}
.btn.sm{padding:6px 10px;font-size:13px}
.btn.block{width:100%}
.btn svg{width:16px;height:16px}
.icon-btn{border:0;background:none;padding:6px;border-radius:6px;cursor:pointer;color:var(--muted);display:inline-flex}
.icon-btn:hover{background:#f1f3f5;color:var(--text)}
.link{background:none;border:0;padding:0;font:inherit;color:var(--secondary);cursor:pointer;text-decoration:underline}
.link.danger{color:var(--red)}
.inline{display:inline}
.btns{display:flex;gap:8px;flex-wrap:wrap}

label.f{display:block;font-size:12px;font-weight:600;color:#4b5563;margin-bottom:12px}
label.f>span.h{display:block;font-weight:400;color:var(--muted);font-size:11px;margin-top:2px}
input,select,textarea{display:block;width:100%;margin-top:4px;padding:9px 11px;border:1px solid #cfd6de;border-radius:8px;font:inherit;color:var(--text);background:#fff;min-height:40px}
textarea{resize:vertical;min-height:70px}
input:focus,select:focus,textarea:focus{outline:2px solid rgba(var(--primary-rgb),.35);border-color:var(--primary)}
input[type=checkbox],input[type=radio]{width:auto;min-height:0;display:inline-block;margin:0;accent-color:var(--primary)}
input[type=color]{padding:2px;height:40px}
.check{display:block;position:relative;padding-left:26px;min-height:18px;line-height:1.45;font-size:13px;font-weight:500;color:var(--text);margin-bottom:10px;cursor:pointer}
.check>input[type=checkbox],.check>input[type=radio]{position:absolute;left:0;top:1px;margin:0;width:16px;height:16px}
.row{display:flex;gap:12px}.row>*{flex:1;min-width:0}
.row>.btn,.row>.icon-btn{flex:0 0 auto}
.row>input[style*="width"],.row>select[style*="width"]{flex:0 1 auto}
@media (max-width:600px){.row.wrap-sm{flex-wrap:wrap}.row.wrap-sm>*{flex:1 1 100%}}
.muted{color:var(--muted)}.small{font-size:12px}.r{text-align:right}.c{text-align:center}.nowrap{white-space:nowrap}.b{font-weight:600}
.err{color:var(--red);font-size:12px;margin-top:2px}
.mt{margin-top:12px}.mb0{margin-bottom:0!important}.p0{padding:0}

.flash{padding:10px 14px;border-radius:10px;margin-bottom:14px;background:#e9f7ef;border:1px solid #bfe5cf;color:#14532d}
.flash.err{background:#fdecee;border-color:#f5c2c7;color:#842029}
.flash ul{margin:4px 0 0 18px;padding:0}

.badge{display:inline-block;font-size:11px;font-weight:600;padding:2px 8px;border-radius:20px;background:#eef1f4;color:#4b5563;white-space:nowrap}
.badge-paid,.badge-active,.badge-completed{background:#e3f6e9;color:#1e7a3c}
.badge-unpaid,.badge-failed,.badge-cancelled,.badge-suspended,.badge-expired{background:#fdecee;color:#a1252e}
.badge-partial,.badge-pending,.badge-pending_dns,.badge-pending_ssl,.badge-draft,.badge-in_progress,.badge-planned{background:#fff4d6;color:#8a6100}
.badge-open,.badge-converted,.badge-removing{background:#e7eefb;color:#1b3a6b}

/* tables → cards on phones */
table.t{width:100%;border-collapse:collapse}
table.t th{font-size:12px;font-weight:600;color:var(--muted);text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);background:#fafbfc;white-space:nowrap}
table.t td{padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:top}
table.t tr:last-child td{border-bottom:0}
table.t tbody tr:hover{background:#fafcff}
table.t tfoot td{font-weight:700;background:#fafbfc;border-top:1px solid var(--line)}
.scroll-x{overflow-x:auto;-webkit-overflow-scrolling:touch}
@media (max-width:700px){
  table.t.stack thead{display:none}
  table.t.stack,table.t.stack tbody,table.t.stack tr,table.t.stack td{display:block;width:100%}
  table.t.stack tr{padding:10px 12px;border-bottom:1px solid var(--line)}
  table.t.stack td{border:0;padding:2px 0;display:flex;justify-content:space-between;gap:10px;text-align:right}
  table.t.stack td::before{content:attr(data-l);color:var(--muted);font-size:12px;text-align:left;flex:0 0 auto}
  table.t.stack td.lead{font-size:15px;text-align:left;display:block}
  table.t.stack td.lead::before{content:none}
  table.t.stack tfoot td{display:flex}
}

.empty{text-align:center;color:var(--muted);padding:40px 16px}
.empty .btn{margin-top:10px}
.filters{display:flex;gap:8px;flex-wrap:wrap;align-items:flex-end;margin-bottom:12px}
.filters input,.filters select{margin:0;min-width:0;width:auto;flex:1 1 140px}
.filters .btn{flex:0 0 auto}
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin-bottom:14px;overflow-x:auto}
.tabs a{padding:9px 14px;color:var(--muted);font-weight:500;border-bottom:2px solid transparent;white-space:nowrap;text-decoration:none}
.tabs a.on{color:var(--secondary);border-color:var(--primary);font-weight:600}
.kv{display:grid;grid-template-columns:auto 1fr;gap:4px 14px;font-size:13px}
.kv dt{color:var(--muted)}.kv dd{margin:0;font-weight:500}
.list-links a{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid var(--line);color:var(--text);text-decoration:none}
.list-links a:last-child{border-bottom:0}
.list-links a:hover{background:#fafcff}
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.tile{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:14px;background:#fff;border:1px solid var(--line);border-radius:var(--radius);color:var(--text);text-decoration:none!important;box-shadow:var(--shadow)}
.tile:hover{border-color:rgba(var(--primary-rgb),.6)}
.tile svg{width:22px;height:22px;color:var(--primary)}
.tile b{font-size:13px}
.chart{display:flex;align-items:flex-end;gap:10px;height:150px;padding-top:10px}
.chart .col{flex:1;display:flex;flex-direction:column;align-items:center;gap:4px;height:100%;justify-content:flex-end}
.chart .bar-v{width:100%;max-width:44px;background:linear-gradient(180deg,var(--primary),rgba(var(--primary-rgb),.6));border-radius:6px 6px 0 0;min-height:2px}
.chart small{font-size:11px;color:var(--muted)}

/* document editor */
.editor .lines{width:100%;border-collapse:collapse}
.editor .lines th{font-size:11px;font-weight:600;color:var(--muted);text-align:left;padding:6px 4px;border-bottom:1px solid var(--line);white-space:nowrap}
.editor .lines td{padding:6px 4px;vertical-align:top;border-bottom:1px solid #f0f2f5}
.editor .lines input,.editor .lines select,.editor .lines textarea{margin:0;padding:7px 8px;min-height:36px}
.editor .lines textarea{min-height:36px;height:36px}
.editor .lines .amt{font-weight:600;padding-top:14px;text-align:right;white-space:nowrap}
.editor .w-qty{width:80px}.editor .w-rate{width:110px}.editor .w-tax{width:84px}.editor .w-unit{width:76px}.editor .w-hsn{width:92px}.editor .w-disc{width:76px}.editor .w-amt{width:110px}
.picker{position:relative}
.picker .dd{position:absolute;left:0;right:0;top:100%;z-index:20;background:#fff;border:1px solid var(--line);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.12);max-height:280px;overflow:auto;margin-top:2px}
.picker .dd div{padding:8px 10px;cursor:pointer;border-bottom:1px solid #f3f4f6;font-size:13px}
.picker .dd div:hover,.picker .dd div.hl{background:rgba(var(--primary-rgb),.1)}
.picker .dd .sub{font-size:11px;color:var(--muted)}
.totals div{display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px solid #f0f2f5;gap:10px}
.totals .grand{font-size:18px;font-weight:700;color:var(--secondary);border-top:2px solid var(--primary);border-bottom:0;padding-top:10px}
.sticky-actions{position:sticky;bottom:0;background:rgba(243,245,248,.96);backdrop-filter:blur(4px);padding:10px 0;display:flex;gap:8px;justify-content:flex-end;z-index:5;border-top:1px solid var(--line)}
@media (max-width:900px){
  /* phones: the Save bar sits fixed right above the bottom menu (the same height on every phone, toolbar or not) */
  .sticky-actions{position:fixed;left:0;right:0;bottom:var(--bnav,62px);padding:8px 12px;margin:0;z-index:31;box-shadow:0 -6px 14px rgba(15,23,42,.08);flex-wrap:wrap}
  .content{padding-bottom:calc(var(--bnav,62px) + 96px)}
  .editor .lines thead{display:none}
  .editor .lines tr{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;padding:10px 0;border-bottom:1px solid var(--line)}
  .editor .lines td{border:0;padding:0}
  .editor .lines td.desc{grid-column:1/-1}
  .editor .lines td[data-l]::before{content:attr(data-l);display:block;font-size:10px;color:var(--muted);font-weight:600}
  .editor .lines .amt{padding-top:16px}
  .editor .w-qty,.editor .w-rate,.editor .w-tax,.editor .w-unit,.editor .w-hsn,.editor .w-disc,.editor .w-amt{width:auto}
}
.preview-frame{width:100%;height:1120px;border:0;background:#fff;border-radius:8px;box-shadow:var(--shadow)}
@media (max-width:700px){.preview-frame{height:78vh}}
.swatch{display:inline-block;width:18px;height:18px;border-radius:4px;border:1px solid rgba(0,0,0,.1);vertical-align:middle}
.auth-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;background:linear-gradient(160deg,rgba(var(--primary-rgb),.12),rgba(var(--secondary-rgb),.08))}
.auth{width:100%;max-width:400px}
.auth .logo{max-height:52px;max-width:220px;margin-bottom:6px}
.modal-bg{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:60;display:flex;align-items:center;justify-content:center;padding:16px}
.modal{background:#fff;border-radius:14px;width:100%;max-width:560px;max-height:90vh;overflow:auto;padding:18px;box-shadow:0 20px 60px rgba(0,0,0,.25)}
.modal h3{margin-bottom:12px}
details.more{border:1px dashed var(--line);border-radius:10px;padding:10px 12px;margin-bottom:12px}
details.more summary{cursor:pointer;font-weight:600;color:var(--secondary)}
.pager{display:flex;gap:6px;justify-content:center;align-items:center;padding:12px;flex-wrap:wrap}
.pager a,.pager span{padding:6px 11px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--text);font-size:13px}
.pager span.on{background:var(--primary);color:#fff;border-color:var(--primary)}
.pager span.dis{color:#bbb}
hr.sep{border:0;border-top:1px solid var(--line);margin:14px 0}
code.inline-code{background:#f3f4f6;border-radius:4px;padding:1px 6px;font-size:12px}
.line-extra{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
.line-extra label{display:flex;flex-direction:column;font-size:10px;color:var(--muted);font-weight:600;min-width:92px;flex:1 1 92px}
.line-extra input{min-height:30px;padding:4px 7px;font-size:12px;margin-top:2px}
.company-switch{margin:0;min-height:34px;padding:5px 8px;max-width:220px;font-weight:600;color:var(--secondary)}
.cat-pill{display:inline-block;font-size:11px;background:rgba(var(--primary-rgb),.12);color:var(--secondary);border-radius:20px;padding:2px 8px}
.grid-att td,.grid-att th{padding:4px 3px!important;text-align:center;font-size:11px}
.att-P{background:#e3f6e9}.att-A{background:#fdecee}.att-H{background:#fff4d6}.att-L{background:#e7eefb}.att-WO,.att-HO{background:#f1f3f5;color:#888}
.seg{display:inline-flex;border:1px solid #cfd6de;border-radius:8px;overflow:hidden}
.seg label{margin:0;padding:6px 9px;font-size:12px;cursor:pointer;border-right:1px solid #e3e7eb;color:var(--text);font-weight:600}
.seg label:last-child{border-right:0}
.seg input{display:none}
.seg input:checked+span{color:#fff}
.seg label:has(input:checked){background:var(--primary);color:#fff}
.designer{display:grid;grid-template-columns:360px minmax(0,1fr);gap:16px;align-items:start}
.designer .preview-frame{height:1050px}
@media (max-width:1000px){.designer{grid-template-columns:1fr}.designer .preview-frame{height:80vh}}
.themes{display:grid;grid-template-columns:repeat(2,1fr);gap:6px}
.themes label{border:1px solid var(--line);border-radius:8px;padding:8px;font-size:12px;cursor:pointer;margin:0;color:var(--text);font-weight:600}
.themes label:has(input:checked){border-color:var(--primary);background:rgba(var(--primary-rgb),.08)}
.themes input{display:none}
.badge-filed,.badge-finalized{background:#e3f6e9;color:#1e7a3c}.badge-prepared{background:#fff4d6;color:#8a6100}
.seg button{border:0;border-right:1px solid #e3e7eb;background:#fff;padding:8px 12px;font:inherit;font-size:13px;color:var(--muted);cursor:pointer}
.seg button:last-child{border-right:0}
.seg button b{color:var(--text);margin-right:4px}
.seg button.on{background:var(--primary);color:#fff}
.seg button.on b{color:#fff}
.badge-b2b{background:#e7eefb;color:#1b3a6b}.badge-b2c{background:#f1f3f5;color:#4a5562}
.editor .amt-in{text-align:right;font-weight:600;margin:0}
.editor .hist{position:relative;display:flex;flex-wrap:wrap;gap:4px 12px;align-items:center;font-size:12px;margin-top:4px;line-height:1.4}
.editor .hist b{color:var(--text)}
.editor .hist button.link{background:none;border:0;padding:0;font:inherit;color:var(--secondary);cursor:pointer;text-decoration:underline dotted}
.editor .hist-pop{position:absolute;top:100%;left:0;z-index:40;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:0 14px 34px -14px rgba(0,0,0,.35);padding:10px 12px;display:grid;gap:10px;min-width:440px;max-width:92vw}
.editor .hist-pop h4{margin:0 0 4px;font-size:12px;color:var(--muted)}
.editor .hist-pop table{border-collapse:collapse;width:100%;font-size:12px}
.editor .hist-pop th,.editor .hist-pop td{padding:3px 6px;border-bottom:1px solid #eef1f4;text-align:left;white-space:nowrap}
.editor .hist-pop .r{text-align:right}
.below-cost{display:block;margin-top:4px;padding:4px 8px;border-radius:6px;background:#fdecec;color:#c62828;border:1px solid #f5b5b5;font-size:12px;font-weight:600;line-height:1.35}
.sticky-actions .below-cost{display:inline-block;margin-top:0;font-size:13px}
.editor select.w-unit{min-width:64px}
.editor .serials{display:block;min-width:220px}
.editor .serials .sn{margin-bottom:4px}
.editor .serials .sn-row{display:flex;gap:4px;align-items:center}
.editor .serials .sn-row input{flex:1;margin:0}
.editor .serials .sn-row input.bad{border-color:#e57373;background:#fff6f6}
.editor .serials .sn-warn{font-size:12px;color:#c62828;font-weight:600;margin:2px 0 0}
.editor .serials .sn-warn a{color:#c62828}
.editor .serials .sn-foot{display:flex;gap:8px;align-items:center;margin-top:2px}
.line-extra label.lx-serial{flex:1 1 100%;max-width:420px;margin-bottom:4px}
.line-extra{gap:8px 12px}
.perm-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:8px}
.perm{display:flex;gap:8px;align-items:flex-start;border:1px solid var(--line);border-radius:10px;padding:9px 10px;cursor:pointer;line-height:1.35}
.perm input{margin-top:3px}
.perm.sens{border-color:#f3c4c4;background:#fffafa}
.sens-tag{display:inline-block;font-size:10px;font-weight:700;color:#b91c1c;background:#fdecec;border-radius:6px;padding:1px 6px;vertical-align:1px}
.nox-net{position:fixed;left:50%;transform:translateX(-50%);top:8px;z-index:9000;padding:9px 16px;border-radius:10px;font-size:13px;box-shadow:0 6px 24px rgba(0,0,0,.18);max-width:calc(100% - 32px)}
.nox-net.off{background:#c62828;color:#fff}
.nox-net.on{background:#16a34a;color:#fff}
.nox-draft{display:flex;gap:8px;align-items:center;flex-wrap:wrap;background:#fff8e1;border-color:#f3d27a;color:#6b4e00}
.nox-draft span{margin-right:auto}
.perm-group{border-top:1px solid var(--line);padding:10px 0 4px}
.perm-group:first-of-type{border-top:0}
.perm-head{display:flex;gap:8px;align-items:center;margin-bottom:8px;cursor:pointer}
/* bill payment: mode + full / partial / credit */
.paybox{display:flex;flex-direction:column;gap:8px}
.paybox select,.paybox input[type=number]{width:100%}
.seg{display:flex;gap:6px;flex-wrap:wrap;margin:2px 0 6px}
.seg label{flex:1 1 130px;display:flex;align-items:center;gap:6px;padding:8px 10px;border:1px solid var(--line);border-radius:8px;cursor:pointer;font-size:13px;background:#fff;min-height:40px}
.seg label.on{border-color:var(--green);background:#eef9f0}
.seg input{margin:0;width:auto}
.seg b{margin-left:auto}
.pay-err,.qty-err{color:#c62828;background:#fdecec;border:1px solid #f5b5b5;border-radius:6px;padding:4px 8px;font-size:12px;font-weight:600}
.qty-err{margin-top:3px;white-space:nowrap}
input.bad{border-color:#c62828!important;background:#fff6f6}
.totals .paybox div{display:block;border-bottom:0;padding:0}
.totals .paybox .row{display:flex}
.totals .paybox .seg{display:flex}
.totals .paybox .pay-err{padding:6px 8px;border-bottom:1px solid #f5b5b5}
.totals .paybox .small.mt{margin-top:2px}
@media (max-width:900px){
  .editor .lines,.editor .lines tbody{display:block;width:100%}
  .editor .lines tr{grid-template-columns:repeat(3,minmax(0,1fr))}
  .editor .lines td{min-width:0}
  .editor .lines td input,.editor .lines td select,.editor .lines td textarea{width:100%;max-width:100%;box-sizing:border-box}
  .editor .serials{min-width:0}
  .editor .line-extra label{min-width:0}
  .totals .paybox .row.wrap-sm>*{flex:1 1 100%}
}
/* small screens: nothing wider than the screen */
@media (max-width:600px){.g2{grid-template-columns:minmax(0,1fr)}}
.card{min-width:0}
input,select,textarea{max-width:100%}
input[type=file]{width:100%;font-size:13px}
.bk .row>.btn,.bk .row form .btn{min-height:40px}
.bk .row>form,.bk .row>.btn{flex:0 0 auto}
@media (max-width:600px){.bk .row>form,.bk .row>.btn{flex:1 1 100%}.bk .row form .btn{width:100%;justify-content:center}}
.bk .row{flex-wrap:wrap}
/* bill line extras: one compact row (MRP · batch · expiry · warranty · serial chip) */
.editor .line-extra{display:flex;flex-wrap:wrap;gap:6px 10px;margin-top:5px;align-items:center}
.editor .line-extra .lx{display:inline-flex;align-items:center;gap:4px;font-size:11px;color:var(--muted);font-weight:600}
.editor .line-extra .lx>span{display:inline-flex;align-items:center}
.editor .line-extra .lx-l{white-space:nowrap}
.editor .line-extra .lx input{width:82px;min-height:28px!important;height:28px;padding:3px 7px!important;font-size:12px;margin:0!important}
.editor .line-extra .lx-batch input{width:100px}
.editor .line-extra .lx-expiry input{width:130px}
.sn-chip{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border:1px dashed #b8c2cc;border-radius:7px;background:#fff;color:var(--secondary);font:inherit;font-size:12px;font-weight:600;cursor:pointer;max-width:320px;white-space:nowrap}
.sn-chip.has{border-style:solid;border-color:var(--primary);background:#f2faf3}
.sn-chip.bad{border-color:#c62828;background:#fff6f6;color:#c62828}
.sn-chip .sn-prev{font-weight:400;color:var(--muted);overflow:hidden;text-overflow:ellipsis;max-width:170px}
.sn-modal{max-width:460px}
.sn-modal .serials{max-height:55vh;overflow:auto;min-width:0}
.sn-modal .sn-n{width:22px;text-align:right;font-size:12px;color:var(--muted);flex:0 0 22px}
.sn-modal .sn-row input{min-height:38px}
@media (max-width:900px){
  .editor .line-extra .lx input{width:76px!important;max-width:none}
  .editor .line-extra .lx-expiry input{width:124px!important}
  .sn-chip{max-width:100%}
}
/* each bill line = a tbody: the main row + one slim row for MRP / warranty / serial */
.editor .lines tbody.ln tr:first-child td{border-bottom:0}
.editor .lines tr.lx-row td{padding:0 4px 8px;border-bottom:1px solid #f0f2f5}
.editor .lines tr.lx-row .line-extra{margin-top:0}
@media (max-width:900px){
  .editor .lines tbody.ln{border-bottom:1px solid var(--line)}
  .editor .lines tbody.ln tr:first-child{border-bottom:0;padding-bottom:4px}
  .editor .lines tr.lx-row{display:block;padding:0 0 10px;border:0}
  .editor .lines tr.lx-row td{display:block;padding:0;border:0}
  .editor .lines tr.lx-row td::before{display:none}
}
.sn-modal .sn-row{display:flex;gap:6px;align-items:center}
.sn-modal .sn-row input{flex:1;margin:0;min-width:0}
.sn-modal .sn-new{min-height:42px;font-size:15px}
.sn-modal .serials .sn{margin-bottom:4px}
/* icon buttons always have a visible icon */
.icon-btn svg{width:18px;height:18px;flex:0 0 18px}
.line-rm{color:#c62828;align-items:center;gap:4px;font:inherit;font-size:12px;font-weight:600}
.line-rm:hover{background:#fdecec;color:#b71c1c}
.editor .lines td.rm{padding-top:10px}
/* tablet / small laptop: narrower columns so the whole line (with Remove) fits */
@media (min-width:901px) and (max-width:1300px){
  .editor .w-qty{width:64px}.editor .w-rate{width:88px}.editor .w-tax{width:72px}.editor .w-unit{width:68px}.editor .w-hsn{width:74px}.editor .w-disc{width:62px}.editor .w-amt{width:88px}
  .editor .lines input,.editor .lines select{padding:7px 5px}
  .editor .lines .amt{font-size:13px}
}
@media (max-width:900px){
  .editor .lines td.rm{grid-column:3;justify-self:end;align-self:end;padding:0}
  .line-rm{border:1px solid #f5b5b5;padding:6px 10px}
}
@media (min-width:901px) and (max-width:1100px){
  .editor .w-qty{width:56px}.editor .w-rate{width:78px}.editor .w-tax{width:64px}.editor .w-unit{width:62px}.editor .w-hsn{width:62px}.editor .w-disc{width:54px}.editor .w-amt{width:76px}
  .editor .lines td{padding:6px 2px}
  .editor .lines td.rm{padding-left:0;padding-right:0}
  .editor .lines td.rm .icon-btn{padding:4px}
}
/* ===== bill entries: one numbered box per entry (all bill types) ===== */
.editor .lines .ln-desc{display:flex;gap:6px;align-items:flex-start}
.editor .lines .ln-desc .picker{flex:1;min-width:0}
.ln-no{flex:0 0 auto;min-width:26px;height:26px;margin-top:5px;padding:0 6px;border-radius:13px;background:var(--secondary);color:#fff;font-size:12px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
.ln-no-h{display:inline-block;min-width:26px;text-align:center;margin-right:6px}
@media (min-width:901px){
  .editor .lines{display:block;--lc:minmax(180px,1fr) 92px 80px 76px 110px 76px 84px 110px 36px}
  .editor .lines.has-cess{--lc:minmax(170px,1fr) 92px 80px 76px 110px 76px 84px 76px 110px 36px}
  .editor .lines thead,.editor .lines tbody.ln{display:block}
  .editor .lines thead tr,.editor .lines tbody.ln>tr:first-child{display:grid;grid-template-columns:var(--lc);column-gap:6px;align-items:start}
  .editor .lines thead tr{padding:0 10px}
  .editor .lines th{border:0;padding:6px 0}
  .editor .lines tbody.ln td{display:block;padding:0;border:0;min-width:0}
  .editor .lines tbody.ln>tr:first-child td input,.editor .lines tbody.ln>tr:first-child td select,.editor .lines tbody.ln>tr:first-child td textarea{width:100%}
  .editor .lines tbody.ln td.rm{padding-top:4px;justify-self:center}
  .editor .lines tbody.ln tr.lx-row{display:block}
  .editor .lines tbody.ln tr.lx-row td{padding:6px 0 0 32px}
}
@media (min-width:901px) and (max-width:1300px){
  .editor .lines{--lc:minmax(150px,1fr) 70px 64px 66px 88px 62px 72px 88px 32px}
  .editor .lines.has-cess{--lc:minmax(140px,1fr) 66px 60px 62px 84px 58px 68px 58px 84px 32px}
}
.editor .lines tbody.ln{border:1px solid #d5dce4!important;border-radius:10px;background:#fff;margin:0 0 10px;padding:10px;box-shadow:0 1px 2px rgba(16,24,40,.04)}
.editor .lines tbody.ln:focus-within{border-color:var(--primary)!important;box-shadow:0 0 0 3px rgba(var(--primary-rgb),.12)}
.editor .lines tbody.ln tr:first-child td,.editor .lines tbody.ln tr.lx-row td{border-bottom:0!important}
@media (max-width:900px){
  .editor .lines tbody.ln{padding:10px;margin-bottom:12px}
  .editor .lines tbody.ln tr:first-child{padding:0 0 6px!important;border:0!important}
  .editor .lines tr.lx-row{padding:6px 0 0!important;border-top:1px dashed #e3e8ee!important}
}
@media (min-width:901px){
  .editor .lines tbody.ln tr.lx-row td input{width:82px}
  .editor .lines tbody.ln tr.lx-row .lx-expiry input{width:130px}
  .editor .lines tbody.ln tr.lx-row .lx-batch input{width:100px}
  .editor .lines th.r{text-align:right}
}
/* tablet / small laptop: item name across the top of the box, the numbers in one labelled row below */
@media (min-width:901px) and (max-width:1180px){
  .editor .lines thead{display:none}
  .editor .lines{--lc:repeat(7,minmax(0,1fr)) minmax(0,1.2fr) 34px}
  .editor .lines.has-cess{--lc:repeat(8,minmax(0,1fr)) minmax(0,1.2fr) 34px}
  .editor .lines tbody.ln>tr:first-child{row-gap:6px}
  .editor .lines tbody.ln td.desc{grid-column:1/-1}
  .editor .lines tbody.ln td[data-l]::before{content:attr(data-l);display:block;font-size:10px;color:var(--muted);font-weight:600;margin-bottom:2px}
  .editor .lines tbody.ln td.amt{padding-top:18px;text-align:right}
  .editor .lines tbody.ln td.rm{align-self:end;padding-bottom:4px}
  .editor .lines tbody.ln td input,.editor .lines tbody.ln td select{padding:7px 5px}
}
/* numbered entry boxes on other line screens (BOM, production) */
.ln-box{align-items:flex-end;border:1px solid #d5dce4;border-radius:10px;padding:10px;margin-bottom:10px;background:#fff}
.ln-box:focus-within{border-color:var(--primary);box-shadow:0 0 0 3px rgba(var(--primary-rgb),.12)}
.ln-box>.ln-no{align-self:center;margin-top:0}
@media (max-width:600px){.row.wrap-sm.ln-box>.ln-no{flex:0 0 auto}}
/* Cash & Bank: on/off switches for invoices */
.stat.acct{display:flex;flex-direction:column;gap:8px}
.acct-sw{display:flex;flex-direction:column;gap:4px;border-top:1px dashed var(--line);padding-top:8px}
.acct-sw form{margin:0}
.sw{display:inline-flex;align-items:center;gap:8px;border:0;background:none;padding:2px 0;font:inherit;font-size:12.5px;color:var(--text);cursor:pointer}
.sw span{position:relative;width:32px;height:18px;border-radius:9px;background:#cfd6de;flex:0 0 32px;transition:background .15s}
.sw span::after{content:'';position:absolute;top:2px;left:2px;width:14px;height:14px;border-radius:50%;background:#fff;transition:left .15s}
.sw.on span{background:var(--green,#16a34a)}
.sw.on span::after{left:16px}
.totals .paybox .print-acc{border-top:1px dashed var(--line);padding-top:8px;margin-top:2px}
.totals .paybox .print-acc .row{display:flex;gap:8px}
.totals .paybox .print-acc .row>label{flex:1 1 160px;min-width:0}
.plan-screens{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px}
.plan-screens .ps-grp{border:1px solid var(--line);border-radius:10px;padding:6px 10px 8px;margin:0}
.plan-screens .ps-grp legend{padding:0 4px}
.plan-screens .ps-grp .check{font-size:13px;margin:3px 0}
/* WhatsApp result / warning on the bill page */
.wa-note{border-radius:10px;padding:9px 12px;margin:0 0 12px;font-size:13.5px;border:1px solid}
.wa-note.ok{background:#eef9f0;border-color:#bfe5c8;color:#14532d}
.wa-note.bad{background:#fff7e6;border-color:#f5d08a;color:#7a4b00}
.wa-off{display:block;margin:0 12px 8px;padding:7px 10px;border-radius:8px;background:#fff7e6;border:1px solid #f5d08a;color:#7a4b00!important;font-size:12px;line-height:1.35;text-decoration:none}
/* WhatsApp connect: QR popup + party popup */
.wa-connect{border:1px solid var(--line);border-radius:10px;padding:10px 12px;margin:8px 0 10px;background:#fbfdfb}
.wa-qr-modal{max-width:400px}
.wa-qr{display:flex;align-items:center;justify-content:center;min-height:260px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px}
.wa-qr img{width:240px;height:240px;image-rendering:pixelated}
.wa-code{font:700 28px/1.2 ui-monospace,Menlo,Consolas,monospace;letter-spacing:4px;text-align:center;margin:12px 0;color:var(--secondary)}
.wa-party{position:fixed;inset:0;z-index:2000;background:rgba(0,0,0,.35);display:flex;align-items:center;justify-content:center;overflow:hidden}
.wa-party-box{position:relative;z-index:2;background:#fff;border-radius:18px;padding:26px 28px;text-align:center;max-width:360px;box-shadow:0 20px 60px rgba(0,0,0,.3);animation:wa-pop .45s cubic-bezier(.2,1.6,.4,1)}
.wa-party-box h3{margin:6px 0}
.wa-party-emoji{font-size:54px;line-height:1}
.wa-party .cf{position:absolute;top:-12px;width:9px;height:14px;border-radius:2px;animation:wa-fall linear forwards;z-index:1}
@keyframes wa-pop{from{transform:scale(.6);opacity:0}to{transform:scale(1);opacity:1}}
@keyframes wa-fall{to{top:105%;transform:rotate(720deg)}}
/* guided tour */
.nt-block{position:fixed;inset:0;z-index:9990;background:transparent}
.nt-hole{position:fixed;z-index:9991;border-radius:10px;box-shadow:0 0 0 9999px rgba(10,22,40,.58);outline:3px solid var(--primary,#4cbb17);outline-offset:0;pointer-events:none;transition:all .2s ease}
.nt-pop{position:fixed;z-index:9992;width:min(380px,calc(100vw - 16px));background:#fff;border-radius:14px;box-shadow:0 18px 50px rgba(10,22,40,.35);padding:14px 16px 12px;font-size:14px;line-height:1.55}
.nt-pop.nt-center{left:50%!important;top:50%!important;transform:translate(-50%,-50%)}
.nt-pop h4{margin:6px 0 4px;font-size:16px;color:var(--secondary,#0f2747)}
.nt-pop .nt-text{color:#374151}
.nt-meta{display:flex;justify-content:space-between;font-size:11.5px;color:var(--muted,#6b7280);text-transform:uppercase;letter-spacing:.04em}
.nt-bar{height:4px;background:#eef1f5;border-radius:4px;margin-top:6px;overflow:hidden}.nt-bar i{display:block;height:100%;background:var(--primary,#4cbb17)}
.nt-btns{display:flex;align-items:center;gap:8px;margin-top:12px}.nt-btns span{flex:1}
.nt-skip{background:none;border:0;color:var(--muted,#6b7280);cursor:pointer;font:inherit;font-size:13px;padding:4px 0}
.nt-offer{position:fixed;right:18px;bottom:18px;z-index:9980;width:300px;background:#fff;border-radius:14px;box-shadow:0 14px 40px rgba(10,22,40,.25);padding:14px 16px;display:flex;flex-direction:column;gap:2px;border-top:4px solid var(--primary,#4cbb17)}
.nt-offer span{color:var(--muted,#6b7280);font-size:13.5px}
@media (max-width:640px){.nt-pop{width:auto}.nt-offer{left:10px;right:10px;bottom:80px;width:auto}}
@media print{.nt-block,.nt-hole,.nt-pop,.nt-offer{display:none!important}}

/* price list picker next to the rate on a bill line */
.rate-wrap{position:relative;display:flex;align-items:center;gap:2px}
.rate-wrap .pp{position:relative;flex:0 0 auto}
.rate-wrap .pp-btn{border:1px solid var(--line);background:#fff;border-radius:6px;padding:0 5px;height:30px;cursor:pointer;color:var(--muted);font-size:12px}
.rate-wrap .pp-btn:hover{color:var(--primary);border-color:var(--primary)}
.rate-wrap .pp-menu{position:absolute;right:0;top:100%;z-index:40;margin-top:4px;background:#fff;border:1px solid var(--line);border-radius:10px;box-shadow:0 10px 30px rgba(15,39,71,.15);min-width:210px;padding:4px}
.rate-wrap .pp-menu button{display:flex;justify-content:space-between;gap:14px;width:100%;border:0;background:none;padding:7px 10px;border-radius:7px;cursor:pointer;font:inherit;font-size:13px;text-align:left}
.rate-wrap .pp-menu button:hover{background:#f1f5f9}.rate-wrap .pp-menu button.on{background:rgba(76,187,23,.12)}

/* Bill of Supply business: no HSN / GST columns on the bill screen */
.editor.no-gst th.w-hsn,.editor.no-gst td[data-l="HSN/SAC"],.editor.no-gst th.w-tax,.editor.no-gst td[data-l="GST %"],.editor.no-gst td[data-l="Cess %"]{display:none!important}
/* landing costs on a purchase bill */
.landing-row{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(70px,.8fr) minmax(0,1fr) 28px;gap:6px;align-items:center;margin-top:6px}
.landing-row input,.landing-row select{margin:0;min-width:0}
@media (max-width:640px){.landing-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 28px}.landing-row input[list]{grid-column:1/-1}}
/* "Last 5" history tables inside a bill line: keep them real tables (the line's grid / card rules must not reach them) */
.editor .lines tbody.ln .hist-pop table{display:table!important;width:100%;border-collapse:collapse}
.editor .lines tbody.ln .hist-pop tbody{display:table-row-group!important;border:0!important;padding:0!important;margin:0!important;box-shadow:none!important;background:none!important}
.editor .lines tbody.ln .hist-pop tr{display:table-row!important;padding:0!important;border:0!important;grid-template-columns:none!important}
.editor .lines tbody.ln .hist-pop th,.editor .lines tbody.ln .hist-pop td{display:table-cell!important;padding:3px 6px!important;border-bottom:1px solid #eef1f4!important;text-align:left;white-space:nowrap;vertical-align:middle;min-width:0}
.editor .lines tbody.ln .hist-pop th{font-size:11px;color:var(--muted);font-weight:600}
.editor .lines tbody.ln .hist-pop .r{text-align:right!important}
.editor .lines tbody.ln .hist-pop td::before{content:none!important}
@media (max-width:900px){.editor .hist-pop{min-width:0;left:0;right:0;max-width:none;overflow-x:auto}}
.editor .lines tbody.ln .hist-pop tr[style*="none"]{display:none!important}
/* Bill of Supply: no HSN / GST / cess columns — the line grid drops those columns too, so every box stays under its heading */
.editor.no-gst th.w-cess{display:none!important}
@media (min-width:901px){
  .editor.no-gst .lines,.editor.no-gst .lines.has-cess{--lc:minmax(200px,1fr) 90px 80px 120px 80px 120px 36px}
}
@media (min-width:901px) and (max-width:1300px){
  .editor.no-gst .lines,.editor.no-gst .lines.has-cess{--lc:minmax(170px,1fr) 76px 70px 96px 70px 96px 32px}
}
@media (min-width:901px) and (max-width:1180px){
  .editor.no-gst .lines,.editor.no-gst .lines.has-cess{--lc:repeat(4,minmax(0,1fr)) minmax(0,1.2fr) 34px}
}
/* Settings home: grouped cards */
.set-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:start;margin-bottom:16px}
.set-groups .set-group{margin:0}
.set-gh{display:flex;align-items:center;gap:8px;padding:12px 16px 8px;font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--secondary);border-bottom:1px solid var(--line)}
.set-gh svg{width:16px;height:16px;color:var(--primary)}
@media (max-width:900px){.set-groups{grid-template-columns:minmax(0,1fr)}}
/* search bar (top right on every page) */
.gsearch{position:relative;flex:0 1 360px;min-width:0;margin-left:auto}
.gsearch .gs-icon{display:none}
.gs-box{display:flex;align-items:center;gap:6px;background:#f3f5f8;border:1px solid var(--line);border-radius:10px;padding:0 8px;height:38px}
.gs-box:focus-within{background:#fff;border-color:var(--primary);box-shadow:0 0 0 3px rgba(var(--primary-rgb),.12)}
.gs-box input{flex:1;min-width:0;border:0!important;background:transparent!important;box-shadow:none!important;margin:0;padding:0 2px;height:36px;font-size:14px;outline:0}
.gs-mag{color:var(--muted);display:inline-flex}
.gs-kbd{font:600 13px/1 -apple-system,"Segoe UI",system-ui,sans-serif;color:#4b5563;border:1px solid #d5dbe3;border-bottom-width:2px;border-radius:6px;padding:4px 7px;background:#fff;white-space:nowrap;letter-spacing:.02em}
.gs-box:focus-within .gs-kbd{display:none}
.gs-close{display:none;border:0;background:none;font-size:16px;color:var(--muted);cursor:pointer;padding:4px}
.gs-pop{position:absolute;right:0;top:calc(100% + 6px);width:min(460px,92vw);max-height:70vh;overflow:auto;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 18px 44px -14px rgba(0,0,0,.35);z-index:60;padding:6px}
.gs-row{display:flex;flex-direction:column;gap:1px;padding:8px 10px;border-radius:8px;text-decoration:none;color:var(--text)}
.gs-row.hl,.gs-row:hover{background:#f2f8ee}
.gs-row b{font-weight:600;font-size:14px}.gs-row mark{background:#fff3b0;color:inherit;border-radius:2px;padding:0 1px}
.gs-g{font-size:10.5px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;color:var(--muted)}
.gs-s{font-size:12px;color:var(--muted)}
.gs-empty{padding:12px;color:var(--muted);font-size:13px}
@media (max-width:900px){
  .gsearch{flex:0 0 auto;position:static}
  .gsearch .gs-icon{display:inline-flex}
  .gs-box{display:none;position:absolute;left:8px;right:8px;top:9px;z-index:61;background:#fff;height:40px}
  .gs-box.show{display:flex}
  .gs-kbd{display:none}.gs-close{display:inline-flex}
  .gs-pop{left:8px;right:8px;width:auto;top:54px}
}
/* bill line boxes follow the Invoice layout designer (columns switched off there are not shown here either) */
.editor .lines.hide-hsn th.w-hsn,.editor .lines.hide-hsn td[data-l="HSN/SAC"],
.editor .lines.hide-unit th.w-unit,.editor .lines.hide-unit td[data-l="Unit"],
.editor .lines.hide-disc th.w-disc,.editor .lines.hide-disc td[data-l="Disc %"],.editor .lines.hide-disc td[data-l="Disc ₹"],
.editor .lines.hide-tax th.w-tax,.editor .lines.hide-tax td[data-l="GST %"],
.editor .lines.hide-cess th.w-cess,.editor .lines.hide-cess td[data-l="Cess %"]{display:none!important}
@media (min-width:901px){.editor .lines.dyn.dyn{--lc:var(--lc-l)}}
@media (min-width:901px) and (max-width:1300px){.editor .lines.dyn.dyn{--lc:var(--lc-m)}}
@media (min-width:901px) and (max-width:1180px){.editor .lines.dyn.dyn{--lc:var(--lc-t)}}
.editor .lines .ln-details{display:block;box-sizing:border-box;width:calc(100% - 32px)!important;max-width:calc(100% - 32px)!important;margin:4px 0 0 32px!important;min-height:32px!important;height:32px;font-size:13px;color:#374151;resize:vertical}
@media (max-width:900px){.editor .lines .ln-details{width:100%!important;max-width:100%!important;margin-left:0!important}}
/* header: back / forward / reload / home on the left, New · Help · Full screen on the right */
.topnav{display:flex;align-items:center;gap:2px;flex:0 0 auto}
.topnav .icon-btn,.topact .icon-btn{width:34px;height:34px;border-radius:9px;display:inline-flex;align-items:center;justify-content:center;color:var(--secondary);background:none;border:0;cursor:pointer;text-decoration:none}
.topnav .icon-btn:hover,.topact .icon-btn:hover{background:#eef2f6}
.topact{display:flex;align-items:center;gap:4px;flex:0 0 auto}
.topact .tnew{width:auto;padding:0 10px;gap:4px;background:var(--primary);color:#fff;font-weight:600;font-size:13px}
.topact .tnew:hover{background:var(--primary);filter:brightness(.95)}
.tdrop{position:relative}
.tmenu{position:absolute;right:0;top:calc(100% + 6px);min-width:220px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 18px 44px -14px rgba(0,0,0,.35);padding:6px;z-index:60}
.tmenu a{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;color:var(--text);text-decoration:none;font-size:14px;white-space:nowrap}
.tmenu a:hover{background:#f2f8ee}
.tmenu a svg{color:var(--muted)}
@media (max-width:900px){
  .topnav{gap:0}.topnav .icon-btn,.topact .icon-btn{width:32px;height:32px}
  .top .title{font-size:14px}
  .topact .tnew{width:32px;padding:0}
}
@media (max-width:420px){.top .title{display:none}}
@media (min-width:901px) and (max-width:1150px){.gs-kbd{display:none}.gsearch{flex:0 1 220px}.topnav .icon-btn.hide-sm{display:none}}
/* "not in your plan" / "no access" popup over the blurred screen */
.blk-bg{position:fixed;inset:0;z-index:400;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(15,23,42,.38);backdrop-filter:blur(6px) saturate(.9);-webkit-backdrop-filter:blur(6px) saturate(.9)}
.blk{background:#fff;border-radius:20px;width:100%;max-width:480px;padding:28px 26px 18px;text-align:center;box-shadow:0 30px 80px -20px rgba(0,0,0,.5);animation:blkUp .22s ease-out}
@keyframes blkUp{from{transform:translateY(16px) scale(.98);opacity:0}to{transform:none;opacity:1}}
.blk-ic{width:64px;height:64px;border-radius:50%;margin:0 auto 14px;display:flex;align-items:center;justify-content:center}
.blk-ic.up{background:linear-gradient(135deg,var(--primary),#2e7d0f);color:#fff;box-shadow:0 10px 24px -8px rgba(var(--primary-rgb),.6)}
.blk-ic.lock{background:#fef3c7;color:#b45309}
.blk h2{margin:0 0 8px;font-size:21px;color:var(--secondary)}
.blk-m{margin:0 0 16px;color:#4b5563;font-size:14.5px;line-height:1.55}
.blk-plan{display:inline-flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:center;background:#f3f6f9;border-radius:999px;padding:6px 14px;font-size:13px;margin-bottom:14px}
.blk-plan span{color:var(--muted)}.blk-plan .blk-till{font-size:12px}
.blk-who{font-size:13.5px;color:#374151;margin-bottom:12px}
.blk-btns{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin-bottom:6px}
.blk-btns .btn{min-width:96px;justify-content:center}
.blk-wa{background:#25d366!important;border-color:#25d366!important;color:#fff!important}
.blk-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:14px;padding-top:12px;border-top:1px solid var(--line);font-size:13px}
.blk-foot .btn{margin-left:auto}
@media (max-width:480px){.blk{padding:22px 16px 14px}.blk-btns .btn{flex:1 1 100%}}
/* invoice designer: computer-generated note */
.cn-box{border:1px dashed var(--line);border-radius:10px;padding:10px 12px;margin:4px 0 12px;background:#fafcfb}
.cn-style{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.cn-style label{display:inline-flex;cursor:pointer}
.cn-style input{position:absolute;opacity:0;pointer-events:none}
.cn-style span{padding:7px 12px;border:1px solid var(--line);border-radius:8px;background:#fff;font-size:13px}
.cn-style input:checked+span{border-color:var(--primary);background:rgba(var(--primary-rgb),.1);color:var(--secondary)}
.cn-style input:focus-visible+span{outline:2px solid var(--primary)}
/* backup page: scope note + delete warning */
.scope-note{display:flex;gap:10px;align-items:flex-start;background:#fff8e6;border:1px solid #f5d38a;color:#5b4300;border-radius:12px;padding:10px 14px;margin:0 0 14px;font-size:13.5px;line-height:1.5}
.scope-note svg{flex:0 0 auto;margin-top:2px;color:#b45309}
.rs-bg{position:fixed;inset:0;z-index:400;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(15,23,42,.42);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px)}
.rs{background:#fff;border-radius:18px;width:100%;max-width:480px;max-height:92vh;overflow:auto;padding:22px 22px 16px;box-shadow:0 30px 80px -20px rgba(0,0,0,.5);animation:blkUp .2s ease-out}
.rs-ic{width:54px;height:54px;border-radius:50%;background:#fee2e2;color:#dc2626;font:800 28px/54px system-ui;text-align:center;margin:0 auto 10px}
.rs h2{text-align:center;font-size:19px;margin:0 0 6px;color:#991b1b}
.rs-scope{text-align:center;margin:0 0 10px;font-size:13.5px;color:#7f1d1d;background:#fef2f2;border-radius:8px;padding:6px 10px}
.rs-list{border:1px solid #fecaca;border-radius:12px;overflow:hidden;margin:8px 0 10px}
.rs-h{background:#fef2f2;color:#991b1b;font-weight:700;font-size:12px;letter-spacing:.03em;text-transform:uppercase;padding:7px 10px}
.rs-row{display:flex;justify-content:space-between;gap:10px;padding:6px 10px;border-top:1px solid #fde8e8;font-size:13.5px}
.rs-row b{font-variant-numeric:tabular-nums}
.rs-tot{background:#fffafa;font-weight:700}
.rs-keep{font-size:13px;color:#166534;background:#f0fdf4;border-radius:8px;padding:8px 10px;margin:0 0 8px}
.rs-safe{font-size:12.5px;color:var(--muted);margin:0 0 10px}
.rs-btns{display:flex;gap:8px;justify-content:flex-end;margin-top:4px}
.rs-btns .btn.danger:disabled{opacity:.45;cursor:not-allowed}
.auth-help{margin-top:14px;background:#f6f8fa;border-radius:10px;padding:10px 12px;font-size:13px;color:#374151}
.auth-help ul{margin:4px 0 0 18px;padding:0}.auth-help li{margin:2px 0}

/* phones: nothing wider than the screen */
@media (max-width:640px){
  .btn{white-space:normal;max-width:100%;text-align:center}
  .btn.primary,.btn.block{min-height:42px}
  code{word-break:break-all;white-space:normal}
  .row>.check{flex:1 1 100%!important;min-width:0}
  .card img,.card video,.card iframe{max-width:100%}
}

/* ---------- tailoring / stitching ---------- */
.tl-nav{margin-bottom:12px}
.tl-chips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}
.tl-chips a{display:inline-flex;align-items:center;gap:6px;padding:6px 11px;border-radius:999px;border:1px solid var(--line,#e5e7eb);background:#fff;color:var(--text);font-size:13px;text-decoration:none}
.tl-chips a.on{border-color:var(--primary);background:rgba(var(--primary-rgb,76,187,23),.08);font-weight:600}
.tl-chips a i{width:8px;height:8px;border-radius:50%;display:inline-block}.tl-chips a b{color:var(--muted);font-weight:600}
.tl-days{display:inline-block;font-size:11.5px;font-weight:600;padding:1px 7px;border-radius:999px;background:#eef2f6;color:#475569;white-space:nowrap}
.tl-days.soon{background:#fff7ed;color:#c2410c}.tl-days.late{background:#fef2f2;color:#dc2626}
.tl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:0 12px}
.tl-grid.tl-small{grid-template-columns:repeat(auto-fill,minmax(110px,1fr))}.tl-grid .tl-name{grid-column:span 2}
.tl-line{border-left:3px solid var(--primary)}
.tl-line-h{display:flex;gap:10px;align-items:center;margin-bottom:8px}
.tl-no{flex:0 0 26px;height:26px;border-radius:50%;background:var(--secondary,#1b3a6b);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px}
.tl-meas{background:#f8fafc;border:1px solid var(--line,#e5e7eb);border-radius:10px;padding:10px 12px;margin:4px 0 10px}
.tl-meas-h{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:6px}.tl-meas-h b{display:inline-flex;gap:6px;align-items:center}
.tl-meas-g{display:grid;grid-template-columns:repeat(auto-fill,minmax(112px,1fr));gap:2px 10px}
.tl-meas-g .f{margin-bottom:6px;font-size:12px}.tl-meas-g .f input{text-align:center;font-weight:600;font-size:15px;padding:7px 6px}
.tl-add-m{grid-column:1/-1;display:flex;gap:6px;margin-top:2px}.tl-add-m input{margin:0;flex:1;min-width:0;font-size:13px}
.tl-photos{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.tl-ph{position:relative;width:78px;height:78px;border-radius:10px;overflow:hidden;border:1px solid var(--line,#e5e7eb);display:block}
.tl-ph img{width:100%;height:100%;object-fit:cover}.tl-ph.new{opacity:.85;outline:2px dashed var(--primary)}
.tl-ph button{position:absolute;top:3px;right:3px;width:22px;height:22px;border-radius:50%;border:0;background:rgba(0,0,0,.6);color:#fff;font-size:12px;cursor:pointer}
.tl-ph-add{display:inline-flex;align-items:center;justify-content:center;height:78px;padding:0 14px;border:1.5px dashed #cbd5e1;border-radius:10px;cursor:pointer;color:var(--muted);font-size:13px;text-align:center}
.tl-tot{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px 16px;align-items:end}
.tl-tot>div{display:flex;flex-direction:column}.tl-tot>div span{font-size:12px;color:var(--muted)}.tl-tot>div b{font-size:19px}
.tl-steps{display:flex;gap:0;padding:12px 8px;overflow-x:auto}
.tl-step{flex:1 1 0;min-width:84px;position:relative}
.tl-step:not(:last-child)::after{content:"";position:absolute;top:17px;left:calc(50% + 18px);right:calc(-50% + 18px);height:3px;background:#e5e7eb}
.tl-step.done:not(.cur)::after{background:var(--primary)}
.tl-step button{width:100%;border:0;background:none;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:5px;font:inherit;color:var(--muted);font-size:12px;padding:0}
.tl-step i{font-style:normal;width:34px;height:34px;border-radius:50%;background:#e5e7eb;color:#64748b;display:flex;align-items:center;justify-content:center;font-weight:700}
.tl-step.done i{background:var(--primary);color:#fff}.tl-step.cur i{box-shadow:0 0 0 4px rgba(var(--primary-rgb,76,187,23),.25)}.tl-step.cur span{color:var(--text);font-weight:700}
.tl-kv{display:flex;justify-content:space-between;gap:12px;padding:6px 0;border-bottom:1px solid #f1f5f9;font-size:14px}.tl-kv span{color:var(--muted)}.tl-kv b{text-align:right;font-weight:600}
.tl-item-h{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:8px}.tl-item-h b{font-size:16px}
.tl-mv{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:6px}
.tl-mv div{background:#f8fafc;border:1px solid var(--line,#e5e7eb);border-radius:8px;padding:5px 9px}.tl-mv span{display:block;font-size:11px;color:var(--muted)}.tl-mv b{font-size:16px}
.tl-board{display:grid;grid-template-columns:repeat(4,minmax(240px,1fr));gap:12px;overflow-x:auto;padding-bottom:8px;scroll-snap-type:x mandatory}
.tl-col{background:#f1f5f9;border-radius:12px;padding:10px;scroll-snap-align:start;min-height:120px}
.tl-col h3{display:flex;align-items:center;gap:8px;margin:2px 4px 10px;font-size:14px}.tl-col h3 i{width:10px;height:10px;border-radius:50%;background:var(--c)}
.tl-col h3 span{margin-left:auto;background:#fff;border-radius:999px;padding:0 9px;font-size:12px;color:var(--muted)}
.tl-card{background:#fff;border-radius:10px;border-left:4px solid var(--c);box-shadow:0 1px 2px rgba(15,23,42,.08);margin-bottom:8px;overflow:hidden}
.tl-card-a{display:block;padding:9px 11px 6px;color:var(--text);text-decoration:none;font-size:13.5px}
.tl-card-t{display:flex;justify-content:space-between;gap:6px;align-items:center;margin-bottom:2px}
.tl-next{width:100%;border:0;border-top:1px solid #f1f5f9;background:#fafafa;padding:8px 10px;text-align:right;font:600 12.5px inherit;color:var(--c);cursor:pointer}
.tl-next:hover{background:#f1f5f9}.tl-none{text-align:center;color:var(--muted);padding:10px}
.tl-filter{display:flex;flex-wrap:wrap;gap:0 12px;align-items:end}.tl-filter .f{flex:1 1 150px}
.tl-sched tr.late td{background:#fff5f5}
.tl-cats{display:flex;flex-direction:column;border:1px solid var(--line,#e5e7eb);border-radius:10px;overflow:hidden}
.tl-cat{border-bottom:1px solid var(--line,#e5e7eb)}.tl-cat:last-child{border-bottom:0}.tl-cat.off{opacity:.55}
.tl-cat-h{display:flex;gap:8px;align-items:baseline;flex-wrap:wrap;padding:10px 12px;cursor:pointer}.tl-cat-h:hover{background:#f8fafc}
.tl-catform{padding:10px 12px;background:#f8fafc;border-top:1px dashed var(--line,#e5e7eb)}
.onlyprint{display:none}
@media print{.onlyprint{display:block}.noprint,.side,.topbar,.bottom,.tl-nav{display:none!important}}
@media (max-width:640px){
  .tl-board{grid-template-columns:repeat(4,86vw)}
  .tl-grid .tl-name{grid-column:1/-1}
  .tl-meas-g{grid-template-columns:repeat(3,minmax(0,1fr))}
  .tl-tot>div b{font-size:17px}
}
.tl-wa{margin-bottom:12px}.tl-wa textarea{width:100%;font-size:13px}
