@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --red:#e02020;--red-dark:#b81818;--red-glow:rgba(224,32,32,0.18);
  --bg:#0f0f0f;--surface:#1c1c1e;--surface-2:#252528;--surface-3:#2e2e32;
  --text:#f2f2f7;--text-secondary:#aeaeb2;--text-muted:#636366;
  --border:rgba(255,255,255,0.08);--border-med:rgba(255,255,255,0.16);
  --success-bg:rgba(48,209,88,0.12);--success:#30d158;
  --warning-bg:rgba(255,159,10,0.12);--warning:#ff9f0a;
  --danger-bg:rgba(255,69,58,0.12);--danger:#ff453a;
  --info-bg:rgba(10,132,255,0.12);--info:#0a84ff;
  --r:13px;--r-sm:9px;--nb-h:66px;--safe-bottom:env(safe-area-inset-bottom, 0px);--tb-h:56px;
}
html,body{max-width:800px;margin: 0 auto;height:100%;overflow:hidden;font-family:'Montserrat',system-ui,sans-serif;background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased}
.screen{display:none;height:100vh;height:100dvh;overflow:hidden}
.screen.active{display:flex;flex-direction:column}
.view{display:none;flex-direction:column;height:100vh;height:100dvh;overflow:hidden}
.view.active{display:flex}

.login-wrap{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 28px;background:var(--bg);overflow:hidden;position:relative}
.login-wrap::before{content:'';position:absolute;top:-80px;left:50%;transform:translateX(-50%);width:480px;height:480px;background:radial-gradient(ellipse,rgba(224,32,32,0.14) 0%,transparent 65%);pointer-events:none}
.login-logo{text-align:center;margin-bottom:44px;position:relative;z-index:1}
.login-logo img{height:56px;width:auto;display:block;margin:0 auto 18px;filter:drop-shadow(0 0 20px rgba(255,255,255,0.3)) brightness(10)}
.login-subtitle{font-size:10px;font-weight:700;color:var(--text-muted);letter-spacing:3px;text-transform:uppercase}
.login-form{width:100%;max-width:360px;position:relative;z-index:1;background:var(--surface);border-radius:20px;padding:28px 24px;border:1px solid var(--border-med)}

