/* ===== RESET & BASE ===== */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
body{font-family:'Segoe UI',system-ui,sans-serif;background:#f1f5f9;color:#1e293b;font-size:15px;}
a{color:inherit;text-decoration:none;}
.layout{display:flex;min-height:100vh;}
.sidebar{width:240px;background:#1e293b;display:flex;flex-direction:column;position:fixed;top:0;left:0;height:100vh;z-index:100;transition:transform .3s;}
.main-wrap{margin-left:240px;flex:1;display:flex;flex-direction:column;min-height:100vh;}
.main-content{flex:1;padding:28px;}

.sidebar-nav{
  flex:1;
  padding:12px 0;
  overflow-y:auto;
  scrollbar-width:thin;
  scrollbar-color:rgba(99,102,241,.45) transparent;
}
.sidebar-nav::-webkit-scrollbar{width:1px;}
.sidebar-nav::-webkit-scrollbar-track{background:rgba(255,255,255,.05);border-radius:4px;}
.sidebar-nav::-webkit-scrollbar-thumb{background:rgba(99,102,241,.55);border-radius:4px;}
.sidebar-nav::-webkit-scrollbar-thumb:hover{background:rgba(165,180,252,.85);}
@media(max-width:768px){.sidebar{transform:translateX(-100%)}.sidebar.open{transform:translateX(0)}.main-wrap{margin-left:0}}
.sidebar-brand{display:flex;align-items:center;gap:12px;padding:20px 18px;border-bottom:1px solid rgba(255,255,255,.08);}
.brand-icon{font-size:1.8rem}.brand-name{color:#fff;font-weight:700;font-size:1rem;line-height:1.2}.brand-sub{color:#94a3b8;font-size:.72rem}
.nav-item{display:flex;align-items:center;gap:10px;padding:11px 20px;color:#cbd5e1;font-size:.9rem;transition:background .2s,color .2s;cursor:pointer;}
.nav-item:hover,.nav-item.active{background:rgba(99,102,241,.18);color:#a5b4fc}
.nav-item.active{border-right:3px solid #6366f1}
.nav-icon{width:20px;text-align:center;font-size:1rem}
.sidebar-footer{border-top:1px solid rgba(255,255,255,.08);padding:10px 0}
.nav-logout:hover{background:rgba(239,68,68,.15);color:#fca5a5}
.sidebar-toggle{display:none;background:none;border:none;font-size:1.4rem;cursor:pointer;color:#475569}
@media(max-width:768px){.sidebar-toggle{display:block}}
.topbar{background:#fff;padding:0 24px;height:60px;display:flex;align-items:center;gap:16px;border-bottom:1px solid #e2e8f0;position:sticky;top:0;z-index:50;box-shadow:0 1px 4px rgba(0,0,0,.05);}
.topbar-title{font-weight:700;font-size:1.1rem;flex:1;color:#1e293b}
.topbar-right{display:flex;align-items:center;gap:16px}
.topbar-user{display:flex;align-items:center;gap:10px}
.user-avatar{width:36px;height:36px;border-radius:50%;background:linear-gradient(135deg,#6366f1,#8b5cf6);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:.95rem}
.user-name{font-weight:600;font-size:.88rem;color:#1e293b}.user-role{font-size:.75rem;color:#64748b;text-transform:capitalize}
.card{background:#fff;border-radius:12px;padding:20px;box-shadow:0 1px 4px rgba(0,0,0,.07)}
.card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}
.card-title{font-weight:700;font-size:1rem;color:#1e293b}
.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:18px;margin-bottom:24px}
.stat-card{background:#fff;border-radius:12px;padding:20px 22px;box-shadow:0 1px 4px rgba(0,0,0,.07);display:flex;align-items:center;gap:16px}
.stat-icon{width:52px;height:52px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:1.5rem;flex-shrink:0}
.stat-icon.blue{background:#eff6ff}.stat-icon.green{background:#f0fdf4}.stat-icon.orange{background:#fff7ed}.stat-icon.purple{background:#faf5ff}.stat-icon.red{background:#fef2f2}.stat-icon.teal{background:#f0fdfa}
.stat-label{font-size:.8rem;color:#64748b;font-weight:500;margin-bottom:4px}.stat-value{font-size:1.5rem;font-weight:700;color:#1e293b;line-height:1}.stat-sub{font-size:.75rem;color:#94a3b8;margin-top:3px}
.charts-row{display:grid;grid-template-columns:2fr 1fr;gap:18px;margin-bottom:24px}
@media(max-width:900px){.charts-row{grid-template-columns:1fr}}
.chart-wrap{position:relative;height:260px}
.table-wrap{overflow-x:auto}
table{width:100%;border-collapse:collapse;font-size:.88rem}
thead tr{background:#f8fafc}
th{padding:11px 14px;text-align:left;font-weight:600;color:#475569;font-size:.8rem;text-transform:uppercase;letter-spacing:.04em;border-bottom:2px solid #e2e8f0}
td{padding:11px 14px;border-bottom:1px solid #f1f5f9;color:#374151}
tr:last-child td{border-bottom:none}
tr:hover td{background:#f8fafc}
.badge{display:inline-block;padding:3px 10px;border-radius:20px;font-size:.75rem;font-weight:600}
.badge-green{background:#dcfce7;color:#166534}.badge-blue{background:#dbeafe;color:#1e40af}.badge-orange{background:#ffedd5;color:#9a3412}.badge-red{background:#fee2e2;color:#991b1b}.badge-purple{background:#ede9fe;color:#6d28d9}.badge-gray{background:#f1f5f9;color:#475569}.badge-yellow{background:#fef9c3;color:#713f12}
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border-radius:8px;font-size:.88rem;font-weight:600;cursor:pointer;border:none;transition:opacity .2s,transform .1s}
.btn:hover{opacity:.88}.btn:active{transform:scale(.97)}
.btn-primary{background:linear-gradient(135deg,#6366f1,#8b5cf6);color:#fff}
.btn-success{background:#22c55e;color:#fff}.btn-danger{background:#ef4444;color:#fff}.btn-warning{background:#f59e0b;color:#fff}.btn-secondary{background:#e2e8f0;color:#475569}.btn-info{background:#0ea5e9;color:#fff}
.btn-sm{padding:5px 11px;font-size:.8rem}.btn-icon{padding:6px 9px;font-size:.85rem}
.form-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px}
.form-group{margin-bottom:16px}
.form-group label{display:block;font-weight:600;color:#374151;margin-bottom:5px;font-size:.85rem}
.form-control{width:100%;padding:9px 12px;border:1.5px solid #e2e8f0;border-radius:8px;font-size:.9rem;transition:border-color .2s;background:#fff}
.form-control:focus{outline:none;border-color:#6366f1;box-shadow:0 0 0 3px rgba(99,102,241,.1)}
select.form-control{cursor:pointer}
textarea.form-control{resize:vertical;min-height:80px}
.modal-overlay{display:none;position:fixed;inset:0;background:rgba(15,23,42,.6);z-index:200;align-items:center;justify-content:center}
.modal-overlay.open{display:flex}
.modal{background:#fff;border-radius:16px;padding:28px;width:100%;max-width:620px;max-height:90vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.3)}
.modal-lg{max-width:860px}
.modal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}
.modal-title{font-size:1.1rem;font-weight:700}
.modal-close{background:none;border:none;font-size:1.4rem;cursor:pointer;color:#64748b;padding:0 4px}
.modal-footer{display:flex;gap:10px;justify-content:flex-end;margin-top:20px;padding-top:16px;border-top:1px solid #e2e8f0}
.page-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:22px;flex-wrap:wrap;gap:10px}
.page-header h2{font-size:1.3rem;font-weight:700;color:#1e293b}
.search-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.search-input-wrap{position:relative}
.search-input-wrap input{padding-left:36px;width:240px}
.search-input-wrap::before{content:'🔍';position:absolute;left:10px;top:50%;transform:translateY(-50%);font-size:.85rem}
.tab-bar{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:18px}
.tab-btn{padding:7px 14px;border-radius:20px;border:1.5px solid #e2e8f0;background:#fff;cursor:pointer;font-size:.82rem;font-weight:600;color:#64748b;transition:all .2s}
.tab-btn.active,.tab-btn:hover{background:#6366f1;color:#fff;border-color:#6366f1}
.pos-layout{display:grid;grid-template-columns:1fr 380px;gap:20px}
@media(max-width:960px){.pos-layout{grid-template-columns:1fr}}
.pos-items-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:12px}
.pos-item-card{background:#fff;border-radius:10px;padding:14px;text-align:center;cursor:pointer;border:2px solid #e2e8f0;transition:border-color .2s,transform .1s}
.pos-item-card:hover{border-color:#6366f1;transform:translateY(-2px)}
.pos-item-card .item-emoji{font-size:1.8rem;margin-bottom:6px}
.pos-item-card .item-name{font-size:.8rem;font-weight:600;color:#1e293b;margin-bottom:2px}
.pos-item-card .item-price{font-size:.85rem;color:#6366f1;font-weight:700}
.pos-item-card .item-qty{font-size:.72rem;color:#94a3b8}
.cart-panel{background:#fff;border-radius:12px;padding:18px;display:flex;flex-direction:column;gap:14px;position:sticky;top:80px}
.cart-title{font-weight:700;font-size:1rem;border-bottom:1px solid #e2e8f0;padding-bottom:10px}
.cart-items{max-height:260px;overflow-y:auto}
.cart-item{display:flex;align-items:center;gap:8px;padding:8px 0;border-bottom:1px solid #f1f5f9;font-size:.85rem}
.cart-item-name{flex:1;font-weight:600}
.cart-qty-ctrl{display:flex;align-items:center;gap:4px}
.qty-btn{width:24px;height:24px;border-radius:6px;border:1px solid #e2e8f0;background:#f8fafc;cursor:pointer;display:flex;align-items:center;justify-content:center}
.cart-total-row{display:flex;justify-content:space-between;font-size:.88rem;color:#64748b}
.cart-grand-total{display:flex;justify-content:space-between;font-weight:700;font-size:1.1rem;color:#1e293b;border-top:2px solid #e2e8f0;padding-top:10px}
.alert{padding:12px 16px;border-radius:8px;margin-bottom:16px;font-size:.88rem;display:flex;align-items:center;gap:8px}
.alert-success{background:#f0fdf4;color:#166534;border:1px solid #bbf7d0}
.alert-error{background:#fef2f2;color:#dc2626;border:1px solid #fecaca}
.alert-warning{background:#fffbeb;color:#92400e;border:1px solid #fde68a}
.text-right{text-align:right}.text-center{text-align:center}.text-muted{color:#94a3b8}
.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mb-3{margin-bottom:12px}
.flex{display:flex}.gap-2{gap:8px}.items-center{align-items:center}.justify-between{justify-content:space-between}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
@media(max-width:600px){.grid-2{grid-template-columns:1fr}}
.w-full{width:100%}.hidden{display:none}
.actions{display:flex;gap:5px}
.barcode-preview{font-family:monospace;font-size:1.3rem;letter-spacing:4px;background:#f8fafc;padding:8px 14px;border-radius:6px;border:1px solid #e2e8f0;color:#1e293b}
