 :root{--blue:#148bc6;--deep:#071b2c;--ink:#152233;--muted:#6a7480;--gold:#d6a542;--bg:#f4f7fb;--panel:#fff;--line:#dbe4ee;--good:#148a5b;--bad:#c94848;--warn:#c68416;--shadow:0 18px 50px rgba(9,27,44,.12)}
*{box-sizing:border-box}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;background:var(--bg);color:var(--ink)}button,input,select,textarea{font:inherit}button{cursor:pointer}.hidden{display:none!important}.sub{color:var(--muted);line-height:1.55;margin:.35rem 0}.eyebrow{text-transform:uppercase;letter-spacing:.1em;font-size:12px;font-weight:900;color:var(--blue)}
.login-screen{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at top right,rgba(20,139,198,.22),transparent 34%),linear-gradient(135deg,#eef7ff,#fff)}.login-card{width:min(460px,100%);background:white;border:1px solid var(--line);border-radius:32px;padding:34px;box-shadow:var(--shadow)}.login-logo{width:142px;height:98px;object-fit:contain;margin-bottom:12px}.login-card h1{font-size:36px;margin:.2rem 0}.error{color:var(--bad);font-weight:800;min-height:18px}
.app{min-height:100vh;display:grid;grid-template-columns:290px 1fr}.sidebar{position:sticky;top:0;height:100vh;overflow:auto;background:linear-gradient(180deg,#071b2c,#0e3352);color:#eaf7ff;padding:18px;border-right:1px solid rgba(255,255,255,.1)}body[data-side="wholesale"] .sidebar{background:linear-gradient(180deg,#064e3b,#047857)}body[data-side="accounting"] .sidebar{background:linear-gradient(180deg,#2d1b69,#4c1d95)}.brand{display:flex;align-items:center;gap:12px;padding:10px 8px 18px;border-bottom:1px solid rgba(255,255,255,.12);margin-bottom:14px}.brand img{width:78px;height:58px;object-fit:contain;background:white;border-radius:16px;padding:5px}.brand b{display:block;font-size:18px}.brand span{font-size:12px;color:#b9d9ec}.nav{display:grid;gap:6px}.nav button{border:0;background:transparent;color:#d5ebfa;text-align:left;padding:11px 12px;border-radius:14px;font-weight:800;display:flex;gap:10px;align-items:center}.nav button:before{content:"";width:9px;height:9px;border-radius:50%;background:#63b7e9}body[data-side="wholesale"] .nav button:before{background:#34d399}body[data-side="accounting"] .nav button:before{background:#c4b5fd}.nav button:hover,.nav button.active{background:rgba(255,255,255,.12);color:white}.nav small{display:block;color:#a7cbe2;font-weight:600;margin-top:2px}
.main{min-width:0;padding:22px}.topbar{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:14px}.topbar h1{font-size:32px;margin:0}.top-actions{display:flex;gap:10px;align-items:center}.module-switch{display:grid;gap:4px;font-size:11px;text-transform:uppercase;letter-spacing:.06em;font-weight:900;color:#52606d}.module-switch select{min-width:145px;border:1px solid var(--line);border-radius:15px;padding:11px 13px;background:white;color:var(--ink);font-weight:900}#globalSearch{width:300px;border:1px solid var(--line);border-radius:16px;padding:12px 14px;background:white}.notice{background:#eaf7ff;border:1px solid #bee2f7;color:#0f5d89;padding:13px 15px;border-radius:18px;margin-bottom:18px;font-weight:750}.mode-banner{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px;border-radius:22px;padding:16px 18px;color:white;box-shadow:var(--shadow)}.mode-banner b{font-size:20px}.mode-banner span{opacity:.92}.mode-banner.wholesale{background:linear-gradient(135deg,#047857,#10b981)}.btn{border:0;border-radius:14px;padding:12px 16px;font-weight:900;display:inline-flex;align-items:center;justify-content:center;gap:8px}.gold{background:linear-gradient(135deg,#f3c76e,#d6a542);color:#201500}.dark,.ghost-dark{background:var(--deep);color:white}.ghost-dark{width:100%}.light{background:#eef3f8;color:#26394f}.danger{background:#ffe8e8;color:#a32020}.goodbtn{background:#e8fff4;color:#12734d}.stack{display:grid;gap:14px}.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.grid4{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.panel{background:var(--panel);border:1px solid var(--line);border-radius:24px;padding:20px;box-shadow:0 10px 30px rgba(9,27,44,.06);overflow:hidden}.panel h2{margin-top:0}.kpi{background:white;border:1px solid var(--line);border-radius:22px;padding:18px;box-shadow:0 10px 28px rgba(9,27,44,.06)}.kpi span{display:block;color:var(--muted);font-weight:800;font-size:13px}.kpi b{display:block;font-size:26px;margin-top:7px}.toolbar{display:flex;gap:10px;flex-wrap:wrap;margin:0 0 14px}.module-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-end;margin:0 0 16px}.module-head h2{font-size:28px;margin:0}.tabs{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 14px}.tabs button{border:1px solid var(--line);background:white;border-radius:999px;padding:9px 12px;font-weight:850}.tabs button.active{background:var(--deep);color:white}
table{width:100%;border-collapse:collapse;background:white}th,td{text-align:left;padding:13px 12px;border-bottom:1px solid var(--line);font-size:14px;vertical-align:top}th{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:#52606d;background:#f8fafc}tr:hover td{background:#fbfdff}.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:18px}.pill{display:inline-flex;border-radius:999px;padding:5px 9px;font-weight:900;font-size:12px}.good{background:#e8fff4;color:var(--good)}.warn{background:#fff4db;color:var(--warn)}.bad{background:#ffe8e8;color:var(--bad)}.info{background:#eaf7ff;color:#126a99}.mini{border:1px solid var(--line);background:white;border-radius:10px;padding:7px 9px;font-size:12px;font-weight:850;margin:2px}.cards{display:grid;gap:10px}.card{background:#fbfdff;border:1px solid var(--line);border-radius:16px;padding:14px}.highlight{outline:3px solid rgba(214,165,66,.5)!important;background:#fffaf0!important}
.form label{display:grid;gap:7px;font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:#4b5a68;font-weight:900}.form input,.form select,.form textarea{border:1px solid var(--line);border-radius:14px;padding:12px;background:white;color:var(--ink);min-width:0}.form textarea{min-height:110px;resize:vertical}.full{grid-column:1/-1}dialog{border:0;border-radius:24px;padding:0;width:min(760px,calc(100vw - 24px));box-shadow:0 30px 90px rgba(0,0,0,.28)}dialog::backdrop{background:rgba(5,16,28,.45)}#modalForm{padding:22px}.modal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}.modal-head h2{margin:0}#modalClose{border:0;background:#eef3f8;border-radius:50%;width:34px;height:34px;font-size:20px}.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}.status-flow{display:flex;gap:8px;flex-wrap:wrap}.receipt-box{background:white;border:1px dashed #9db6ca;border-radius:18px;padding:18px;line-height:1.65}.muted{color:var(--muted)}
@media(max-width:980px){.app{grid-template-columns:1fr}.sidebar{position:relative;height:auto}.nav{grid-template-columns:repeat(2,1fr)}.topbar{display:block}.top-actions{margin-top:12px;flex-wrap:wrap}#globalSearch{width:100%}.grid4,.grid3,.grid2{grid-template-columns:1fr}.module-head{display:block}.main{padding:16px}.module-switch,.module-switch select{width:100%}}
@media(max-width:560px){.login-card{padding:24px;border-radius:24px}.nav{grid-template-columns:1fr}.brand img{width:64px;height:48px}.topbar h1{font-size:26px}.panel,.kpi{border-radius:18px;padding:15px}th,td{font-size:13px;padding:10px}.btn{width:100%}.toolbar .btn,.toolbar select{width:100%}.modal-actions{display:grid}.status-flow{display:grid}.top-actions{display:grid}.sidebar{padding:14px}.main{padding:12px}.notice{font-size:13px}.mode-banner{display:block}.mode-banner b{display:block;margin-bottom:4px}}


/* Stage 3: original-style module selection flow */
.module-select{min-height:100vh;display:grid;place-items:center;padding:28px;background:radial-gradient(circle at 12% 15%,rgba(20,139,198,.18),transparent 32%),radial-gradient(circle at 90% 10%,rgba(214,165,66,.18),transparent 30%),linear-gradient(135deg,#f7fafc,#edf4f8)}
.select-shell{width:min(980px,100%);background:rgba(255,255,255,.9);border:1px solid var(--line);border-radius:34px;padding:32px;box-shadow:var(--shadow)}
.select-head{display:flex;align-items:center;gap:18px;margin-bottom:24px}.select-head img{width:110px;height:76px;object-fit:contain;background:white;border-radius:20px;border:1px solid var(--line);padding:8px}.select-head h1{margin:.15rem 0;font-size:38px;letter-spacing:-.035em}
.module-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin:20px 0}.module-card{border:1px solid var(--line);border-radius:28px;background:white;text-align:left;padding:24px;min-height:210px;box-shadow:0 16px 40px rgba(9,27,44,.08);transition:.2s ease;position:relative;overflow:hidden}.module-card:after{content:"";position:absolute;right:-40px;bottom:-40px;width:120px;height:120px;border-radius:50%;opacity:.14}.module-card:hover{transform:translateY(-4px);box-shadow:0 22px 54px rgba(9,27,44,.16)}.module-card span{display:inline-flex;border-radius:999px;padding:7px 10px;font-size:12px;font-weight:950;text-transform:uppercase;letter-spacing:.08em}.module-card b{display:block;font-size:25px;margin:42px 0 8px;color:var(--ink)}.module-card small{display:block;color:var(--muted);line-height:1.5;font-weight:700}.module-card.retail span{background:#eaf7ff;color:#126a99}.module-card.retail:after{background:#148bc6}.module-card.wholesale span{background:#e8fff4;color:#047857}.module-card.wholesale:after{background:#10b981}.module-card.accounting span{background:#f1ebff;color:#5b21b6}.module-card.accounting:after{background:#7c3aed}
body[data-side="retail"] .notice:before{content:"Retail workspace • ";font-weight:950}body[data-side="wholesale"] .notice:before{content:"Wholesale workspace • ";font-weight:950}body[data-side="accounting"] .notice:before{content:"Accounting workspace • ";font-weight:950}
body[data-side="wholesale"] .notice{background:#ecfdf5;border-color:#bbf7d0;color:#047857}body[data-side="accounting"] .notice{background:#f5f3ff;border-color:#ddd6fe;color:#5b21b6}
@media(max-width:760px){.select-shell{padding:22px;border-radius:24px}.select-head{display:block}.select-head img{width:94px;height:66px;margin-bottom:10px}.select-head h1{font-size:30px}.module-cards{grid-template-columns:1fr}.module-card{min-height:auto}.module-card b{margin:26px 0 8px}.module-select{padding:16px}}

.auth-help{margin:12px 0 0;text-align:center}.auth-help a{color:#0f6ea8;font-weight:900;text-decoration:none}.auth-help a:hover{text-decoration:underline}.auth-ok{color:var(--good)!important;background:transparent!important;padding:0!important}

/* Invoice design based on supplied Debbysamad header reference */
.invoice-sheet{background:#fff;color:#111;border:1px solid #d8d8d8;border-radius:10px;padding:34px;max-width:880px;margin:0 auto;font-family:Georgia,'Times New Roman',serif}.invoice-header{text-align:center;padding:20px 10px 36px;border-bottom:1px solid #ececec}.invoice-header img{width:150px;height:118px;object-fit:contain;display:block;margin:0 auto 22px}.invoice-header h1{font-family:Georgia,'Times New Roman',serif;font-size:28px;letter-spacing:.01em;margin:0 0 58px;font-weight:900;color:#111}.invoice-header p{font-family:Georgia,'Times New Roman',serif;font-size:18px;line-height:1.35;margin:3px 0;color:#111}.invoice-meta{display:flex;justify-content:space-between;gap:18px;padding:22px 0;font-family:Arial,sans-serif;line-height:1.55}.invoice-total{text-align:right;font-size:22px;font-weight:900;margin-top:18px;font-family:Arial,sans-serif}.invoice-note{font-family:Arial,sans-serif;color:#56616f;margin-top:18px}.invoice-sheet .table-wrap{font-family:Arial,sans-serif;border-radius:0}.invoice-sheet th{background:#f2f2f2;color:#111}.invoice-sheet td,.invoice-sheet th{border-color:#d6d6d6}
@media print{body *{visibility:hidden}.invoice-sheet,.invoice-sheet *{visibility:visible}.invoice-sheet{position:absolute;left:0;top:0;width:100%;border:0;border-radius:0;padding:28px}.modal-head,.modal-actions,#modalClose{display:none!important}dialog{width:100vw;max-width:100vw;box-shadow:none}}

/* Mobile visual polish for shared BMS link preview */
@media(max-width:760px){
  body{background:#022c22;}
  .app{display:block;background:linear-gradient(180deg,#022c22 0%,#064e3b 42%,#f4f7fb 42%)}
  .sidebar{position:relative;height:auto;min-height:100vh;padding:18px 16px 24px;background:linear-gradient(180deg,#052e26 0%,#064e3b 52%,#047857 100%)!important;border-right:0;box-shadow:inset 0 -80px 120px rgba(0,0,0,.12)}
  .brand{background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.16);border-radius:22px;padding:12px;margin:0 0 18px;box-shadow:0 16px 40px rgba(0,0,0,.18);backdrop-filter:blur(10px)}
  .brand img{width:70px;height:54px;border-radius:16px;border:1px solid rgba(255,255,255,.35);box-shadow:0 10px 24px rgba(0,0,0,.2)}
  .brand b{font-size:20px;line-height:1.1;color:#fff;letter-spacing:-.02em}.brand span{font-size:13px;color:#d1fae5;font-weight:800}
  .nav{grid-template-columns:1fr;gap:10px}.nav button{position:relative;display:grid;grid-template-columns:18px minmax(0,1fr);align-items:start;gap:12px;width:100%;padding:15px 16px;border-radius:20px;background:rgba(255,255,255,.075);border:1px solid rgba(255,255,255,.1);box-shadow:0 10px 24px rgba(0,0,0,.08);color:#fff}
  .nav button:before{width:10px;height:10px;margin-top:7px;background:#5eead4;box-shadow:0 0 0 5px rgba(94,234,212,.12)}
  .nav button:hover,.nav button.active{background:linear-gradient(135deg,rgba(255,255,255,.2),rgba(255,255,255,.08));border-color:rgba(255,255,255,.24);transform:translateY(-1px)}
  .nav button{font-size:20px;line-height:1.15}.nav small{font-size:14px;line-height:1.35;color:#d1fae5;font-weight:750;margin-top:4px;opacity:.92}
  .main{padding:14px;background:#f4f7fb;border-radius:28px 28px 0 0;margin-top:-8px;box-shadow:0 -18px 45px rgba(0,0,0,.18)}
  .topbar{background:#fff;border:1px solid var(--line);border-radius:22px;padding:16px;box-shadow:0 10px 28px rgba(9,27,44,.08)}
  .notice{border-radius:20px;margin-top:12px}.mode-banner{border-radius:20px}.panel,.kpi{box-shadow:0 10px 26px rgba(9,27,44,.07)}
}
@media(max-width:420px){.sidebar{padding:14px 12px 22px}.brand{border-radius:20px}.brand img{width:62px;height:48px}.brand b{font-size:18px}.nav button{padding:14px 13px;font-size:18px;border-radius:18px}.nav small{font-size:13px}.main{border-radius:24px 24px 0 0}}


/* Mobile order-check editor: allow swiping sideways to see Unit Price and Amount in portrait */
.order-line-editor{max-width:100%;overflow:hidden}
.order-line-editor .table-wrap{max-width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;touch-action:pan-x pan-y;overscroll-behavior-x:contain;scrollbar-width:thin;background:white}
.order-line-editor table{min-width:650px;table-layout:fixed}
.order-line-editor th:nth-child(1),.order-line-editor td:nth-child(1){width:230px}.order-line-editor th:nth-child(2),.order-line-editor td:nth-child(2){width:110px}.order-line-editor th:nth-child(3),.order-line-editor td:nth-child(3){width:150px}.order-line-editor th:nth-child(4),.order-line-editor td:nth-child(4){width:160px}
.order-line-editor input[data-order-line-index]{width:100%;min-width:0}.order-line-editor input[data-order-price-index]{width:130px;min-width:0}.swipe-hint{display:none;color:var(--muted);font-weight:850;font-size:12px;margin:8px 0 0}
@media(max-width:560px){.order-line-editor{padding:12px}.order-line-editor .table-wrap{border-radius:14px}.order-line-editor table{min-width:600px}.order-line-editor th,.order-line-editor td{padding:9px 8px}.order-line-editor th:nth-child(1),.order-line-editor td:nth-child(1){width:190px}.order-line-editor th:nth-child(2),.order-line-editor td:nth-child(2){width:82px}.order-line-editor th:nth-child(3),.order-line-editor td:nth-child(3){width:135px}.order-line-editor th:nth-child(4),.order-line-editor td:nth-child(4){width:145px}.order-line-editor input[data-order-price-index]{width:112px}.swipe-hint{display:block}.order-line-editor .muted{font-size:12px;line-height:1.25}}