.topbar{height:var(--tb-h);min-height:var(--tb-h);background:var(--surface);border-bottom:1px solid var(--border);display:flex;align-items:center;padding:0 14px;gap:10px;flex-shrink:0}
.topbar-brand{display:flex;align-items:center;gap:10px;flex:1;min-width:0}
.topbar-logo{height:22px;width:auto;flex-shrink:0;filter:brightness(10)}
.topbar-agent-name{font-size:13px;font-weight:600;color:var(--text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar-title{font-size:16px;font-weight:700;color:var(--text);flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.icon-btn{width:36px;height:36px;border-radius:10px;flex-shrink:0;border:1px solid var(--border-med);background:var(--surface-2);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s}
.icon-btn:active{background:var(--surface-3)}
.icon-btn svg{width:17px;height:17px;stroke:var(--text-secondary)}
.back-btn{width:34px;height:34px;border-radius:9px;flex-shrink:0;border:1px solid var(--border-med);background:var(--surface-2);cursor:pointer;display:flex;align-items:center;justify-content:center}
.back-btn svg{width:16px;height:16px;stroke:var(--text)}
.btn-topbar-action{font-size:13px;font-weight:700;color:var(--red);background:none;border:none;cursor:pointer;padding:6px 2px;font-family:'Montserrat',sans-serif;flex-shrink:0}
.cart-badge-wrap{position:relative;display:flex;align-items:center;flex-shrink:0}
.cart-badge{position:absolute;top:-6px;right:-6px;background:var(--red);color:#fff;font-size:9px;font-weight:800;width:17px;height:17px;border-radius:50%;display:flex;align-items:center;justify-content:center}

.content{flex:1;overflow-y:auto;padding:16px;padding-bottom:calc(var(--nb-h) + var(--safe-bottom) + 16px);-webkit-overflow-scrolling:touch;background:var(--bg)}
.content::-webkit-scrollbar{display:none}
.content.ptr-wrapper{overflow:hidden;padding:0;position:relative}
.content.ptr-wrapper .ptr-scroller{padding:16px;padding-bottom:calc(var(--nb-h) + var(--safe-bottom) + 16px);background:var(--bg);height:100%;box-sizing:border-box}

.navbar{height:calc(var(--nb-h) + var(--safe-bottom));background:var(--surface);border-top:1px solid var(--border);display:flex;flex-shrink:0}
.nav-item{padding-bottom:var(--safe-bottom);flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;border:none;background:none;cursor:pointer;color:var(--text-muted);transition:color .15s;position:relative;font-family:'Montserrat',system-ui,sans-serif}
.nav-item svg{width:22px;height:22px;stroke:currentColor}
.nav-item span{font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:.6px}
.nav-item.active{color:var(--red)}
.nav-item.active::before{content:'';position:absolute;top:0;left:50%;transform:translateX(-50%);width:32px;height:2.5px;background:var(--red);border-radius:0 0 4px 4px}

.field{margin-bottom:14px}
.field label{display:block;font-size:10px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:1px;margin-bottom:7px}
.field input,.field select,textarea{width:100%;padding:13px 14px;border:1.5px solid var(--border-med);border-radius:var(--r-sm);font-size:14px;font-weight:500;font-family:'Montserrat',sans-serif;color:var(--text);background:var(--surface-2);outline:none;transition:border-color .2s,box-shadow .2s}
.field input:focus,.field select:focus,textarea:focus{border-color:var(--red);box-shadow:0 0 0 3px var(--red-glow)}
.field input::placeholder,textarea::placeholder{color:var(--text-muted)}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.required{color:var(--red)}
textarea{resize:none}

.form-section{background:var(--surface);border-radius:var(--r);padding:16px;border:1px solid var(--border);margin-bottom:12px}
.form-section-label{font-size:10px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:1px;margin-bottom:14px}
.error-msg{background:var(--danger-bg);color:var(--danger);font-size:13px;font-weight:500;padding:12px 14px;border-radius:var(--r-sm);margin-bottom:14px;border:1px solid rgba(255,69,58,.25)}

.btn-primary{width:100%;padding:16px;background:var(--red);color:#fff;border:none;border-radius:var(--r);font-size:13px;font-weight:700;font-family:'Montserrat',sans-serif;letter-spacing:.8px;text-transform:uppercase;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:background .15s,transform .1s;margin-top:4px}
.btn-primary:active{transform:scale(.98);background:var(--red-dark)}
.btn-primary svg{width:17px;height:17px;stroke:#fff}
.btn-primary:disabled{background:var(--surface-3);color:var(--text-muted);cursor:not-allowed}
.btn-new-order{width:100%;padding:17px;background:var(--surface);color:var(--text);border:1.5px solid var(--border-med);border-radius:var(--r);font-size:13px;font-weight:700;font-family:'Montserrat',sans-serif;letter-spacing:.8px;text-transform:uppercase;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:10px;margin-bottom:20px;transition:border-color .15s,background .15s}
.btn-new-order:active{background:var(--surface-2)}
.btn-new-order svg{width:20px;height:20px;stroke:var(--red)}
.btn-bulk{width:100%;padding:13px;background:var(--surface-2);color:var(--text-secondary);border:1.5px dashed var(--border-med);border-radius:var(--r-sm);font-size:12px;font-weight:600;font-family:'Montserrat',sans-serif;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:border-color .15s;margin-bottom:12px}
.btn-bulk svg{width:16px;height:16px;stroke:currentColor}
.select-btn{width:100%;padding:14px;background:var(--surface-2);border:1.5px dashed var(--border-med);border-radius:var(--r-sm);font-size:14px;font-weight:600;font-family:'Montserrat',sans-serif;color:var(--text-muted);cursor:pointer;display:flex;align-items:center;gap:10px;text-align:left;transition:border-color .2s}
.select-btn.selected{border-color:var(--border-med);border-style:solid;color:var(--text)}
.select-btn span{flex:1}

.stats-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px}
.stat-card{background:var(--surface);border-radius:var(--r);padding:16px 14px;border:1px solid var(--border);display:flex;flex-direction:column;gap:8px}
.stat-label{font-size:10px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:1px}
.stat-value{font-size:28px;font-weight:800;color:var(--text);line-height:1}
.stat-value.accent{color:var(--red);font-size:20px}
.section-title{font-size:10px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:1.2px;margin-bottom:10px}

.search-bar{background:var(--surface);border:1.5px solid var(--border-med);border-radius:var(--r);padding:12px 14px;display:flex;align-items:center;gap:10px;margin-bottom:10px;transition:border-color .2s}
.search-bar:focus-within{border-color:rgba(255,255,255,.3)}
.search-bar svg{width:16px;height:16px;flex-shrink:0;stroke:var(--text-muted)}
.search-bar input{border:none;background:none;outline:none;font-size:14px;font-weight:500;font-family:'Montserrat',sans-serif;color:var(--text);width:100%}
.search-bar input::placeholder{color:var(--text-muted)}

.order-card{background:var(--surface);border-radius:var(--r);padding:14px;border:1px solid var(--border);margin-bottom:9px;cursor:pointer;transition:border-color .15s}
.order-card:active{border-color:var(--border-med)}
.order-card-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:7px}
.order-num{font-size:14px;font-weight:700;color:var(--text)}
.order-meta{font-size:13px;color:var(--text-secondary);font-weight:500;margin-bottom:4px}
.order-amount{font-size:16px;font-weight:800;color:var(--text)}
.order-date{font-size:12px;color:var(--text-muted);font-weight:500}

.badge{font-size:10px;font-weight:700;padding:4px 10px;border-radius:20px;text-transform:uppercase;letter-spacing:.4px}
.badge-pending{background:var(--warning-bg);color:var(--warning)}
.badge-processing{background:var(--info-bg);color:var(--info)}
.badge-completed{background:var(--success-bg);color:var(--success)}
.badge-cancelled{background:var(--danger-bg);color:var(--danger)}
.badge-on-hold{background:rgba(255,255,255,.07);color:var(--text-secondary)}

#catalog-list {padding-top: 16px;}
.product-card{background:var(--surface);border-radius:var(--r);padding:13px;border:1px solid var(--border);margin-bottom:8px;display:flex;align-items:center;gap:12px;cursor:pointer}
.product-img{width:50px;height:50px;border-radius:var(--r-sm);object-fit:cover;flex-shrink:0;background:var(--surface-2)}
.product-img-placeholder{width:50px;height:50px;border-radius:var(--r-sm);background:var(--surface-2);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.product-img-placeholder svg{width:20px;height:20px;stroke:var(--text-muted)}
.product-info{flex:1;min-width:0}
.product-name{font-size:13px;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.product-sku{font-size:11px;color:var(--text-muted);margin-top:3px;font-weight:500}
.product-price{font-size:15px;font-weight:700;color:var(--text);flex-shrink:0}
.product-stock{font-size:10px;font-weight:600;margin-top:3px;text-align:right}
.in-stock{color:var(--success)}.low-stock{color:var(--warning)}.out-stock{color:var(--danger)}

.pd-img{width:100%;max-height:320px;object-fit:cover;border-radius:var(--r);margin-bottom:16px}
.pd-img-placeholder{width:100%;height:160px;border-radius:var(--r);background:var(--surface);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;margin-bottom:16px}
.pd-img-placeholder svg{width:48px;height:48px;stroke:var(--text-muted)}
.pd-price{font-size:30px;font-weight:800;color:var(--text);margin-bottom:4px}
.pd-sku{font-size:11px;font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:1px;margin-bottom:16px}
.pd-tabs{display:flex;margin-bottom:16px;border-bottom:1px solid var(--border)}
.pd-tab{padding:10px 16px;font-size:12px;font-weight:700;cursor:pointer;color:var(--text-muted);background:none;border:none;font-family:'Montserrat',sans-serif;text-transform:uppercase;letter-spacing:.5px;border-bottom:2px solid transparent;margin-bottom:-1px;transition:color .15s}
.pd-tab.active{color:var(--text);border-bottom-color:var(--red)}
.pd-tab-content{display:none}
.pd-tab-content.active{display:block}
.pd-meta{background:var(--surface);border-radius:var(--r);border:1px solid var(--border);overflow:hidden}
.pd-meta-row{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid var(--border)}
.pd-meta-row:last-child{border-bottom:none}
.pd-meta-key{font-size:11px;font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px}
.pd-meta-val{font-size:13px;font-weight:600;color:var(--text);text-align:right;max-width:60%}
.pd-description{font-size:13px;color:var(--text-secondary);line-height:1.7}

.customer-card{background:var(--surface);border-radius:var(--r);padding:13px 14px;border:1px solid var(--border);margin-bottom:8px;display:flex;align-items:center;gap:12px;cursor:pointer;transition:border-color .15s}
.customer-card:active{border-color:var(--border-med)}
.avatar{width:42px;height:42px;border-radius:50%;background:var(--surface-3);border:1px solid var(--border-med);display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;color:var(--text-secondary);flex-shrink:0}
.customer-name{font-size:14px;font-weight:600;color:var(--text)}
.customer-detail{font-size:12px;color:var(--text-secondary);margin-top:3px;font-weight:500}

.detail-header{background:var(--surface);border-radius:var(--r);padding:18px;border:1px solid var(--border);margin-bottom:12px;display:flex;align-items:center;gap:14px}
.detail-avatar{width:52px;height:52px;border-radius:50%;background:var(--surface-3);border:1px solid var(--border-med);display:flex;align-items:center;justify-content:center;font-size:18px;font-weight:700;color:var(--text-secondary);flex-shrink:0}
.detail-name{font-size:17px;font-weight:700;color:var(--text)}
.detail-sub{font-size:12px;color:var(--text-secondary);margin-top:3px;font-weight:500}
.detail-block{background:var(--surface);border-radius:var(--r);border:1px solid var(--border);overflow:hidden;margin-bottom:10px}
.detail-block-title{padding:11px 14px;font-size:10px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:1px;border-bottom:1px solid var(--border);background:var(--surface-2)}
.detail-row{display:flex;justify-content:space-between;align-items:center;padding:12px 14px;border-bottom:1px solid var(--border)}
.detail-row:last-child{border-bottom:none}
.detail-row-key{font-size:12px;font-weight:500;color:var(--text-muted)}
.detail-row-val{font-size:13px;font-weight:600;color:var(--text);text-align:right;max-width:65%;word-break:break-all}

.order-items-summary{margin-top:10px}
.oi-row{display:flex;align-items:center;gap:8px;padding:10px 0;border-bottom:1px solid var(--border)}
.oi-row:last-child{border-bottom:none}
.oi-name{font-size:13px;font-weight:600;color:var(--text);flex:1}
.oi-sub{font-size:11px;color:var(--text-muted);font-weight:500}
.oi-qty-ctrl{display:flex;align-items:center;gap:6px;flex-shrink:0}
.oi-qty-btn{width:28px;height:28px;border-radius:8px;border:1px solid var(--border-med);background:var(--surface-2);cursor:pointer;font-size:16px;display:flex;align-items:center;justify-content:center;color:var(--text)}
.oi-qty-num{font-size:14px;font-weight:700;min-width:24px;text-align:center;color:var(--text)}
.oi-total{font-size:13px;font-weight:700;color:var(--text);min-width:56px;text-align:right;flex-shrink:0}
.oi-remove{width:26px;height:26px;border:none;background:none;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text-muted)}
.oi-remove svg{width:15px;height:15px;stroke:currentColor}
.order-total-row{display:flex;justify-content:space-between;align-items:center;padding:14px 0 4px;border-top:1px solid var(--border-med);margin-top:6px;font-size:11px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.8px}
#order-total{color:var(--text);font-size:22px;font-weight:800}

.od-header{background:var(--surface);border-radius:var(--r);padding:16px;border:1px solid var(--border);margin-bottom:12px}
.od-row{display:flex;justify-content:space-between;padding:5px 0}
.od-key{font-size:12px;color:var(--text-muted);font-weight:500}
.od-val{font-size:13px;font-weight:600;color:var(--text);text-align:right}
.od-product-row{display:flex;align-items:center;gap:10px;padding:11px 14px;border-bottom:1px solid var(--border)}
.od-product-row:last-child{border-bottom:none}
.od-product-img{width:40px;height:40px;border-radius:var(--r-sm);object-fit:cover;background:var(--surface-2);flex-shrink:0}
.od-product-name{font-size:13px;font-weight:600;color:var(--text);flex:1}
.od-product-qty{font-size:12px;color:var(--text-muted);font-weight:500}
.od-product-total{font-size:13px;font-weight:700;color:var(--text)}

.quick-add-item{display:flex;align-items:center;gap:10px;padding:10px 12px;background:var(--surface);border-radius:var(--r-sm);margin-bottom:6px;border:1px solid var(--border);cursor:pointer}
.qa-name{font-size:13px;font-weight:600;color:var(--text);flex:1}
.qa-price{font-size:13px;font-weight:700;color:var(--text-secondary);flex-shrink:0}
.qa-add{width:28px;height:28px;background:var(--red);border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.qa-add svg{width:14px;height:14px;stroke:#fff}

.bulk-count-bar{background:var(--surface);border-radius:var(--r-sm);padding:10px 14px;margin-bottom:10px;border:1px solid var(--border);font-size:13px;font-weight:600;color:var(--text);display:flex;justify-content:space-between;align-items:center}
.bulk-item{display:flex;align-items:center;gap:12px;background:var(--surface);border-radius:var(--r-sm);padding:12px;border:1px solid var(--border);margin-bottom:7px;transition:border-color .15s;cursor:pointer}
.bulk-item.selected{border-color:var(--border-med);background:var(--surface-2)}
.bulk-check{width:28px;height:28px;min-width:28px;border-radius:6px;flex-shrink:0;border:1.5px solid var(--border-med);background:var(--surface-3);display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .15s;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.bulk-check.checked{background:var(--red);border-color:var(--red)}
.bulk-check.checked::after{content:'✓';font-size:12px;color:#fff;font-weight:800}
.bulk-thumb{width:42px;height:42px;border-radius:var(--r-sm);object-fit:cover;flex-shrink:0;background:var(--surface-2);pointer-events:none}
.bulk-skeleton{height:68px;background:linear-gradient(90deg,var(--surface) 25%,var(--surface-2) 50%,var(--surface) 75%);background-size:200% 100%;animation:shimmer 1.4s infinite;border-radius:var(--r-sm);margin-bottom:7px}
.bulk-name{font-size:13px;font-weight:600;color:var(--text);flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bulk-price{font-size:12px;font-weight:700;color:var(--text-secondary);flex-shrink:0}
.bulk-qty{display:none;align-items:center;gap:5px;flex-shrink:0}
.bulk-item.selected .bulk-qty{display:flex}
.bulk-qty-btn{width:28px;height:28px;border-radius:7px;border:1px solid var(--border-med);background:var(--surface-3);cursor:pointer;font-size:15px;display:flex;align-items:center;justify-content:center;color:var(--text)}
.bulk-qty-num{font-size:13px;font-weight:700;min-width:22px;text-align:center;color:var(--text)}

.skeleton{background:linear-gradient(90deg,var(--surface) 25%,var(--surface-2) 50%,var(--surface) 75%);background-size:200% 100%;animation:shimmer 1.4s infinite;border-radius:var(--r);height:70px;margin-bottom:8px}
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
.toast{position:fixed;bottom:calc(var(--nb-h) + var(--safe-bottom) + 16px);left:50%;transform:translateX(-50%) translateY(20px);background:var(--surface-3);border:1px solid var(--border-med);color:var(--text);padding:12px 20px;border-radius:30px;font-size:13px;font-weight:600;font-family:'Montserrat',sans-serif;opacity:0;transition:opacity .2s,transform .2s;pointer-events:none;white-space:nowrap;z-index:1000}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
.empty-state{text-align:center;padding:52px 24px;color:var(--text-muted)}
.empty-state svg{width:44px;height:44px;stroke:var(--text-muted);margin-bottom:14px;opacity:.4}
.empty-state p{font-size:14px;font-weight:500}
.spinner{width:28px;height:28px;border:2.5px solid var(--border-med);border-top-color:var(--red);border-radius:50%;animation:spin .7s linear infinite;margin:40px auto;display:block}
@keyframes spin{to{transform:rotate(360deg)}}

/* ── BULK THUMBNAILS ── */
.bulk-item{display:flex;align-items:center;gap:10px;background:var(--surface);border-radius:var(--r-sm);padding:10px;border:1px solid var(--border);margin-bottom:7px;transition:border-color .15s;cursor:pointer}
.bulk-thumb{width:42px;height:42px;border-radius:var(--r-sm);object-fit:cover;flex-shrink:0;background:var(--surface-2);pointer-events:none}
.bulk-thumb-placeholder{width:42px;height:42px;border-radius:var(--r-sm);background:var(--surface-2);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;flex-shrink:0;pointer-events:none}
.bulk-thumb-placeholder svg{width:18px;height:18px;stroke:var(--text-muted)}
.bulk-info{flex:1;min-width:0}
.bulk-name{font-size:13px;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bulk-sku{font-size:10px;color:var(--text-muted);margin-top:2px;font-weight:500}

/* ── ORDER FILTERS ── */
.filter-panel{background:var(--surface);border-bottom:1px solid var(--border);padding:0 14px;max-height:0;overflow:hidden;transition:max-height .25s ease,padding .25s ease}
.filter-panel.open{max-height:240px;padding:12px 14px}
.filter-row{display:flex;gap:8px;align-items:center;margin-bottom:8px}
.filter-row:last-child{margin-bottom:0}
.filter-select-wrap{flex:1}
.filter-select{width:100%;padding:11px 13px;border:1.5px solid var(--border-med);border-radius:var(--r-sm);font-size:13px;font-weight:500;font-family:'Montserrat',sans-serif;color:var(--text);background:var(--surface-2);outline:none;-webkit-appearance:none;appearance:none}
.filter-select:focus{border-color:var(--red);box-shadow:0 0 0 3px var(--red-glow)}
.filter-dates{align-items:flex-end}
.filter-date-wrap{display:flex;flex-direction:column;gap:5px;flex:1}
.filter-date-wrap label{font-size:9px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:1px}
.filter-date{width:100%;padding:10px 12px;border:1.5px solid var(--border-med);border-radius:var(--r-sm);font-size:13px;font-weight:500;font-family:'Montserrat',sans-serif;color:var(--text);background:var(--surface-2);outline:none;color-scheme:dark}
.filter-date:focus{border-color:var(--red);box-shadow:0 0 0 3px var(--red-glow)}
.btn-filter-reset{padding:10px 14px;background:var(--surface-3);color:var(--text-secondary);border:1px solid var(--border-med);border-radius:var(--r-sm);font-size:11px;font-weight:700;font-family:'Montserrat',sans-serif;text-transform:uppercase;letter-spacing:.5px;cursor:pointer;white-space:nowrap;flex-shrink:0}
.btn-filter-reset:active{background:var(--surface-2)}
.filter-badge{font-size:9px;font-weight:700;padding:3px 8px;border-radius:20px;background:var(--red);color:#fff;text-transform:uppercase;letter-spacing:.5px;margin-right:4px}

/* ── QUICK ADD THUMBNAILS ── */
.quick-add-item{display:flex;align-items:center;gap:10px;padding:9px 12px;background:var(--surface);border-radius:var(--r-sm);margin-bottom:6px;border:1px solid var(--border);cursor:pointer;transition:border-color .15s}
.quick-add-item:active{border-color:var(--red)}
.qa-thumb{width:38px;height:38px;border-radius:var(--r-sm);object-fit:cover;flex-shrink:0;background:var(--surface-2)}
.qa-thumb-placeholder{width:38px;height:38px;border-radius:var(--r-sm);background:var(--surface-2);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.qa-thumb-placeholder svg{width:16px;height:16px;stroke:var(--text-muted)}
.qa-name{font-size:13px;font-weight:600;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.qa-sku{font-size:10px;color:var(--text-muted);margin-top:2px;font-weight:500}

/* ── VIEW TOGGLE (lista/griglia) ── */
.view-toggle{display:flex;gap:3px;background:var(--surface-3);border-radius:8px;padding:3px;flex-shrink:0}
.view-toggle-btn{width:28px;height:28px;border:none;background:none;border-radius:6px;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--text-muted);transition:all .15s}
.view-toggle-btn svg{width:15px;height:15px;stroke:currentColor}
.view-toggle-btn.active{background:var(--surface);color:var(--text);box-shadow:0 1px 3px rgba(0,0,0,.3)}

/* ── GRIGLIA 2 COLONNE ── */
.catalog-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding:0}
.grid-product-card{background:var(--surface);border-radius:var(--r);border:1px solid var(--border);overflow:hidden;cursor:pointer;display:flex;flex-direction:column;transition:border-color .15s}
.grid-product-card:active{border-color:var(--border-med)}
.grid-product-img{width:100%;aspect-ratio:1/1;object-fit:cover;background:var(--surface-2);display:block}
.grid-product-img-placeholder{width:100%;aspect-ratio:1/1;background:var(--surface-2);display:flex;align-items:center;justify-content:center}
.grid-product-img-placeholder svg{width:32px;height:32px;stroke:var(--text-muted)}
.grid-product-info{padding:10px;flex:1;display:flex;flex-direction:column;gap:4px}
.grid-product-name{font-size:12px;font-weight:600;color:var(--text);line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.grid-product-sku{font-size:10px;color:var(--text-muted);font-weight:500}
.grid-product-bottom{display:flex;justify-content:space-between;align-items:center;margin-top:auto;padding-top:6px}
.grid-product-price{font-size:13px;font-weight:700;color:var(--text)}

/* ── REFRESH BUTTON ── */
.icon-btn.spinning svg{animation:spin .7s linear infinite}

/* ── PULL TO REFRESH ── */
.ptr-wrapper{position:relative;height:100%;overflow:hidden}
.ptr-indicator{position:absolute;top:0;left:0;right:0;display:flex;align-items:center;justify-content:center;gap:8px;height:56px;transform:translateY(-100%);transition:none;pointer-events:none;z-index:10}
.ptr-indicator svg{width:18px;height:18px;stroke:var(--text-muted);transition:transform .2s}
.ptr-indicator span{font-size:12px;font-weight:600;color:var(--text-muted)}
.ptr-indicator.ptr-ready svg{stroke:var(--red);transform:rotate(180deg)}
.ptr-indicator.ptr-loading svg{animation:spin .7s linear infinite;stroke:var(--red)}
.ptr-scroller{height:100%;overflow-y:auto;-webkit-overflow-scrolling:touch}
.ptr-scroller::-webkit-scrollbar{display:none}

/* ── BULK PREVIEW BUTTON ── */
.bulk-preview-btn{width:30px;height:30px;flex-shrink:0;border:1px solid var(--border-med);background:var(--surface-3);border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;margin-left:4px}
.bulk-preview-btn:active{background:var(--surface-2);border-color:var(--red)}
.bulk-preview-btn svg{width:15px;height:15px;stroke:var(--text-muted)}

/* ── BULK PREVIEW BOTTOM SHEET ── */
.bp-overlay{position:fixed;inset:0;background:rgba(0,0,0,0);pointer-events:none;z-index:200;transition:background .3s}
.bp-overlay.open{background:rgba(0,0,0,0.6);pointer-events:auto}
.bp-sheet{position:fixed;bottom:0;left:50%;transform:translateX(-50%) translateY(100%);width:100%;max-width:800px;max-height:85vh;background:var(--surface);border-radius:22px 22px 0 0;z-index:201;display:flex;flex-direction:column;transition:transform .35s cubic-bezier(.32,.72,0,1)}
.bp-sheet.open{transform:translateX(-50%) translateY(0)}
.bp-header{display:flex;align-items:center;justify-content:space-between;padding:16px 16px 12px;border-bottom:1px solid var(--border);flex-shrink:0}
.bp-header::before{content:'';position:absolute;top:10px;left:50%;transform:translateX(-50%);width:36px;height:4px;background:var(--surface-3);border-radius:4px}
.bp-title{font-size:14px;font-weight:700;color:var(--text)}
.bp-close{width:30px;height:30px;border:1px solid var(--border-med);background:var(--surface-2);border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center}
.bp-close svg{width:15px;height:15px;stroke:var(--text-secondary)}
.bp-body{overflow-y:auto;padding:16px;-webkit-overflow-scrolling:touch;padding-bottom:calc(var(--safe-bottom) + 24px)}
.bp-body::-webkit-scrollbar{display:none}
.bp-img{width:100%;max-height:260px;object-fit:cover;border-radius:var(--r);margin-bottom:14px;display:block}
.bp-img-placeholder{width:100%;height:140px;border-radius:var(--r);background:var(--surface-2);border:1px solid var(--border);display:flex;align-items:center;justify-content:center;margin-bottom:14px}
.bp-img-placeholder svg{width:40px;height:40px;stroke:var(--text-muted)}
.bp-name{font-size:17px;font-weight:700;color:var(--text);margin-bottom:4px}
.bp-price{font-size:26px;font-weight:800;color:var(--text);margin-bottom:4px}
.bp-sku{font-size:11px;font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:1px;margin-bottom:0}

/* ── GALLERIA / CAROSELLO PRODOTTO ── */
.pd-gallery{position:relative;width:100%;overflow:hidden;border-radius:var(--r);margin-bottom:16px;background:var(--surface-2)}
.pd-gallery-single img{width:100%;max-height:320px;object-fit:cover;display:block;border-radius:var(--r)}
.pd-gallery-track{display:flex;transition:transform .3s cubic-bezier(.32,.72,0,1);will-change:transform}
.pd-gallery-slide{flex:0 0 100%;min-width:0}
.pd-gallery-slide img{width:100%;height:300px;object-fit:cover;display:block;user-select:none;-webkit-user-drag:none}
.pd-gallery-arrow{position:absolute;top:50%;transform:translateY(-50%);width:34px;height:34px;background:rgba(15,15,15,0.65);border:1px solid rgba(255,255,255,0.15);border-radius:50%;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:2;backdrop-filter:blur(4px)}
.pd-gallery-arrow svg{width:16px;height:16px;stroke:#fff}
.pd-gallery-prev{left:10px}
.pd-gallery-next{right:10px}
.pd-gallery-dots{position:absolute;bottom:10px;left:50%;transform:translateX(-50%);display:flex;gap:6px;z-index:2}
.pd-gallery-dot{width:6px;height:6px;border-radius:50%;background:rgba(255,255,255,0.4);cursor:pointer;transition:all .2s}
.pd-gallery-dot.active{background:#fff;width:18px;border-radius:4px}

/* Galleria nel bulk preview (altezza ridotta) */
.bp-gallery .pd-gallery-slide img{height:220px}

/* ── ANNULLA ORDINE ── */
.btn-cancel-order{width:100%;margin-top:16px;padding:15px;background:var(--danger-bg);color:var(--danger);border:1.5px solid rgba(255,69,58,.3);border-radius:var(--r);font-size:13px;font-weight:700;font-family:'Montserrat',sans-serif;letter-spacing:.6px;text-transform:uppercase;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px;transition:background .15s}
.btn-cancel-order:active{background:rgba(255,69,58,.2)}
.btn-cancel-order:disabled{opacity:.5;cursor:not-allowed}
.btn-cancel-order svg{width:17px;height:17px;stroke:var(--danger);flex-shrink:0}

/* ── ANTEPRIMA PRODOTTO NEL DETTAGLIO ORDINE ── */
.od-product-row{display:flex;align-items:center;gap:10px;padding:11px 14px;border-bottom:1px solid var(--border)}
.od-product-row:last-child{border-bottom:none}
.od-preview-btn{width:30px;height:30px;flex-shrink:0;border:1px solid var(--border-med);background:var(--surface-3);border-radius:8px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;margin-left:4px}
.od-preview-btn:active{background:var(--surface-2);border-color:var(--red)}
.od-preview-btn svg{width:15px;height:15px;stroke:var(--text-muted)}

/* ═══════════════════════════════════════════════════════════
   DESKTOP LAYOUT — min-width 900px
   ═══════════════════════════════════════════════════════════ */

.desktop-sidebar { display: none !important; }

@media (min-width: 900px) {

  html, body { max-width: none; overflow: hidden; }

  .desktop-sidebar {
    display: flex !important;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 220px;
    height: 100vh; height: 100dvh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    border-top: none;
    border-right: 1px solid var(--border);
    z-index: 500;
    padding: 0;
  }

  .desktop-sidebar::before {
    content: '';
    display: block;
    height: 64px; min-height: 64px;
    flex-shrink: 0;
    background: url('../img/logo-white.png') center/auto 22px no-repeat;
    border-bottom: 1px solid var(--border);
    filter: brightness(10);
  }

  .desktop-sidebar .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    padding: 0 20px;
    height: 52px; min-height: 52px;
    flex: none; width: 100%;
    gap: 13px; border-radius: 0;
  }

  .desktop-sidebar .nav-item span {
    font-size: 12px; font-weight: 600;
    text-transform: none; letter-spacing: 0;
  }

  .desktop-sidebar .nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

  .desktop-sidebar .nav-item.active::before {
    top: 50%; left: 0;
    transform: translateY(-50%);
    width: 3px; height: 28px;
    border-radius: 0 4px 4px 0;
  }

  .desktop-sidebar .nav-item:hover { background: var(--surface-2); color: var(--text-secondary); }
  .desktop-sidebar .nav-item.active:hover { color: var(--red); }

  .view > .navbar { display: none; }

  .view { margin-left: 220px; width: calc(100% - 220px); height: 100vh; height: 100dvh; }

  .content { padding-bottom: 24px; }
  .content.ptr-wrapper .ptr-scroller { padding-bottom: 24px; }

  .topbar { height: 64px; min-height: 64px; padding: 0 24px; }

  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
  .catalog-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }

  #customers-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  #customers-list .customer-card { margin-bottom: 0; }
  #orders-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  #orders-list .order-card { margin-bottom: 0; }

  .toast { bottom: 28px; }
  .bp-sheet { max-width: 560px; }

  .content::-webkit-scrollbar { display: block; width: 6px; }
  .content::-webkit-scrollbar-track { background: var(--bg); }
  .content::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
  .content::-webkit-scrollbar-thumb:hover { background: var(--border-med); }
  .ptr-scroller::-webkit-scrollbar { display: block; width: 6px; }
  .ptr-scroller::-webkit-scrollbar-track { background: var(--bg); }
  .ptr-scroller::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

  .order-card:hover { border-color: var(--border-med); }
  .customer-card:hover { border-color: var(--border-med); }
  .product-card:hover { border-color: var(--border-med); }
  .grid-product-card:hover { border-color: var(--border-med); }
  .bulk-item:hover { border-color: var(--border-med); }
  .quick-add-item:hover { border-color: var(--red); }
  .icon-btn:hover { background: var(--surface-3); }
  .back-btn:hover { background: var(--surface-3); }
  .btn-primary:hover { background: var(--red-dark); }
}

@media (min-width: 1200px) {
  .desktop-sidebar { width: 240px; }
  .view { margin-left: 240px; width: calc(100% - 240px); }
  .catalog-grid { grid-template-columns: repeat(4, 1fr); }
  #customers-list { grid-template-columns: repeat(3, 1fr); }
  #orders-list { grid-template-columns: repeat(3, 1fr); }
}

/* ═══════════════════════════════════════════════════════════
   PANNELLO ADMIN
   ═══════════════════════════════════════════════════════════ */

/* ── Screen admin fullscreen ── */
#screen-admin {
  background: var(--bg);
  flex-direction: row;
}

/* ── Sidebar admin ── */
.admin-sidebar {
  width: 240px;
  min-width: 240px;
  height: 100vh; height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.admin-sidebar-header {
  height: 64px;
  min-height: 64px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.admin-sidebar-header img {
  height: 22px;
  width: auto;
  filter: brightness(10);
}
.admin-sidebar-badge {
  font-size: 9px;
  font-weight: 800;
  color: var(--red);
  background: var(--red-glow);
  border: 1px solid rgba(224,32,32,.3);
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.admin-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: 46px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  text-align: left;
  border-radius: 10px;
  margin: 0 8px;
  width: calc(100% - 16px);
  transition: background .15s, color .15s;
}
.admin-nav-item svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  flex-shrink: 0;
}
.admin-nav-item:hover {
  background: var(--surface-2);
  color: var(--text-secondary);
}
.admin-nav-item.active {
  background: var(--red-glow);
  color: var(--red);
  border: 1px solid rgba(224,32,32,.2);
}
.admin-nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 18px;
}
.admin-nav-section-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 26px 4px;
}
.admin-sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
}
.admin-exit-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.admin-exit-btn:hover {
  background: var(--surface-2);
  color: var(--text-secondary);
}
.admin-exit-btn svg {
  width: 16px; height: 16px;
  stroke: currentColor;
}

/* ── Main content area ── */
.admin-main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.admin-topbar {
  height: 64px;
  min-height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
}
.admin-topbar-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  flex: 1;
}
.admin-topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
}
.admin-content::-webkit-scrollbar { width: 6px; }
.admin-content::-webkit-scrollbar-track { background: var(--bg); }
.admin-content::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

/* ── Admin panels ── */
.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* ── KPI grid ── */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.admin-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.admin-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--kpi-color, var(--red));
}
.admin-kpi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--kpi-bg, var(--red-glow));
  display: flex; align-items: center; justify-content: center;
}
.admin-kpi-icon svg {
  width: 18px; height: 18px;
  stroke: var(--kpi-color, var(--red));
}
.admin-kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.admin-kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.admin-kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Charts row ── */
.admin-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
.admin-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
}
.admin-chart-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

/* ── Bar chart inline ── */
.admin-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
}
.admin-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.admin-bar {
  width: 100%;
  background: var(--red);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height .5s ease;
  position: relative;
}
.admin-bar:hover::after {
  content: attr(data-val);
  position: absolute;
  top: -24px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}
.admin-bar-label {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* ── Donut chart ── */
.admin-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.admin-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.admin-legend-pct {
  margin-left: auto;
  font-weight: 700;
  color: var(--text);
}

/* ── Dashboard filter bar ── */
.dashboard-filter-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.dashboard-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dashboard-filter-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}
.dashboard-period-tabs {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-med);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.dashboard-period-btn,
.dashboard-sort-btn {
  padding: 7px 14px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.dashboard-period-btn.active,
.dashboard-sort-btn.active {
  background: var(--red);
  color: #fff;
}
.dashboard-period-btn:not(.active):hover,
.dashboard-sort-btn:not(.active):hover {
  background: var(--surface-3);
  color: var(--text-secondary);
}

/* ── Table ── */
.admin-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 14px;
}
.admin-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.admin-table-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  padding: 10px 16px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  text-align: left;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td {
  border-bottom: none;
}
.admin-table tr:hover td {
  background: var(--surface-2);
  cursor: pointer;
}
.admin-table td strong {
  color: var(--text);
  font-weight: 600;
}
.admin-table .td-mono {
  font-family: monospace;
  font-size: 12px;
}
.admin-table .td-right {
  text-align: right;
}
.admin-table .td-amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

/* ── Top agenti ranking ── */
.admin-rank-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.admin-rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
  cursor: pointer;
}
.admin-rank-item:last-child { border-bottom: none; }
.admin-rank-item:hover { background: var(--surface-2); }
.admin-rank-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-med);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
}
.admin-rank-num.top1 { background: rgba(255,215,0,.15); color: #ffd700; border-color: rgba(255,215,0,.3); }
.admin-rank-num.top2 { background: rgba(192,192,192,.15); color: #c0c0c0; border-color: rgba(192,192,192,.3); }
.admin-rank-num.top3 { background: rgba(205,127,50,.15); color: #cd7f32; border-color: rgba(205,127,50,.3); }
.admin-rank-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.admin-rank-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.admin-rank-fat {
  font-size: 14px;
  font-weight: 800;
  color: var(--red);
  text-align: right;
}
.admin-rank-fat-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: right;
}

/* ── Agent card (lista agenti) ── */
.admin-agent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s;
}
.admin-agent-card:hover { border-color: var(--border-med); }
.admin-agent-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.admin-agent-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-med);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.admin-agent-name { font-size: 15px; font-weight: 700; color: var(--text); }
.admin-agent-zona { font-size: 11px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.admin-agent-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.admin-agent-stat {
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  text-align: center;
}
.admin-agent-stat-val {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.admin-agent-stat-val.red { color: var(--red); font-size: 14px; }
.admin-agent-stat-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-top: 2px;
}

/* ── Filter bar admin ── */
.admin-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.admin-filter-bar .search-bar {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}
.admin-filter-bar select {
  padding: 10px 14px;
  border: 1.5px solid var(--border-med);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  background: var(--surface);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23636366' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.admin-filter-bar select:focus { border-color: var(--red); }

/* ── Settings ── */
.admin-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.admin-settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
}
.admin-settings-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-settings-card-title svg {
  width: 15px; height: 15px;
  stroke: var(--text-muted);
}
.admin-settings-card.full-width {
  grid-column: 1 / -1;
}

/* Color picker row */
.admin-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.admin-color-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
}
.admin-color-input {
  width: 44px;
  height: 34px;
  border: 1.5px solid var(--border-med);
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
  background: var(--surface-2);
}
.admin-color-hex {
  width: 90px;
  padding: 8px 10px;
  border: 1.5px solid var(--border-med);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: monospace;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
}
.admin-color-hex:focus { border-color: var(--red); }

