*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{height:100%}
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#6B35E8;margin:0;padding:0;color:#fff;min-height:100vh;overflow-x:hidden}
.navbar{background:#5A28D4;padding:0 14px;display:flex;justify-content:space-between;align-items:center;border-bottom:2px solid rgba(255,255,255,.25);position:fixed;top:0;left:0;right:0;z-index:2000;height:52px}
.navbar-logo{height:32px;width:auto;object-fit:contain;display:block}
.burger{cursor:pointer;display:flex;flex-direction:column;justify-content:space-between;width:22px;height:16px;flex-shrink:0}
.burger span{display:block;height:3px;width:100%;background:#fff;border-radius:3px}
.badge{display:inline-block;padding:3px 8px;border-radius:16px;font-size:11px;font-weight:bold;background:rgba(255,255,255,.18);color:#fff;flex-shrink:0;white-space:nowrap}
.overlay{position:fixed;inset:0 auto 0 0;width:min(82vw,300px);background:#5A28D4;z-index:1900;transform:translateX(-105%);transition:transform .28s ease;box-shadow:5px 0 20px rgba(0,0,0,.4);padding-top:58px;padding-bottom:40px;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
.overlay.open{transform:translateX(0)}
.overlay-backdrop{display:none;position:fixed;inset:0;z-index:1800;background:rgba(0,0,0,.4)}
.overlay-backdrop.on{display:block}
.m-cat{padding:10px 18px 3px;font-size:11px;text-transform:uppercase;color:rgba(255,255,255,.5);font-weight:bold;letter-spacing:.5px}
.m-item{padding:13px 24px;font-size:14px;color:#fff;font-weight:600;text-decoration:none;display:block;border-bottom:1px solid rgba(255,255,255,.07);cursor:pointer;-webkit-user-select:none}
.m-item:active,.m-item.sel{background:#6B35E8}
.container{max-width:640px;margin:60px auto 40px;padding:0 11px;display:flex;flex-direction:column;gap:14px}
.card{background:#fff;border-radius:16px;padding:15px 14px;box-shadow:0 4px 12px rgba(0,0,0,.2);color:#000;display:none;overflow:hidden}
.card.show{display:block}
h2{color:#6B35E8;margin:0 0 13px;border-bottom:2px solid #6B35E8;padding-bottom:7px;font-size:16px}
h3{color:#6B35E8;font-size:13px;margin:13px 0 5px}
.fg{margin-bottom:10px}
label{display:block;margin-bottom:3px;font-size:12px;color:#444;font-weight:600}
input,select,button{font:inherit;min-width:0;box-sizing:border-box}
input[type=date],input[type=number],input[type=text],input[type=password],select,textarea{width:100%;max-width:100%;padding:11px 12px;border:2px solid #6B35E8;border-radius:8px;background:#fff;color:#000;font-size:15px;-webkit-appearance:none;appearance:none;height:auto;outline:none}
input[type=text]:focus,input[type=password]:focus,input[type=date]:focus,input[type=number]:focus,select:focus{border-color:#5A28D4;box-shadow:0 0 0 3px rgba(107,53,232,.15)}
.btn{background:#6B35E8;color:#fff;border:none;padding:13px;border-radius:8px;font-weight:bold;cursor:pointer;width:100%;font-size:14px;margin-top:6px;text-transform:uppercase;letter-spacing:.3px}
.btn:active{background:#5A28D4}
.btn-sm{background:#6B35E8;color:#fff;border:none;padding:7px 13px;border-radius:6px;font-weight:bold;cursor:pointer;font-size:12px}
.btn-danger{background:#c62828}
.btn-green{background:#2e7d32}
.btn-outline{background:#fff;color:#6B35E8;border:2px solid #6B35E8;text-decoration:none;text-align:center;display:block}
.table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;margin-top:8px}
table{width:100%;border-collapse:collapse;font-size:13px;color:#000}
th,td{padding:8px 6px;text-align:left;border-bottom:1px solid #eee;white-space:nowrap}
th{color:#6B35E8;font-weight:bold;background:#f5f5f5}
.flash{padding:11px 14px;border-radius:10px;font-weight:700;line-height:1.35;margin-bottom:12px;font-size:13px;animation:flash-pop .2s ease}
.flash.ok{background:#e8f5e9;border:2px solid #2e7d32;color:#1b5e20}
.flash.err{background:#ffebee;border:2px solid #c62828;color:#b71c1c}
.warn{background:#fff3e0;border:1px solid #e65100;color:#bf360c;padding:10px 12px;border-radius:10px;margin-bottom:12px;font-weight:600;font-size:12px}
.fin-box{padding:11px 12px;border-radius:8px;background:#f5f5f5;border:1px solid #e0e0e0;margin-bottom:8px}
.fin-box h4{margin:0 0 3px;font-size:12px;font-weight:600}
.fin-box p{margin:0;font-size:19px;font-weight:bold}
.date-row{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:flex-end;margin-bottom:12px}
.date-row .fg{margin-bottom:0}
.date-row .btn{width:auto;padding:11px 14px;margin-top:0;white-space:nowrap}
.stack-form{display:grid;grid-template-columns:1fr auto;gap:8px;align-items:flex-end}
.stack-form .fg{margin-bottom:0}
.stack-form .btn{width:auto;padding:11px 14px;margin-top:0;white-space:nowrap}
.line-grid{display:grid;grid-template-columns:minmax(0,1fr) 76px;gap:8px;align-items:center;padding:8px 0;border-bottom:1px solid #e8e0ff}
.line-grid .name{min-width:0;font-size:13px;font-weight:600;color:#333;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.25}
.line-grid .meta{font-size:11px;color:#6B35E8;font-weight:700;margin-top:2px}
.line-grid input,.line-grid select{margin:0;padding:9px 6px;text-align:center;font-size:14px}
.purchase-row{background:#faf7ff;border:1px solid #e6dcff;border-radius:12px;padding:10px;display:flex;flex-direction:column;gap:8px}
.purchase-head{display:grid;grid-template-columns:minmax(0,1fr) 26px;gap:6px;align-items:center}
.purchase-remove{width:26px;height:26px;border:none;border-radius:50%;background:#c62828;color:#fff;font-size:18px;line-height:1;display:flex;align-items:center;justify-content:center;font-weight:700;padding:0;flex-shrink:0}
.purchase-row .purchase-name{width:100%;font-size:15px;font-weight:700;padding:11px 10px;border:2px solid #6B35E8;border-radius:8px;background:#fff;color:#000;-webkit-appearance:none;appearance:none;outline:none}
.purchase-bottom{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.8fr) minmax(0,1.45fr) minmax(0,1.1fr);gap:5px}
.purchase-bottom input,.purchase-bottom select{padding:10px 6px;font-size:13px;text-align:center}
.purchase-row .sum-box{display:flex;align-items:center;justify-content:center;border:1px solid #6B35E8;border-radius:8px;background:#f8f4ff;color:#4a15cc;font-weight:800;padding:9px 8px;font-size:13px;white-space:nowrap}
.block-actions{display:grid;grid-template-columns:1fr;gap:8px;margin-top:10px}
.purchase-tools{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}
.purchase-tools .btn-sm{grid-column:1/-1;width:100%;padding:10px}
.purchase-tools .mini{display:flex;align-items:center;justify-content:center;gap:5px;background:#f8f4ff;border:1px solid #e1d6ff;border-radius:10px;padding:9px 10px;color:#4a15cc;font-weight:800;font-size:12px;white-space:nowrap;overflow:hidden}
.compact-list{margin-top:6px;border:1px solid #eee;border-radius:10px;overflow:hidden}
.compact-list .list-row{display:flex;justify-content:space-between;gap:8px;align-items:center;padding:9px 11px;border-bottom:1px solid #eee}
.compact-list .list-row:last-child{border-bottom:none}
.compact-list .list-row span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}
.compact-list .list-row b{white-space:nowrap;font-size:13px}
.invoice-list{display:flex;flex-direction:column;gap:7px}
.invoice-item{display:grid;grid-template-columns:28px minmax(0,1fr) auto;gap:7px;align-items:center;padding:10px 11px;border:1px solid #e3d9ff;border-radius:10px;background:#fbf8ff;cursor:pointer}
.invoice-item .inv-main{min-width:0}
.invoice-item .inv-main .title{font-weight:700;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.invoice-item .inv-main .sub{font-size:11px;color:#7a7a7a;margin-top:2px}
.invoice-item .inv-sum{text-align:right;white-space:nowrap;font-weight:700;color:#2e7d32;font-size:13px}
.doc-list{display:flex;flex-direction:column;gap:8px;margin-top:8px}
.doc-row{display:grid;grid-template-columns:92px minmax(0,1fr) auto 34px;gap:8px;align-items:center;padding:10px;border:1px solid #e3d9ff;border-radius:12px;background:#fbf8ff;text-decoration:none;color:#111}
.doc-row:hover{background:#f5efff}
.doc-type{font-size:11px;font-weight:800;color:#6B35E8;text-transform:uppercase}
.doc-date{font-size:11px;color:#777;margin-top:2px}
.doc-desc{min-width:0;font-weight:700;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.doc-sum{font-weight:800;color:#2e7d32;white-space:nowrap;font-size:13px;text-align:right}
.doc-download{width:34px;height:34px;border-radius:9px;background:#6B35E8;color:#fff;display:flex;align-items:center;justify-content:center;text-decoration:none;font-weight:900}
@keyframes flash-pop{from{transform:scale(.98);opacity:.7}to{transform:scale(1);opacity:1}}
/* Аккордеон в боковом меню */
.m-group-head{padding:13px 24px;font-size:14px;color:#fff;font-weight:600;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid rgba(255,255,255,.07);cursor:pointer;-webkit-user-select:none}
.m-group-head:active,.m-group-head.sel{background:#6B35E8}
.m-group-body{display:none;background:rgba(0,0,0,.15)}
.m-group-body .m-item{padding:11px 24px 11px 34px;font-size:13px;font-weight:500}
.m-arrow{font-size:11px;transition:transform .22s;display:inline-block;opacity:.8}
/* Аккордеон производства */
.prod-section-btn{display:flex;justify-content:space-between;align-items:center;padding:11px 12px;background:#f5f0ff;border:1px solid #e0d6ff;border-radius:8px;cursor:pointer;margin-bottom:2px;font-weight:600;font-size:14px;color:#4a15cc;-webkit-user-select:none}
.prod-section-btn:active{background:#ede5ff}
.prod-arrow{font-size:12px;transition:transform .22s;display:inline-block}
.prod-section-body{display:none;margin-bottom:10px}
@media(max-width:480px){
  .container{margin-top:60px;padding:0 9px;gap:11px}
  .card{padding:13px 12px}
  .purchase-bottom{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .date-row{grid-template-columns:1fr 1fr;gap:6px}
  .date-row .btn{grid-column:1/-1;width:100%}
  .line-grid{grid-template-columns:minmax(0,1fr) 66px;gap:6px}
  .invoice-item{grid-template-columns:26px minmax(0,1fr)}
  .invoice-item .inv-sum{grid-column:2;justify-self:start}
  .doc-row{grid-template-columns:1fr auto;gap:6px}
  .doc-row .doc-meta{grid-column:1}
  .doc-desc{grid-column:1/-1}
  .doc-sum{grid-column:1;justify-self:start}
  .doc-download{grid-column:2;grid-row:1 / span 3}
}
