:root{--ink:#2f3e4a;--sidebar:#3d4f5d;--sidebar-hi:#4d6273;--bg:#f4f6f8;--card:#fff;--line:#e3e8ed;--text:#22303a;--muted:#7b8794;--green:#2e9e5b;--green-soft:#e8f6ee;--red:#d64545;--red-soft:#fdeaea;--blue:#3d6fb4;--blue-soft:#e8f0fb;--amber:#d99b21;--amber-soft:#fdf3e0;--radius:10px;--shadow:0 1px 2px #1020300f, 0 4px 12px #1020300d}*{box-sizing:border-box}html,body{background:var(--bg);color:var(--text);-webkit-font-smoothing:antialiased;margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:15px}a{color:inherit;text-decoration:none}h1,h2,h3{letter-spacing:-.01em;margin:0;font-weight:700}.shell{min-height:100vh;display:flex}.sidebar{background:var(--sidebar);color:#fff;flex-direction:column;flex:0 0 250px;width:250px;display:flex}.sidebar-brand{border-bottom:1px solid #ffffff1f;padding:26px 22px}.sidebar-brand .mark{letter-spacing:.02em;font-size:19px;font-weight:700}.sidebar-brand .sub{opacity:.6;letter-spacing:.08em;text-transform:uppercase;margin-top:3px;font-size:11px}.sidebar-who{border-bottom:1px solid #ffffff1f;padding:16px 22px}.sidebar-who .label{opacity:.55;letter-spacing:.1em;text-transform:uppercase;font-size:10px}.sidebar-who .name{margin-top:4px;font-size:15px;font-weight:600}.sidebar-nav{flex-direction:column;flex:1;gap:2px;padding:14px 12px;display:flex}.sidebar-nav a{color:#ffffffd1;border-radius:8px;padding:11px 14px;font-size:14.5px;font-weight:500;transition:background .12s,color .12s}.sidebar-nav a:hover{color:#fff;background:#ffffff14}.sidebar-nav a.active{color:#fff;background:#ffffff29;font-weight:600}.sidebar-nav .group{letter-spacing:.1em;text-transform:uppercase;opacity:.45;padding:16px 14px 6px;font-size:10px}.sidebar-foot{opacity:.45;padding:16px 22px;font-size:11px}.main{flex-direction:column;flex:1;min-width:0;display:flex}.topbar{border-bottom:1px solid var(--line);background:#fff;justify-content:space-between;align-items:center;padding:20px 32px;display:flex}.topbar h1{font-size:24px}.topbar .right{color:var(--muted);align-items:center;gap:14px;font-size:14px;display:flex}.content{padding:28px 32px 60px}.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}.card-pad{padding:22px}.card h2{margin-bottom:16px;font-size:17px}.grid{gap:18px;display:grid}.grid-4{grid-template-columns:repeat(4,1fr)}.grid-3{grid-template-columns:repeat(3,1fr)}.grid-2{grid-template-columns:repeat(2,1fr)}@media (max-width:1100px){.grid-4{grid-template-columns:repeat(2,1fr)}.grid-3,.grid-2{grid-template-columns:1fr}}@media (max-width:700px){.grid-4{grid-template-columns:1fr}}.stat{padding:20px 22px}.stat .label{color:var(--muted);font-size:13px;font-weight:500}.stat .value{letter-spacing:-.02em;margin-top:8px;font-size:28px;font-weight:700}.stat .value.green{color:var(--green)}.stat .value.red{color:var(--red)}.stat .hint{color:var(--muted);margin-top:6px;font-size:12px}table{border-collapse:collapse;width:100%}thead th{background:var(--ink);color:#fff;text-align:left;letter-spacing:.03em;white-space:nowrap;padding:13px 16px;font-size:12.5px;font-weight:600}thead th:first-child{border-top-left-radius:var(--radius)}thead th:last-child{border-top-right-radius:var(--radius)}tbody td{border-bottom:1px solid var(--line);vertical-align:middle;padding:13px 16px;font-size:14px}tbody tr:hover{background:#fafbfc}.num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}.table-wrap{border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);background:#fff;overflow-x:auto}.empty{text-align:center;color:var(--muted);padding:46px 20px;font-size:14px}.pill{white-space:nowrap;border-radius:999px;padding:4px 11px;font-size:12px;font-weight:600;display:inline-block}.pill.grey{color:#5a6b7a;background:#eef1f4}.pill.blue{background:var(--blue-soft);color:var(--blue)}.pill.green{background:var(--green-soft);color:var(--green)}.pill.red{background:var(--red-soft);color:var(--red)}.pill.amber{background:var(--amber-soft);color:var(--amber)}label.field{margin-bottom:15px;display:block}label.field .lab{margin-bottom:6px;font-size:13px;font-weight:600;display:block}input,select,textarea{width:100%;color:var(--text);background:#fff;border:1px solid #cfd8df;border-radius:8px;padding:10px 12px;font-family:inherit;font-size:14.5px}input:focus,select:focus,textarea:focus{border-color:var(--ink);outline:none;box-shadow:0 0 0 3px #2f3e4a17}input[type=number]{text-align:right}textarea{resize:vertical;min-height:84px}.btn{cursor:pointer;background:var(--ink);color:#fff;border:1px solid #0000;border-radius:8px;justify-content:center;align-items:center;gap:7px;padding:10px 18px;font-family:inherit;font-size:14px;font-weight:600;transition:opacity .12s,background .12s;display:inline-flex}.btn:hover{opacity:.9}.btn:disabled{opacity:.45;cursor:not-allowed}.btn.green{background:var(--green)}.btn.red{background:var(--red)}.btn.ghost{color:var(--text);background:#fff;border-color:#cfd8df}.btn.sm{padding:7px 13px;font-size:13px}.btn.block{width:100%}.btn-row{flex-wrap:wrap;gap:8px;display:flex}.toolbar{flex-wrap:wrap;align-items:center;gap:12px;margin-bottom:18px;display:flex}.toolbar .spacer{flex:1}.toolbar label{color:var(--muted);font-size:13px;font-weight:600}.toolbar select,.toolbar input{width:auto;min-width:160px}.notice{border-radius:8px;margin-bottom:18px;padding:13px 16px;font-size:14px}.notice.err{background:var(--red-soft);color:#a32e2e;border:1px solid #f3c9c9}.notice.ok{background:var(--green-soft);color:#1e7040;border:1px solid #bde3cc}.notice.info{background:var(--blue-soft);color:#2d5590;border:1px solid #c9dcf5}.muted{color:var(--muted)}.small{font-size:12.5px}.right{text-align:right}.mt{margin-top:18px}.mb{margin-bottom:18px}.row-between{justify-content:space-between;align-items:center;gap:14px;display:flex}.login-wrap{background:var(--bg);place-items:center;min-height:100vh;padding:24px;display:grid}.login-card{background:#fff;border-radius:14px;width:100%;max-width:400px;padding:40px 36px;box-shadow:0 10px 40px #1020301a}.login-card .mark{text-align:center;letter-spacing:.03em;font-size:22px;font-weight:700}.login-card .sub{text-align:center;color:var(--muted);letter-spacing:.1em;text-transform:uppercase;margin:6px 0 30px;font-size:12px}.steps{align-items:flex-start;margin:6px 0 4px;display:flex}.step{text-align:center;flex:1;position:relative}.step .dot{color:#8a99a6;z-index:1;background:#e7ecf0;border-radius:50%;place-items:center;width:32px;height:32px;margin:0 auto 7px;font-size:13px;font-weight:700;display:grid;position:relative}.step.done .dot{background:var(--ink);color:#fff}.step .cap{color:var(--muted);font-size:11.5px;font-weight:500}.step.done .cap{color:var(--text);font-weight:600}.step:before{content:"";background:#e7ecf0;height:3px;position:absolute;top:16px;left:0;right:50%}.step:after{content:"";background:#e7ecf0;height:3px;position:absolute;top:16px;left:50%;right:0}.step:first-child:before,.step:last-child:after{display:none}.step.done:before,.step.done-line:after{background:var(--ink)}.qty{align-items:center;gap:8px;display:flex}.qty button{cursor:pointer;width:34px;height:34px;color:var(--text);background:#f7f9fa;border:1px solid #cfd8df;border-radius:50%;font-size:17px;line-height:1}.qty button:hover{background:#eef2f5}.qty input{text-align:center;width:74px}.item-row{border-bottom:1px solid var(--line);justify-content:space-between;align-items:center;gap:16px;padding:14px 0;display:flex}.item-row:last-child{border-bottom:none}.item-row .nm{font-size:15px;font-weight:600}.item-row .pr{color:var(--muted);margin-top:2px;font-size:13px}.summary-line{justify-content:space-between;padding:7px 0;font-size:14px;display:flex}.summary-line.total{border-top:1px solid var(--line);margin-top:8px;padding-top:13px;font-size:17px;font-weight:700}@media (max-width:820px){.shell{flex-direction:column}.sidebar{flex:none;width:100%}.sidebar-nav{flex-direction:row;overflow-x:auto}.sidebar-nav .group{display:none}.content{padding:20px 16px 50px}.topbar{padding:16px 18px}}

/* ==== MOBILE PATCH ====================================================
   Appended override block. Nothing above this comment is modified, so
   deleting from here to EOF restores the original stylesheet exactly.
   Backup: ~/deploy-files/mob2tables051.css.orig
   ===================================================================== */
html{-webkit-text-size-adjust:100%}
.shell{min-height:100dvh}
.login-wrap{min-height:100dvh}
.table-wrap{-webkit-overflow-scrolling:touch}

/* Touch devices: cancel hover states that stick after a tap */
@media (hover:none){
.sidebar-nav a:hover{background:#0000;color:#ffffffd1}
.btn:hover{opacity:1}
.qty button:hover{background:#f7f9fa}
tbody tr:hover{background:#0000}
}

/* ---- Phones and small tablets --------------------------------------- */
@media (max-width:820px){
/* 16px stops iOS Safari zooming the page on field focus */
input,select,textarea{font-size:16px}
/* 44px minimum touch targets */
.qty button{width:44px;height:44px;font-size:20px;flex:0 0 auto}
.qty input{width:80px;height:44px}
.btn{min-height:44px;padding:12px 18px}
.btn.sm{min-height:40px;padding:10px 15px;font-size:14px}
.sidebar-nav a{padding:12px 16px}
/* Filter toolbars wrap instead of overflowing */
.toolbar{gap:10px}
.toolbar select,.toolbar input{min-width:0;flex:1 1 140px}
/* Scale chrome down */
.topbar{padding:14px 16px}
.topbar h1{font-size:19px}
.stat{padding:16px 18px}
.stat .value{font-size:24px}
.card-pad{padding:16px}
.login-card{padding:32px 24px}
/* Tighter tables fit more before scrolling sideways */
thead th{padding:11px 12px;font-size:12px}
tbody td{padding:11px 12px;font-size:13.5px}
/* Wizard step dots */
.step .dot{width:28px;height:28px;font-size:12px}
.step .cap{font-size:10.5px}
.step:before,.step:after{top:14px}

/* Sideways-scroll affordance: shadows appear only on the side that still
   has hidden content, and clear at either end (background-attachment:local) */
.table-wrap{
background:
 linear-gradient(to right,#fff 30%,#ffffff00) left center,
 linear-gradient(to left,#fff 30%,#ffffff00) right center,
 radial-gradient(farthest-side at 0 50%,#00000018,#00000000) left center,
 radial-gradient(farthest-side at 100% 50%,#00000018,#00000000) right center;
background-repeat:no-repeat;
background-size:40px 100%,40px 100%,15px 100%,15px 100%;
background-attachment:local,local,scroll,scroll;
}
/* Keep the first column anchored while scrolling sideways, so a row's
   identity stays visible instead of scrolling away with the rest */
.table-wrap thead th:first-child{position:sticky;left:0;z-index:3;background:var(--ink)}
.table-wrap tbody td:first-child{position:sticky;left:0;z-index:2;background:#fff;box-shadow:1px 0 0 var(--line)}
.table-wrap tbody tr:hover td:first-child{background:#fafbfc}

/* ---- Two-column pages with a fixed-width sidebar --------------------
   /portal/new-order and the order detail pages set an inline grid of
   minmax(0,1fr) plus a fixed 340px / 330px sidebar. Below ~820px that
   sidebar alone exceeds the content area, so the flexible column is
   squeezed to 0px and everything in it disappears - on a phone the item
   picker vanished and no order could be placed at all. Inline styles
   beat stylesheet rules, hence !important. */
.grid[style*="minmax(0,1fr)"]{grid-template-columns:1fr!important;gap:14px}
/* Once stacked, a sidebar taller than the screen traps the scroll */
.card[style*="sticky"]{position:static!important}

/* ---- Order form item rows -------------------------------------------
   Keep name and stepper on one line. The name needs ~141px and the
   stepper ~152px, which fits 375px once the number input is narrowed -
   and it roughly halves the length of a 15-item list. */
.item-row{gap:12px}
.item-row .qty{flex:0 0 auto}
.item-row .qty input{width:56px}
.item-row .nm{line-height:1.3}
}

/* ---- Small phones ---------------------------------------------------- */
@media (max-width:520px){
.topbar h1{font-size:17px}
.content{padding:16px 12px 44px}
.btn-row .btn{flex:1 1 auto}
/* Full-width primary action - it is the end of a long form */
.card-pad > .btn.block,.btn.block{width:100%}
}

/* Very narrow phones: only here does the row genuinely stop fitting */
@media (max-width:360px){
.item-row{flex-direction:column;align-items:stretch}
.item-row .qty{justify-content:space-between}
}

/* ---- Table density on phones ----------------------------------------
   Tables are the last thing that still scrolls sideways. Proper labelled
   card-stacking needs data-label attributes the markup does not carry, so
   instead tighten density to cut how much is hidden. Measured on
   /admin/invoices at a 375px viewport: table 945px -> 817px.
   The sticky first column and edge shadow already signpost the scroll. */
@media (max-width:820px){
thead th{padding:8px 7px;font-size:11px}
tbody td{padding:8px 7px;font-size:12.5px}
.table-wrap thead th:first-child,.table-wrap tbody td:first-child{padding-left:10px}
}