/* CSS editor */
.admin-css-editor {
  width: 100%;
  min-height: 160px;
  padding: 14px;
  border: 1.5px solid var(--border-med);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: 'Courier New', monospace;
  color: var(--success);
  background: #0a0a0a;
  outline: none;
  resize: vertical;
  line-height: 1.6;
}
.admin-css-editor:focus { border-color: var(--red); }

/* Save button */
.admin-btn-save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  letter-spacing: .6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s;
}
.admin-btn-save:hover { background: var(--red-dark); }
.admin-btn-save svg { width: 15px; height: 15px; stroke: #fff; }
.admin-btn-save:disabled { background: var(--surface-3); color: var(--text-muted); cursor: not-allowed; }

/* ── Modal dettaglio ── */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.admin-modal-overlay.open { display: flex; }
.admin-modal {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: 18px;
  width: 560px;
  max-width: 95vw;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modal-in .2s ease;
}
@keyframes modal-in {
  from { transform: scale(.94) translateY(10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.admin-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.admin-modal-close {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-med);
  background: var(--surface-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.admin-modal-close svg { width: 15px; height: 15px; stroke: var(--text-secondary); }
.admin-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Status select inline ── */
.admin-status-select {
  padding: 5px 10px;
  border: 1.5px solid var(--border-med);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  cursor: pointer;
}
.admin-status-select:focus { border-color: var(--red); }

/* ── Ingranaggio (gear) btn nella topbar agente ── */
.btn-admin-gear {
  width: 36px; height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  border: 1px solid rgba(224,32,32,.4);
  background: var(--red-glow);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.btn-admin-gear:active, .btn-admin-gear:hover { background: rgba(224,32,32,.28); }
.btn-admin-gear svg { width: 17px; height: 17px; stroke: var(--red); }

/* ── Responsive admin ── */
@media (max-width: 900px) {
  .admin-sidebar { display: none; }
  .admin-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-charts-row { grid-template-columns: 1fr; }
  .admin-settings-grid { grid-template-columns: 1fr; }

  /* Sidebar mobile come overlay */
  .admin-sidebar.mobile-open {
    display: flex;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 1500;
  }
  .admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1400;
  }
  .admin-sidebar-overlay.open { display: block; }

  .admin-topbar {
    height: 56px; min-height: 56px;
    padding: 0 14px;
  }
  .btn-admin-menu {
    display: flex !important;
  }
  .admin-content { padding: 14px; }
}

.btn-admin-menu {
  display: none;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-med);
  background: var(--surface-2);
  cursor: pointer;
  align-items: center; justify-content: center;
}
.btn-admin-menu svg { width: 18px; height: 18px; stroke: var(--text); }

/* ── Pagination ── */
.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.admin-page-btn {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border-med);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.admin-page-btn.active {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.admin-page-btn:disabled { opacity: .4; cursor: not-allowed; }
.admin-page-btn:hover:not(.active):not(:disabled) { background: var(--surface-2); }

/* ── Empty state admin ── */
.admin-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}
.admin-empty svg {
  width: 48px; height: 48px;
  stroke: var(--text-muted);
  margin: 0 auto 16px;
  display: block;
  opacity: .4;
}

/* ── Skeleton admin ── */
.admin-skeleton {
  background: linear-gradient(90deg,var(--surface) 25%,var(--surface-2) 50%,var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r);
  height: 60px;
  margin-bottom: 8px;
}

/* ── Info row ── */
.admin-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.admin-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.admin-info-key { color: var(--text-muted); font-weight: 500; font-size: 11px; }
.admin-info-val { color: var(--text); font-weight: 600; text-align: right; }

/* ── Tag/pill ── */
.admin-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ── v2.1 additions ── */

/* Palette colori grid */
.admin-colors-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.admin-color-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.admin-color-entry-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
}
.admin-color-entry-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Bottone edit agente */
.admin-agent-edit-btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-med);
  background: var(--surface-3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.admin-agent-edit-btn:hover { background: var(--red-glow); border-color: rgba(224,32,32,.3); }
.admin-agent-edit-btn svg { width: 14px; height: 14px; stroke: var(--text-muted); }

/* Bottone detail ordini */
.admin-btn-detail {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px solid var(--border-med);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.admin-btn-detail:hover { border-color: var(--red); color: var(--red); background: var(--red-glow); }
.admin-btn-detail svg { width: 13px; height: 13px; stroke: currentColor; }

/* Sezioni modal ordine */
.od-modal-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.od-modal-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.od-modal-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* Articoli editabili nel modal ordine */
.od-edit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.od-edit-item:last-child { border-bottom: none; }
.od-edit-thumb {
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
}
.od-edit-thumb img { width: 100%; height: 100%; object-fit: cover; }
.od-edit-thumb-ph { width: 100%; height: 100%; background: var(--surface-3); }
.od-edit-info { flex: 1; min-width: 0; }
.od-edit-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.od-edit-sku { font-size: 10px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }
.od-edit-qty-wrap { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.od-edit-remove {
  width: 26px; height: 26px;
  border: none; background: none;
  cursor: pointer;
  color: var(--danger);
  display: flex; align-items: center; justify-content: center;
}
.od-edit-remove svg { width: 15px; height: 15px; stroke: currentColor; }
.od-edit-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  min-width: 60px;
  text-align: right;
  flex-shrink: 0;
}
.od-edit-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0 4px;
  border-top: 1px solid var(--border-med);
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}
#od-grand-total { color: var(--text); font-size: 20px; font-weight: 800; }

/* Pulsante compatto nel modal */
.od-btn-compact {
  padding: 9px 16px;
  font-size: 11px;
}

/* Note textarea nel modal */
.od-note-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border-med);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  background: var(--surface-2);
  outline: none;
  resize: vertical;
  min-height: 80px;
}
.od-note-textarea:focus { border-color: var(--red); }

/* Pulsante annulla ordine */
.od-btn-cancel {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(255,69,58,.25);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  cursor: pointer;
  justify-content: center;
  transition: background .15s;
}
.od-btn-cancel:hover { background: rgba(255,69,58,.18); }

/* Navbar mobile: gear admin item */
.navbar .btn-admin-gear {
  border: none;
  background: none;
  border-radius: 0;
  width: auto;
  height: auto;
  color: var(--red);
  flex-direction: column;
  gap: 5px;
  padding-bottom: var(--safe-bottom);
}
.navbar .btn-admin-gear svg { width: 22px; height: 22px; stroke: var(--red); }

@media (max-width: 899px) {
  .admin-colors-palette { grid-template-columns: 1fr; }
}

/* ── v2.3 — Clienti admin + admin bulk picker ── */

/* Admin bulk sheet: z-index dinamico - va sopra qualsiasi sheet aperto */
#admin-bulk-overlay { z-index: 4000 !important; }
#admin-bulk-sheet   { z-index: 4001 !important; max-height: 92vh; }

/* Catalogo admin */
.admin-catalogo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.admin-cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.admin-cat-card:hover { border-color: var(--border-med); transform: translateY(-1px); }
.admin-cat-img { width: 100%; aspect-ratio: 1/1; background: var(--surface-2); overflow: hidden; }
.admin-cat-img img { width: 100%; height: 100%; object-fit: cover; }
.admin-cat-img-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--surface-3); }
.admin-cat-body { padding: 10px 12px; }
.admin-cat-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.admin-cat-sku  { font-size: 10px; color: var(--text-muted); font-weight: 500; margin-bottom: 6px; }
.admin-cat-price { font-size: 15px; font-weight: 800; color: var(--red); margin-bottom: 4px; }
.admin-cat-stock { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 2px 7px; border-radius: 20px; display: inline-block; }
.admin-cat-stock.instock { background: var(--success-bg); color: var(--success); }
.admin-cat-stock.outofstock { background: var(--danger-bg); color: var(--danger); }

/* Pulsante ordini agente nella card */
.admin-agent-orders-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 14px; margin-top: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text-secondary);
  font-size: 12px; font-weight: 700; font-family: 'Montserrat', sans-serif;
  cursor: pointer; justify-content: center;
  transition: background .15s, border-color .15s, color .15s;
}
.admin-agent-orders-btn:hover { background: var(--red-glow); border-color: rgba(224,32,32,.25); color: var(--red); }

/* Bottone edit agente */
.admin-agent-edit-btn {
  width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid var(--border-med); background: var(--surface-3);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s, border-color .15s;
}
.admin-agent-edit-btn:hover { background: var(--red-glow); border-color: rgba(224,32,32,.3); }
.admin-agent-edit-btn svg { width: 14px; height: 14px; stroke: var(--text-muted); }

/* Bottone detail ordini */
.admin-btn-detail {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border: 1px solid var(--border-med);
  border-radius: 7px; background: var(--surface-2); color: var(--text-secondary);
  font-size: 11px; font-weight: 700; font-family: 'Montserrat', sans-serif;
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.admin-btn-detail:hover { border-color: var(--red); color: var(--red); background: var(--red-glow); }
.admin-btn-detail svg { width: 13px; height: 13px; stroke: currentColor; }

/* Ordine modal sections */
.od-modal-section { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.od-modal-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.od-modal-section-title { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }

.od-edit-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.od-edit-item:last-child { border-bottom: none; }
.od-edit-thumb { width: 44px; height: 44px; border-radius: var(--r-sm); overflow: hidden; flex-shrink: 0; background: var(--surface-2); }
.od-edit-thumb img { width: 100%; height: 100%; object-fit: cover; }
.od-edit-thumb-ph { width: 100%; height: 100%; background: var(--surface-3); }
.od-edit-info { flex: 1; min-width: 0; }
.od-edit-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.od-edit-sku  { font-size: 10px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }
.od-edit-qty-wrap { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.od-edit-remove { width: 26px; height: 26px; border: none; background: none; cursor: pointer; color: var(--danger); display: flex; align-items: center; justify-content: center; }
.od-edit-remove svg { width: 15px; height: 15px; stroke: currentColor; }
.od-edit-total { font-size: 13px; font-weight: 700; color: var(--text); min-width: 60px; text-align: right; flex-shrink: 0; }
.od-edit-total-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 4px; border-top: 1px solid var(--border-med); margin-top: 6px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .8px; }
#od-grand-total { color: var(--text); font-size: 20px; font-weight: 800; }
.od-btn-compact { padding: 9px 16px; font-size: 11px; }
.od-note-textarea { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border-med); border-radius: var(--r-sm); font-size: 13px; font-family: 'Montserrat', sans-serif; color: var(--text); background: var(--surface-2); outline: none; resize: vertical; min-height: 80px; }
.od-note-textarea:focus { border-color: var(--red); }
.od-btn-cancel { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px; background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(255,69,58,.25); border-radius: var(--r-sm); font-size: 12px; font-weight: 700; font-family: 'Montserrat', sans-serif; cursor: pointer; justify-content: center; transition: background .15s; }
.od-btn-cancel:hover { background: rgba(255,69,58,.18); }
.od-btn-add-product { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border: 1px solid var(--border-med); border-radius: 7px; background: var(--surface-2); color: var(--text-secondary); font-size: 11px; font-weight: 700; font-family: 'Montserrat', sans-serif; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: all .15s; }
.od-btn-add-product:hover { border-color: var(--red); color: var(--red); background: var(--red-glow); }
.od-prod-results { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.od-prod-result-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); transition: background .15s; }
.od-prod-result-item:last-child { border-bottom: none; }
.od-prod-result-item:hover { background: var(--surface-3); }
.od-addr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.od-addr-grid .field { margin-bottom: 0; }
.od-addr-grid .field label { font-size: 10px; }
.od-addr-grid .field input { padding: 9px 12px; font-size: 13px; }
.od-addr-full { grid-column: 1 / -1; }

/* Palette colori */
.admin-colors-palette { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-color-entry { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--border); }
.admin-color-entry-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); flex: 1; }
.admin-color-entry-ctrl { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

@media (max-width: 600px) {
  .admin-catalogo-grid { grid-template-columns: repeat(2, 1fr); }
  .od-addr-grid { grid-template-columns: 1fr; }
  .od-addr-full { grid-column: 1; }
  .admin-colors-palette { grid-template-columns: 1fr; }
}

/* ── Admin Product Overlay ── */
.admin-product-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.admin-product-overlay.open {
  transform: translateX(0);
}
.admin-product-overlay-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.admin-product-overlay-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.admin-product-overlay-topbar .topbar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#admin-product-overlay-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 40px;
}

/* ── Tabelle mobile: overflow orizzontale ── */
.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-table {
  min-width: 500px;
}

/* ── Mobile: fix overflow generale ── */
@media (max-width: 600px) {
  .admin-filter-bar {
    flex-wrap: wrap;
  }
  .admin-filter-bar select {
    min-width: 0;
    flex: 1 1 140px;
  }
  .admin-filter-bar .admin-btn-save {
    flex: 1 1 100%;
  }
  .od-edit-item {
    flex-wrap: nowrap;
    gap: 6px;
  }
  .od-edit-total {
    min-width: 50px;
    font-size: 12px;
  }
  .admin-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── LOGIN FOOTER: APK + GUIDA ── */
.login-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}
.apk-download-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  background: var(--surface-2);
  border: 1.5px solid var(--border-med);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .2s, background .2s;
  width: 100%;
  justify-content: center;
}
.apk-download-btn:hover {
  border-color: var(--accent);
  background: rgba(224,32,32,.08);
  color: var(--accent);
}
.apk-download-btn svg { stroke: currentColor; }
.install-guide-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  transition: color .2s;
}
.install-guide-btn:hover { color: var(--text); }

/* ── MODALE GENERICA ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.72);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(2px);
}
@media (min-width: 500px) {
  .modal-overlay { align-items: center; padding: 20px; }
}
.modal-box {
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 -4px 40px rgba(0,0,0,.5);
}
@media (min-width: 500px) {
  .modal-box { border-radius: var(--r-md); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 0;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .2s;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 16px 18px 24px; }

/* ── STEPS GUIDA ── */
.guide-step {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
  align-items: flex-start;
}
.guide-step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.guide-step-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
}
.guide-step-text strong { color: var(--text); }
.guide-step-text em { color: var(--text); font-style: normal; font-weight: 600; }
.guide-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(224,32,32,.08);
  border: 1px solid rgba(224,32,32,.2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}
.guide-note svg { flex-shrink: 0; margin-top: 1px; stroke: var(--accent); }
.product-category {font-size: 12px;}

/* ── TABS DETTAGLIO CLIENTE ── */
.cd-tabs{display:flex;background:var(--surface);border-bottom:1px solid var(--border);flex-shrink:0}
.cd-tab{flex:1;padding:12px 8px;font-size:13px;font-weight:700;font-family:'Montserrat',sans-serif;color:var(--text-muted);background:none;border:none;cursor:pointer;border-bottom:2px solid transparent;transition:color .15s,border-color .15s}
.cd-tab.active{color:var(--red);border-bottom-color:var(--red)}

/* ── BOZZE ORDINE ── */
.drafts-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid var(--border)}
.drafts-title{font-size:12px;font-weight:700;color:var(--text-muted);text-transform:uppercase;letter-spacing:.8px}
.draft-card{background:var(--surface);border:1px solid var(--border-med);border-radius:var(--r);padding:12px 14px;margin-bottom:8px;display:flex;align-items:center;gap:12px}
.draft-card-info{flex:1;min-width:0}
.draft-card-customer{font-size:14px;font-weight:700;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.draft-card-meta{font-size:11px;color:var(--text-muted);margin-top:2px}
.draft-card-total{font-size:13px;font-weight:800;color:var(--red);flex-shrink:0}
.draft-card-actions{display:flex;gap:6px;flex-shrink:0}
.draft-resume-btn{font-size:11px;font-weight:700;background:var(--red);color:#fff;border:none;border-radius:6px;padding:5px 10px;cursor:pointer;font-family:'Montserrat',sans-serif}
.draft-delete-btn{width:28px;height:28px;border-radius:6px;background:var(--surface-3);border:1px solid var(--border-med);cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.draft-delete-btn svg{width:13px;height:13px;stroke:var(--text-muted)}

/* ── STORICO ORDINI CLIENTE ── */
.co-order-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:12px 14px;margin-bottom:8px;cursor:pointer;transition:background .15s}
.co-order-card:active{background:var(--surface-2)}
.co-order-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}
.co-order-num{font-size:13px;font-weight:700;color:var(--text)}
.co-order-bottom{display:flex;align-items:center;justify-content:space-between;margin-top:6px}
.co-order-total{font-size:14px;font-weight:800;color:var(--text)}
.co-order-date{font-size:11px;color:var(--text-muted)}
