:root {
  --ink: #17142a; --ink2: #2a2546; --paper: #fff; --stone: #f5f4fb; --stone2: #eeebf8; --line: #e7e4f2;
  --muted: #6e6a85; --gold: #f2b544; --gold-deep: #d99a1e; --gold-ink: #8a5a00;
  --brand: #6c4cf5; --brand2: #9b5cf6; --brand-soft: #efeaff; --teal: #12a594; --rose: #e5486b; --sky: #2f7ff0;
  --ok: #17915a; --warn: #c26a00; --bad: #d23a3a; --info: #2f6fd6;
  --radius: 14px; --shadow: 0 1px 2px rgba(23,20,42,.04), 0 6px 20px rgba(23,20,42,.06);
  --side-w: 248px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--stone); color: var(--ink);
  font: 14px/1.55 "Plus Jakarta Sans", Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 260px; z-index: -1;
  background: radial-gradient(900px 260px at 75% -40px, rgba(108,76,245,.13), transparent 70%), radial-gradient(600px 220px at 20% -60px, rgba(242,181,68,.14), transparent 70%); }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.ic { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Shell */
.top { position: fixed; inset: 0 0 auto var(--side-w); height: 60px; background: rgba(245,244,251,.82); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 24px; z-index: 20; }
.top .logo { display: none; color: #fff; text-decoration: none; align-items: center; gap: 10px; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: var(--ink);
  background: linear-gradient(135deg, var(--gold), #ffd98a); box-shadow: 0 4px 14px rgba(242,181,68,.4); }
.logo-t { font-weight: 800; letter-spacing: .04em; } .logo-t b { color: var(--gold); }
.top-greet { font-weight: 600; color: var(--muted); }
.top .bell { margin-left: auto; color: var(--ink); text-decoration: none; position: relative; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); }
.top .bell .ic { width: 20px; height: 20px; }
.top .bell span { position: absolute; top: -5px; right: -5px; background: var(--rose); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 1px 6px; box-shadow: 0 0 0 2px var(--stone); }
.top .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: 0 0 36px;
  background: linear-gradient(135deg, var(--brand), var(--brand2)); }
.who-t { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.who-t b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-t small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: 18px; width: 38px; height: 38px; cursor: pointer; }

.side { position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); color: #d9d5ee; padding: 16px 12px; overflow-y: auto; z-index: 25;
  background: linear-gradient(180deg, #1d1838 0%, #17142a 60%, #120f22 100%); display: flex; flex-direction: column; gap: 2px; }
.side::before { content: "MGPL ERP"; display: block; font-weight: 800; letter-spacing: .06em; color: #fff; padding: 8px 12px 18px 56px; font-size: 15px;
  background: no-repeat 12px 2px / 34px 34px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 34'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23f2b544'/%3E%3Cstop offset='1' stop-color='%23ffd98a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='34' height='34' rx='10' fill='url(%23g)'/%3E%3Ctext x='17' y='23' font-family='Arial' font-weight='800' font-size='17' text-anchor='middle' fill='%2317142a'%3EM%3C/text%3E%3C/svg%3E"); }
.side a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: #cbc6e4; text-decoration: none; font-weight: 500; transition: background .15s, color .15s; }
.side a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side a.on { background: linear-gradient(90deg, rgba(108,76,245,.9), rgba(155,92,246,.75)); color: #fff; box-shadow: 0 6px 16px rgba(108,76,245,.35); }
.nav-group summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; cursor: pointer; color: #efecff; font-weight: 600; margin: 0; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: rgba(255,255,255,.06); }
.nav-group summary .chev { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid #8e88b0; border-bottom: 2px solid #8e88b0; transform: rotate(-45deg); transition: transform .2s; }
.nav-group[open] summary .chev { transform: rotate(45deg); }
.nav-group[open] summary { color: #fff; }
.nav-group summary .ic, .nav-single .ic, .nav-foot .ic { color: var(--gold); }
.nav-items { margin: 2px 0 6px 21px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.1); }
.nav-items a { padding: 6px 10px; font-size: 13px; }
.nav-single { font-weight: 600 !important; color: #efecff !important; }
.nav-single.on { color: #fff !important; }
.nav-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.nav-scrim { display: none; }
main.with-nav { margin-left: var(--side-w); padding: 84px 28px 56px; max-width: calc(1440px + var(--side-w)); }
main.bare { max-width: 760px; margin: 0 auto; padding: 48px 16px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 960px) {
  .menu-btn { display: block; }
  .top { left: 0; padding: 0 14px; }
  .top .logo { display: flex; color: var(--ink); }
  .top-greet, .who-t { display: none; }
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .side { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(23,20,42,.4); z-index: 24; }
  main.with-nav { margin-left: 0; padding: 76px 14px 40px; }
  h1 { font-size: 20px; }
}

/* Cards, grids */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.cols > .card { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { --tone: var(--brand); --tint: var(--brand-soft); position: relative; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 14px 20px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); display: block; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tone); }
.stat::after { content: ""; position: absolute; right: -24px; top: -24px; width: 84px; height: 84px; border-radius: 50%; background: var(--tint); }
.stat > * { position: relative; z-index: 1; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.stat:nth-child(5n+2) { --tone: var(--teal); --tint: #e1f6f3; } .stat:nth-child(5n+3) { --tone: var(--sky); --tint: #e4eefe; }
.stat:nth-child(5n+4) { --tone: var(--gold-deep); --tint: #fdf1d9; } .stat:nth-child(5n+5) { --tone: var(--rose); --tint: #fde6ec; }
.stat.good { --tone: var(--ok); --tint: #e2f5ea; } .stat.good .v { color: var(--ok); }
.stat.bad { --tone: var(--bad); --tint: #fde5e5; } .stat.bad .v { color: var(--bad); }
.stat.warn { --tone: var(--warn); --tint: #fdeedb; } .stat.warn .v { color: var(--warn); }
a.stat:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(23,20,42,.1); }
a.stat { transition: transform .15s, box-shadow .15s; }
.stat.is-on { outline: 2px solid var(--tone); }
.stat.tone-ink { --tone: var(--brand); --tint: var(--brand-soft); } .stat.tone-bangalore { --tone: var(--brand2); --tint: #f1e8ff; }
.stat.tone-hyderabad { --tone: var(--teal); --tint: #e1f6f3; } .stat.tone-mumbai { --tone: var(--sky); --tint: #e4eefe; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: var(--paper); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; color: var(--muted); font-weight: 700; white-space: nowrap; background: #faf9fe; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover td { background: #fbfaff; }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.row-bad td { background: #fdf1f0; }
td.empty { color: var(--muted); text-align: center; padding: 20px; }
.card .table-wrap { margin: 0 -18px; } .card .table-wrap table { border-top: 1px solid var(--line); }
.card .table-wrap th:first-child, .card .table-wrap td:first-child { padding-left: 18px; }
.card .table-wrap th:last-child, .card .table-wrap td:last-child { padding-right: 18px; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600;
  background: var(--stone2); color: var(--ink); white-space: nowrap; }
.b-pending_approval, .b-overdue, .b-reorder { background: #fdeee0; color: var(--warn); }
.b-approved, .b-received, .b-completed, .b-closed { background: #e4f3ea; color: var(--ok); }
.b-in_production, .b-in_progress, .b-partly_received, .b-open { background: #e5eef8; color: var(--info); }
.b-ready { background: #f6eed6; color: var(--gold-ink); }
.b-cancelled { background: #f6e3e1; color: var(--bad); }
.b-late { background: #fdf1f0; color: var(--bad); }

/* Forms */
.form label { display: block; margin-bottom: 12px; font-size: 12px; color: var(--muted); font-weight: 600; }
.form label > input, .form label > select, .form label > textarea { margin-top: 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #dcd8ea; border-radius: 10px; transition: border-color .15s, box-shadow .15s;
  font: inherit; color: var(--ink); background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(108,76,245,.18); }
textarea { min-height: 70px; }
input[type=checkbox] { width: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.narrow { max-width: 640px; }
.inline { display: inline; }
.check { display: flex !important; gap: 8px; align-items: center; font-weight: 500 !important; color: var(--ink) !important; }
table input, table select { padding: 6px 8px; min-width: 70px; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.form-row > * { flex: 1 1 140px; margin-bottom: 0 !important; }
.form-row > .btn { flex: 0 0 auto; }
fieldset { border: 1px dashed #d9d4ee; border-radius: var(--radius); padding: 12px; margin: 0 0 12px; }
legend { font-weight: 700; padding: 0 6px; }

.btn { display: inline-block; padding: 9px 16px; border-radius: 10px; border: 1px solid #d9d5ea; transition: background .15s, box-shadow .15s, transform .1s;
  background: #fff; color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--stone2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand2)); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(108,76,245,.3); }
.btn.primary:hover { background: linear-gradient(135deg, #5b3ce0, #8a4ae8); }
.btn.gold { background: linear-gradient(135deg, var(--gold), #ffd27a); border-color: transparent; color: var(--ink); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 5px 11px; font-size: 12px; border-radius: 8px; }

.flash { padding: 12px 16px; border-radius: 12px; font-weight: 500; margin-bottom: 12px; background: #e4f3ea; color: var(--ok); border: 1px solid #b9dcc7; }
.flash-err { background: #fdf1f0; color: var(--bad); border-color: #f0c4bf; }
.flash-warn { background: #fdeee0; color: var(--warn); border-color: #f1d1ad; }

/* Order timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 12px 20px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline .t { font-size: 12px; color: var(--muted); }

/* Capacity bar */
.bar { height: 8px; background: var(--stone2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.bar.warn > span { background: var(--warn); } .bar.full > span { background: var(--bad); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 7px 14px; border-radius: 99px; border: 1px solid var(--line); font-weight: 600; background: #fff; text-decoration: none; color: var(--ink); font-size: 13px; }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(108,76,245,.3); }
.pl td.n { min-width: 110px; }
.profit-pos { color: var(--ok); font-weight: 700; } .profit-neg { color: var(--bad); font-weight: 700; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs a { display: block; font-size: 12px; }
.thumbs img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
details summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.btn.wa { border-color: #1f7a4d; color: #1f7a4d; }
.approval-imgs { display: flex; gap: 12px; flex-wrap: wrap; }
.approval-imgs img { max-width: 100%; width: 320px; border-radius: 8px; border: 1px solid var(--line); }
.size-grid input { width: 70px; min-width: 60px; }
.warn-txt { color: var(--warn); font-weight: 700; }
.wa-menu { display: inline-block; position: relative; vertical-align: middle; }
.wa-menu > summary { list-style: none; margin: 0; }
.wa-menu > summary::-webkit-details-marker { display: none; }
.wa-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 220px; padding: 6px; }
.wa-pop button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; font: inherit; cursor: pointer; color: var(--ink); }
.wa-pop button:hover { background: var(--stone2); }
.btn.wa.disabled { opacity: .5; cursor: default; }
.wa-dialog { border: 1px solid var(--line); border-radius: 12px; padding: 18px; width: min(520px, calc(100vw - 32px)); }
.wa-dialog::backdrop { background: rgba(0,0,0,.35); }
.wa-dialog textarea { width: 100%; }
.cols > .card.wide { grid-column: 1 / -1; }
.side .nav-head-old { margin: 14px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.b-ready { background: #fdf1d9; }
.btn.wa { border-color: #b7e3c8; color: #128a4a; background: #f2fbf5; }
/* Warehouse stock */
.stock-meta { display: flex; align-items: center; gap: 8px; margin: -6px 0 14px; font-weight: 600; flex-wrap: wrap; }
.stock-meta .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(23,145,90,.15); }
.stock-meta.is-stale .dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(194,106,0,.15); }
.stock-meta.is-busy .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.chip { display: inline-flex; gap: 4px; align-items: baseline; padding: 3px 9px; border-radius: 8px; font-size: 12px; background: var(--stone2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip b { font-weight: 700; }
.lvl-ok { background: #e2f5ea; color: #0f6b40; } .lvl-low { background: #fdeedb; color: #9a5300; } .lvl-out { background: #fde5e5; color: #b02a2a; }
.num { padding: 2px 8px; border-radius: 6px; }
.stock-list { display: flex; flex-direction: column; gap: 8px; }
.stock-item { border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: box-shadow .15s; }
.stock-item[open] { box-shadow: var(--shadow); }
.stock-item > summary { list-style: none; display: grid; grid-template-columns: 52px minmax(180px, 280px) 1fr; gap: 12px; align-items: center; padding: 10px 12px; cursor: pointer; margin: 0; font-weight: 400; }
.stock-item > summary::-webkit-details-marker { display: none; }
.stock-item > summary img, .stock-item .noimg { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--stone2); display: grid; place-items: center; font-size: 22px; }
.si-title { display: flex; flex-direction: column; min-width: 0; } .si-title b { overflow: hidden; text-overflow: ellipsis; }
.si-sizes { display: flex; flex-wrap: wrap; gap: 5px; }
.stock-item .table-wrap { margin: 0; border-top: 1px solid var(--line); }
.si-actions { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px; margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 20px; }
@media (max-width: 700px) { .stock-item > summary { grid-template-columns: 44px 1fr; } .stock-item > summary img, .stock-item .noimg { width: 44px; height: 44px; } .si-sizes { grid-column: 1 / -1; } }
/* Quick add */
.quick-dialog h2 { margin-bottom: 12px; }
option.opt-new { font-weight: 700; color: var(--brand); }
/* Login */
main.bare .card { box-shadow: 0 20px 60px rgba(23,20,42,.12); }
main.bare:has(.login-wrap) > .page-head { display: none; }
.login-wrap { max-width: 400px; margin: 6vh auto 0; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-brand .logo-mark { width: 46px; height: 46px; font-size: 22px; border-radius: 14px; }
.login-brand b { display: block; font-size: 18px; letter-spacing: .04em; }
.login-brand span { font-size: 12px; color: var(--muted); }
.login-card { padding: 26px; }
.login-card h2 { font-size: 20px; margin-bottom: 4px; }
/* Attendance */
.att { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 3px; border-radius: 6px; font-size: 11px; font-weight: 700; text-decoration: none; background: var(--stone2); color: var(--muted); }
a.att:hover { outline: 2px solid var(--brand); }
.att-p { background: #e2f5ea; color: #0f6b40; } .att-a { background: #fde5e5; color: #b02a2a; } .att-h { background: #fdeedb; color: #9a5300; }
.att-l { background: #e4eefe; color: #1f56b8; } .att-hl { background: #efe7ff; color: #5b3ce0; }
.att-wo, .att-ho { background: #f1eff6; color: #8a84a0; font-weight: 600; } .att-ho { background: #fdf1d9; color: #8a6200; }
.att-none { background: #fff; border: 1px dashed #d9d4e6; } .att-out { background: transparent; }
.att-grid th.c, .att-grid td.c { padding: 4px 1px; text-align: center; font-size: 11px; } .att-grid th.off { background: #f6f4fa; }
.att-grid td.c .att { min-width: 24px; }
.att-day { margin-left: auto; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg label { position: relative; margin: 0; cursor: pointer; font-weight: 600; font-size: 12px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 10px; border-left: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.seg label:first-child span { border-left: 0; }
.seg label:hover span { background: var(--stone2); }
.seg input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: -2px; }
.seg-p input:checked + span { background: #1f9d5c; color: #fff; } .seg-a input:checked + span { background: #d64545; color: #fff; }
.seg-h input:checked + span { background: #e58a1f; color: #fff; } .seg-l input:checked + span { background: #2f6fde; color: #fff; }
.seg-hl input:checked + span { background: #6b4ce6; color: #fff; } .seg-none input:checked + span { background: var(--stone2); color: var(--ink); }
.att-reg td { vertical-align: middle; }
.leave-req { display: flex; gap: 14px; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.leave-req:first-of-type { border-top: 0; }
.leave-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } .leave-act input { width: 220px; }
.badge.lv-approved { background: #e2f5ea; color: #0f6b40; } .badge.lv-rejected { background: #fde5e5; color: #b02a2a; }
.badge.lv-pending { background: #fdeedb; color: #9a5300; } .badge.lv-cancelled { background: var(--stone2); color: var(--muted); }
.weekdays { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 14px; }
/* Rate card, warnings, overdue */
.rate-warn { margin: 4px 0 12px; padding: 10px 14px; border-radius: 10px; background: #fdeee0; color: #9a5300; border: 1px solid #f1d1ad; font-size: 13px; }
.rate-warn[hidden] { display: none; }
.rate-card th.c, .rate-card td.c { text-align: center; padding: 6px 4px; }
.rate-card td.c input { width: 82px; text-align: right; }
.rate-card th.grp { background: var(--brand-soft); color: var(--brand); } .rate-card th.grp2 { background: #e1f6f3; color: #0f7a6c; }
.rate-card tr.new-row td { background: #faf9fe; }
tr.row-warn td { background: #fff8ee; }
.due-chip { margin-left: auto; padding: 6px 12px; border-radius: 99px; background: #fde5e5; color: #b02a2a; font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap; }
.top .due-chip + .bell { margin-left: 8px; }
.due-pop { position: fixed; inset: auto 20px 20px auto; margin: 0; z-index: 60; width: min(420px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; border: 1px solid #f0c4bf;
  border-radius: 16px; padding: 18px 20px; box-shadow: 0 20px 60px rgba(23,20,42,.25); background: #fff; }
.due-pop h2 { color: #b02a2a; margin: 0 0 10px; font-size: 17px; }
.due-pop ul { list-style: none; margin: 0 0 12px; padding: 0; } .due-pop li { padding: 8px 0; border-top: 1px solid var(--line); } .due-pop li:first-child { border-top: 0; }
.due-pop form { justify-content: flex-end; }
.due-days { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; background: #fdeedb; color: #9a5300; white-space: nowrap; }
.due-days.late { background: #fde5e5; color: #b02a2a; } .due-days.today { background: #fdeedb; color: #9a5300; }
details.inline-edit { display: inline-block; margin-left: 8px; } details.inline-edit summary { color: var(--brand); cursor: pointer; }
details.inline-edit[open] { display: block; margin: 8px 0 0; }
table.trims td { vertical-align: middle; }

/* v5.3: galleries, PDF menu, mistakes, piece tracker, ranking, forecast */
.ok-txt { color: var(--ok); font-weight: 700; }
.wait-txt { color: var(--info); }
.gal-h { margin: 12px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.thumbs.gallery figure { margin: 0; width: 132px; }
.thumbs.gallery img { width: 132px; height: 132px; }
.thumbs.gallery figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.3; overflow-wrap: anywhere; }
.file-ic { display: flex; align-items: center; justify-content: center; width: 132px; height: 132px; border: 1px dashed var(--line); border-radius: 8px; padding: 8px; font-size: 12px; text-align: center; overflow-wrap: anywhere; background: var(--stone); }
.pdf-menu .wa-pop a, .pdf-menu .wa-pop button { display: block; width: 100%; text-align: left; }
.mistake-row { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.mistake-row:first-of-type { border-top: 0; }
.mistake-row .thumbs img { width: 64px; height: 64px; }
fieldset.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
fieldset.checks legend { font-weight: 700; font-size: 13px; }
fieldset.checks label.check { margin: 0; }
.note-box { margin-top: 6px; }
.pipe { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pipe-step { flex: 0 0 auto; min-width: 150px; max-width: 220px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--paper); position: relative; }
.pipe-step + .pipe-step::before { content: "›"; position: absolute; left: -8px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; }
.pipe-h { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.pipe-step.done { border-color: #bfe6cf; background: #f3fbf6; }
.pipe-step.out { border-color: #c9d8f5; background: #f4f8ff; }
.pipe-step.wait { border-color: #f1d1ad; background: #fff8ef; }
.pipe-step.late { border-color: #f0c4bf; background: #fff4f3; }
.pipe-amt { margin-top: 6px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pipe.compact .pipe-step { min-width: 120px; padding: 8px 10px; }
.pipe-order { padding: 12px 0; border-top: 1px solid var(--line); }
.pipe-order:first-of-type { border-top: 0; }
.pipe-title { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
h3.pipe-group { margin: 16px 0 6px; font-size: 15px; }
table.forecast tr.grp td { background: var(--stone); }
table.forecast tr.sub th { padding-top: 0; }
table.rank td { vertical-align: top; }
.b-ok { background: #e4f3ea; color: var(--ok); } .b-warn { background: #fdeee0; color: var(--warn); }
table.rank td:nth-child(2) { min-width: 180px; }

/* v5.4: WhatsApp chips, order stages, tracking links, public pages, letterhead preview, invoices */
.wa-mini { display: inline-block; }
.wa-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 7px; border-radius: 99px; background: #e9f8ef; color: #128a4a; font-size: 12px; font-weight: 600;
  border: 1px solid #c6ead4; cursor: pointer; white-space: nowrap; line-height: 1.4; }
.wa-chip:hover { background: #d9f2e3; }
.wa-chip .wa-ic { flex: none; }
.wa-none { color: var(--muted); }
.wa-mini .wa-pop { left: 0; right: auto; }
.stage-card { padding: 14px 18px; }
.stages { list-style: none; display: flex; margin: 0; padding: 0; gap: 0; overflow-x: auto; }
.stages li { flex: 1 1 0; min-width: 110px; position: relative; padding: 0 8px 0 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.stages li::before { content: ""; position: absolute; top: 13px; left: 30px; right: 4px; height: 2px; background: var(--line); }
.stages li:last-child::before { display: none; }
.stages li.done::before { background: var(--ok); }
.stages .dot { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--stone2); color: var(--muted); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); margin-bottom: 4px; }
.stages li.done .dot { background: var(--ok); color: #fff; box-shadow: none; }
.stages li.now .dot { background: var(--gold); color: var(--ink); box-shadow: 0 0 0 4px #fdf1d9; }
.stages li b { font-weight: 600; } .stages li small { color: var(--muted); font-size: 12px; }
.stages li.now b { color: var(--gold-ink); }
.tl-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.tl-row.dead { opacity: .55; }
.tl-act { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl-url { width: 230px; font-size: 12px; padding: 6px 8px; }
.pub-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-size: 15px; }
.pub-logo { max-height: 48px; max-width: 120px; }
body.pub .page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg.big span { padding: 10px 16px; font-size: 14px; }
.seg.big input:checked + span { background: var(--brand); color: #fff; }
.brand-prev { min-height: 70px; display: grid; place-items: center; background: var(--stone); border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 10px; padding: 10px; }
.brand-prev img { max-height: 90px; max-width: 100%; }
.lh-prev { border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 12px; background: #fff; }
.lh-top { display: flex; gap: 10px; align-items: flex-start; border-bottom: 2px solid var(--doc); padding-bottom: 8px; }
.lh-top img { max-height: 44px; max-width: 70px; }
.lh-top > div:nth-child(2), .lh-top > div:first-child:not(.lh-title) { flex: 1; }
.lh-brand { color: var(--doc); font-weight: 700; }
.lh-title { text-align: right; font-weight: 800; color: var(--doc); letter-spacing: .04em; }
.lh-th { background: var(--doc); color: #fff; padding: 5px 8px; margin-top: 10px; border-radius: 3px; font-weight: 600; }
.lh-foot { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; text-align: center; color: var(--muted); font-size: 11px; }
.card-warn { border-color: #f1d1ad; background: #fffaf3; }
ul.issues { margin: 6px 0 10px; padding-left: 18px; color: var(--warn); }
ul.issues li { margin-bottom: 4px; }
figcaption .dl { text-decoration: none; margin-left: 4px; opacity: .7; }
figcaption .dl:hover { opacity: 1; }
@media (max-width: 640px) {
  .stages li { min-width: 92px; font-size: 12px; }
  .tl-url { width: 100%; }
  .wa-chip span { display: none; }
}
.copy-row{display:flex;gap:6px;align-items:center}
.copy-row input{flex:1;min-width:0}
.cols.cols-wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); }
#invlines input[type=number] { max-width: 130px; margin-left: auto; display: block; text-align: right; }
#invlines td { vertical-align: middle; }
input[type=color] { height: 44px; padding: 4px; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 8px; }
.logo-t { white-space: nowrap; }
/* Phones: table rows become cards (labels come from app.js), so nothing scrolls sideways. */
@media (max-width: 700px) {
  .table-wrap:has(> table.stack) { overflow: visible; }
  table.stack, table.stack > tbody { display: block; width: 100%; min-width: 0 !important; background: transparent; }
  .card .table-wrap table.stack { border-top: 0; }
  table.stack > thead { display: none; }
  table.stack > tbody > tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--paper); }
  .card .table-wrap table.stack > tbody > tr { padding: 12px 18px; }
  table.stack > tbody > tr:last-child { border-bottom: 0; }
  table.stack > tbody > tr > td, table.stack > tbody > tr > th { display: flow-root; flex: 1 1 100%; min-width: 0; padding: 2px 0 !important; border: 0 !important;
    text-align: right; white-space: normal !important; overflow-wrap: anywhere; font-size: 14px; background: transparent; min-width: 0 !important; max-width: none !important; }
  table.stack > tbody > tr > td::before, table.stack > tbody > tr > th::before { content: attr(data-label); float: left; max-width: 48%; margin-right: 12px; text-align: left; color: var(--muted); font-size: 12.5px; font-weight: 600; line-height: 1.7; overflow-wrap: normal; }
  table.stack > tbody > tr > td[data-label=""]::before, table.stack > tbody > tr > td.st-title::before { display: none; }
  table.stack > tbody > tr > td[data-label=""] { text-align: left; }
  table.stack > tbody > tr > td:empty { display: none; }
  table.stack > tbody > tr > td.st-title { order: -1; display: block; flex: 1 1 calc(100% - 44px); text-align: left; font-size: 15px; padding-bottom: 4px !important; }
  table.stack > tbody > tr:has(> td.sz) > td.st-title { flex-basis: 100%; }
  table.stack > tbody > tr > td.bulk-col { order: -2; flex: 0 0 auto; width: auto; padding: 0 4px 0 0 !important; }
  table.stack > tbody > tr > td.bulk-col::before { display: none; }
  table.stack > tbody > tr > td.sz { flex: 0 0 auto; display: inline-flex; flex-direction: column; align-items: center; gap: 0; min-width: 46px; padding: 4px 8px !important; background: var(--stone); border-radius: 9px; text-align: center; }
  table.stack > tbody > tr > td.sz::before { float: none; margin: 0; max-width: none; text-align: center; font-size: 11px; line-height: 1.4; }
  table.stack > tbody > tr > td.sz.z { display: none; }
  table.stack > tbody > tr > td.sz input { width: 56px !important; max-width: 56px !important; min-width: 0; padding: 6px 4px; text-align: center; }
  table.stack > tbody > tr > td.empty { display: block; text-align: center; }
  table.stack > tbody > tr > td.empty::before { display: none; }
  table.stack > tbody > tr.total { background: var(--stone); font-weight: 700; }
  table.stack > tbody > tr.total > td.sz { background: var(--paper); }
  table.stack td input:not([type=checkbox]):not([type=radio]), table.stack td select, table.stack td textarea { display: inline-block; vertical-align: middle; width: 62%; max-width: 62%; min-width: 0; }
  table.stack td input[type=number] { width: 120px; text-align: right; }
  table.stack td.st-title input:not([type=checkbox]):not([type=radio]), table.stack td.st-title select, table.stack td[data-label=""] select, table.stack td[data-label=""] input:not([type=checkbox]):not([type=radio]) { max-width: 100%; width: 100%; }
  table.stack td .btn { white-space: nowrap; }
  table.stack td > form { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
  table.stack td > div, table.stack td > details { clear: none; }
  table.stack td details { text-align: left; }
  /* Day-by-day sheets stay a grid, with the name column held in place. */
  table.no-stack th:first-child, table.no-stack td:first-child { position: sticky; left: 0; background: var(--paper); z-index: 1; }
}
dd:empty::after { content: "–"; color: var(--muted); }
/* Size grid */
.size-grid .g-prod { min-width: 260px; }
.size-grid .g-prod select { width: 100%; }
.size-grid .g-extra { display: grid; grid-template-columns: 1fr 1.6fr; gap: 6px; margin-top: 6px; }
.size-grid .g-extra input { font-size: 13px; padding: 6px 8px; width: 100%; min-width: 0; }
.size-grid .g-q input { width: 64px; text-align: right; padding: 8px 6px; }
.size-grid .g-q input.g-na, .size-grid .g-q input:disabled { background: var(--stone); opacity: .45; }
.size-grid .g-q input.g-na:not(:disabled) { opacity: 1; outline: 2px solid var(--bad, #c0392b); }
.size-grid .g-rate input { width: 90px; text-align: right; }
.size-grid td { vertical-align: top; }
.size-grid .g-tot, .size-grid .g-amt { font-weight: 700; padding-top: 14px; }
table.size-grid:not(.lines) td, table.size-grid:not(.lines) th { white-space: nowrap; }
table.size-grid:not(.lines) td:first-child { white-space: normal; min-width: 200px; }

@media (min-width: 1000px) { .cols.cols-order { grid-template-columns: minmax(300px, 1fr) minmax(0, 1.7fr); } }
.fd-form [hidden] { display: none !important; }
/* Production sheet */
table.prodsheet { font-size: 13px; }
table.prodsheet th, table.prodsheet td { padding: 7px 8px; vertical-align: top; }
table.prodsheet thead th { position: sticky; top: 0; background: var(--paper); z-index: 1; }
table.prodsheet tr.ps-first > td { border-top: 2px solid var(--line); }
table.prodsheet .ps-status { min-width: 200px; max-width: 300px; }
table.prodsheet td.ps-problem { background: #fdf0ee; }
.ps-edit summary { color: var(--brand); cursor: pointer; margin-top: 4px; }
.ps-edit .note-form { margin-top: 8px; min-width: 260px; }
.note-form .check { display: flex; gap: 6px; align-items: center; font-weight: 500; }
.note-form .check input { width: auto; }
.ship-fields { margin-top: 6px; }
table.sheet-preview select { max-width: 340px; }
[hidden] { display: none !important; }
table.prodsheet td:nth-child(4) { min-width: 120px; } table.prodsheet .ps-q { min-width: 190px; }
.seg-ho input:checked + span { background: #e0a100; color: #fff; }

/* Tick boxes and the bar that changes many orders at once */
.bulk-bar { position: sticky; top: 68px; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.bulk-bar.on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.bulk-bar select, .bulk-bar input { width: auto; flex: 0 1 auto; }
.bulk-bar input[name=bulk_note] { flex: 1 1 200px; min-width: 160px; }
.bulk-count { font-size: 13px; white-space: nowrap; }
.bulk-col { width: 28px; text-align: center; vertical-align: middle; }
.bulk-col input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
tr.ticked td { background: var(--brand-soft); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.card[style*="padding:0"] > .table-wrap { margin: 0; }
@media (max-width: 700px) {
  /* Entry grids: the product box takes the full width, sizes sit below it. */
  table.stack > tbody > tr > td.st-title:has(select, input:not([type=checkbox])) { flex-basis: 100%; }
  table.prodsheet.stack td[data-label="Sl"] { display: none; }
  table.prodsheet.stack tr.ps-first { border-top: 6px solid var(--stone); }
  /* Order steps run down the screen instead of sideways. */
  .stages { flex-direction: column; overflow: visible; gap: 10px; }
  .stages li { min-width: 0 !important; display: grid; grid-template-columns: 28px 1fr; column-gap: 10px; align-items: start; padding: 0; }
  .stages li > :not(.dot) { grid-column: 2; }
  .stages li .dot { grid-row: 1 / span 3; }
  .stages li::before { top: 30px; bottom: -10px; left: 13px; right: auto; width: 2px; height: auto; }
  .pipe { flex-wrap: wrap; overflow: visible; }
  .pipe-step, .pipe.compact .pipe-step { flex: 1 1 calc(50% - 8px); min-width: 0; max-width: none; }
  .pipe-step + .pipe-step::before { display: none; }
  .page-head .actions { margin-left: 0; width: 100%; }
}
@media (max-width: 700px) {
  /* A box to type in sits on the right of its name. */
  table.stack > tbody > tr > td:not(.sz):not(.st-title):not([data-label=""]):has(> input:not([type=checkbox]):not([type=radio]):not([type=hidden]), > select, > textarea) { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: right; }
  table.stack > tbody > tr > td:not(.sz):not(.st-title):has(> input:not([type=checkbox]):not([type=radio]):not([type=hidden]), > select, > textarea)::before { float: none; margin: 0; }
  table.stack > tbody > tr > td:not(.sz):has(> input, > select)  > input:not([type=checkbox]):not([type=radio]), table.stack > tbody > tr > td:not(.sz):has(> select) > select { flex: 0 1 58%; width: auto; max-width: 58%; }
}
@media (max-width: 700px) {
  /* 16px text in boxes stops phones zooming in when you tap one. */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; }
  .seg { display: flex; flex-wrap: wrap; width: 100%; }
  .seg label { flex: 1 1 auto; text-align: center; }
  .seg span { padding: 10px 8px; border-bottom: 1px solid var(--line); }
  .btn { min-height: 40px; }
  .bulk-bar { top: 64px; padding: 8px 10px; }
  .bulk-bar select { flex: 1 1 140px; }
  .card { padding: 14px; } .card .table-wrap { margin: 0 -14px; }
  .card .table-wrap table.stack > tbody > tr { padding: 12px 14px; }
}

/* Installed app */
.app-back { display: none; background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: 26px; line-height: 1; width: 38px; height: 38px; cursor: pointer; padding: 0 0 3px; }
html.in-app .app-back { display: block; }
html.in-app .top { padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
html.in-app main.with-nav { padding-top: calc(76px + env(safe-area-inset-top)); padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
html.in-app .side { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
html.in-app body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
@media (max-width: 960px) { html.in-app .top .logo .logo-t { display: none; } }
.install-banner { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; box-shadow: var(--shadow); }
.install-banner img { border-radius: 10px; flex: 0 0 auto; }
.install-banner div { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.install-banner span { color: var(--muted); font-size: 12.5px; }
.install-x { background: none; border: 0; font-size: 22px; color: var(--muted); cursor: pointer; padding: 0 4px; }
.install-sheet { position: fixed; inset: 0; background: rgba(23,20,42,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.install-card { background: var(--paper); border-radius: 20px; padding: 22px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); margin-bottom: env(safe-area-inset-bottom); }
.install-card img { border-radius: 14px; }
.install-card h3 { margin: 10px 0; }
.install-card ol { text-align: left; padding-left: 22px; margin: 0 0 10px; line-height: 1.7; }
.install-card .btn { width: 100%; }
.ios-share { display: inline-block; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 4px; font-size: 12px; }
@media (min-width: 701px) { .install-sheet { align-items: center; } }

/* Product photos */
.pimg { display: inline-block; flex: 0 0 auto; border-radius: 8px; object-fit: cover; background: var(--stone); border: 1px solid var(--line); vertical-align: middle; cursor: zoom-in; }
.pimg-none { cursor: default; background: var(--stone) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9b4cf' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M8 3l-5 3 2 4 2-1v12h10V9l2 1 2-4-5-3c-.5 1.5-2 2.5-4 2.5S8.5 4.5 8 3z'/%3E%3C/svg%3E") center / 62% no-repeat; }
.pchip { display: inline-flex; align-items: center; gap: 10px; min-width: 0; text-align: left; vertical-align: middle; }
.pchip > span { min-width: 0; }
.pimg-view { position: fixed; inset: 0; z-index: 70; background: rgba(23,20,42,.82); display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.pimg-view img { max-width: 100%; max-height: 90vh; border-radius: 14px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
@media (max-width: 700px) { table.stack td.st-title .pchip { display: flex; } }
.sel-pimg { display: flex; align-items: center; gap: 8px; width: 100%; }
.sel-pimg > select { flex: 1 1 auto; min-width: 0; }
.sel-pimg > .pimg { width: 38px; height: 38px; }
.ps-q { display: flex; gap: 10px; align-items: flex-start; }
select.mat-colour { min-width: 150px; }

/* Search box in the top bar */
.top .top-search { margin-left: auto; position: relative; display: flex; align-items: center; }
.top .top-search + .bell { margin-left: 8px; }
.top .top-search .ic { position: absolute; left: 11px; width: 17px; height: 17px; color: var(--muted, #888); pointer-events: none; }
.top .top-search input { width: 230px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0 12px 0 34px; font: inherit; font-size: 14px; transition: width .2s; }
.top .top-search input:focus { width: 320px; outline: 2px solid var(--gold, #c9a227); outline-offset: -1px; }
@media (max-width: 700px) {
  .top .top-search input { width: 38px; padding: 0 0 0 34px; font-size: 16px; color: transparent; cursor: pointer; }
  .top .top-search input::placeholder { color: transparent; }
  .top .top-search input:focus { width: calc(100vw - 32px); position: fixed; left: 16px; top: 10px; z-index: 60; color: inherit; padding-left: 12px; }
  .top .top-search input:focus::placeholder { color: #999; }
  .top .top-search:focus-within .ic { display: none; }
}
.search-big input[name=q] { flex: 1 1 260px; font-size: 16px; }
.search-list { list-style: none; margin: 0; padding: 0; }
.search-list li { padding: 9px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-list li:first-child { border-top: 0; }
.search-list a { text-decoration: none; color: inherit; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-list a b { color: var(--ink); }
.top .bell, .top .who, .top .top-search { flex-shrink: 0; }
@media (max-width: 700px) { .top .due-chip .due-w { display: none; } .top .due-chip { padding-left: 10px; padding-right: 10px; } }
@media (max-width: 360px) { .top .logo-t { display: none; } }
@media (max-width: 700px) { .top { gap: 8px; } .top .top-search + .bell { margin-left: 0; } }
@media (max-width: 700px) { html.in-app .top .logo-t { display: none; } }

/* Searchable drop-downs */
select.ss-hidden { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; min-width: 0 !important; padding: 0 !important; border: 0 !important; margin: 0 !important; }
.ss-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border: 1px solid #dcd8ea; border-radius: 10px; background: #fff; font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-height: 42px; }
.ss-btn span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-btn i { flex: 0 0 auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-3px); }
.ss-btn:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(108,76,245,.18); }
.ss-btn.ss-empty span { color: var(--muted); }
.ss-btn.ss-invalid { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(230,70,110,.18); }
.ss-btn:disabled { opacity: .55; cursor: default; }
.form label > .ss-btn { margin-top: 4px; }
table .ss-btn { padding: 6px 8px; min-height: 36px; min-width: 70px; }
.sel-pimg > .ss-btn { flex: 1 1 auto; min-width: 0; }
.ss-panel { position: fixed; z-index: 80; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(30,20,70,.22); display: flex; flex-direction: column; overflow: hidden; }
.ss-panel[hidden] { display: none; }
.ss-head { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.ss-box { flex: 1; }
.ss-x { border: 0; background: #f1effa; border-radius: 10px; width: 40px; font-size: 15px; cursor: pointer; display: none; }
.ss-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; flex: 1 1 auto; overscroll-behavior: contain; }
.ss-list li { padding: 9px 14px; cursor: pointer; line-height: 1.3; }
.ss-list li.hi { background: #f1effa; }
.ss-list li.on { font-weight: 700; }
.ss-list li.ss-group { cursor: default; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px 4px; font-weight: 700; }
.ss-list li.ss-new { color: var(--brand); font-weight: 600; border-top: 1px solid var(--line); }
.ss-list li.ss-blank { color: var(--muted); }
.ss-list li.ss-none { color: var(--muted); cursor: default; }
.ss-panel.ss-sheet { inset: 0; border-radius: 0; border: 0; max-height: none; width: auto; padding-top: env(safe-area-inset-top); }
.ss-panel.ss-sheet .ss-x { display: block; }
.ss-panel.ss-sheet .ss-head { padding: 10px; }
.ss-panel.ss-sheet .ss-list li { padding: 13px 16px; border-bottom: 1px solid #f3f1f9; }
html.ss-lock, html.ss-lock body { overflow: hidden; }
@media (max-width: 700px) {
  table.stack td .ss-btn { display: inline-flex; vertical-align: middle; width: 62%; max-width: 62%; min-width: 0; }
  table.stack td.st-title .ss-btn, table.stack td[data-label=""] .ss-btn { max-width: 100%; width: 100%; }
}
.xl-btn { display: block; margin: 0 0 6px auto; border: 1px solid var(--line); background: #fff; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 8px; cursor: pointer; }
.xl-btn:hover { color: var(--brand); border-color: var(--brand); }
.card[style*="padding:0"] > .xl-btn { margin: 10px 12px 6px auto; }
@media print { .xl-btn { display: none; } }
.day-sum > summary { cursor: pointer; list-style: none; }
.day-sum > summary::-webkit-details-marker { display: none; }
.day-sum-text { white-space: pre-wrap; background: var(--stone); padding: 12px; border-radius: 10px; font: inherit; font-size: 14px; margin: 12px 0; }

/* QR labels */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.label { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px dashed #c9c4dd; border-radius: 10px; padding: 10px; break-inside: avoid; }
.label-qr { flex: 0 0 112px; height: 112px; }
.label-qr svg { display: block; }
.label-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; line-height: 1.3; }
.label-t b { font-size: 15px; }
.label-t small { color: var(--muted); margin-top: 2px; }
@media print {
  .side, .top, .page-head .actions, .no-print, .nav-scrim, .install-banner { display: none !important; }
  .main, main { margin: 0 !important; padding: 0 !important; }
  .labels { grid-template-columns: 1fr 1fr; gap: 4mm; }
  .label { border: 1px solid #000; border-radius: 0; height: 48mm; padding: 3mm; }
}
#scan-video { width: 100%; max-width: 480px; border-radius: 14px; background: #000; display: block; margin: 10px 0; }
#scan-video[hidden] { display: none; }
@media print { body, html { background: #fff !important; } .page-head h1 { font-size: 14px; } }
.xl-btn.xl-in-h2 { display: inline-block; float: right; margin: 0 0 0 8px; }

/* Automation */
.due-pop.late-pop { inset: 76px 20px auto auto; border-color: #f2d49b; }
.due-pop.late-pop h2 { color: #8a5a00; }
ul.plain { list-style: none; margin: 0; padding: 0; } ul.plain li { padding: 5px 0; border-top: 1px solid var(--line); } ul.plain li:first-child { border-top: 0; }
.muted-card { opacity: .6; }
.lot-card h2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lot-grid td:first-child { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.chase-text { max-width: 420px; color: var(--muted); }
.big-btn { font-size: 20px; padding: 16px 28px; width: 100%; }
.gate-confirm h2 { font-size: 22px; }
.gate-scan video { width: 100%; max-height: 52vh; border-radius: 12px; background: #000; object-fit: cover; }
.gate-result { margin: 12px 0; padding: 18px; border-radius: 12px; text-align: center; color: #fff; background: #2e7d4f; }
.gate-result b { display: block; font-size: 26px; } .gate-result span { font-size: 18px; }
.gate-result.out { background: #3557a8; } .gate-result.late { background: #b26a00; } .gate-result.bad { background: #b02a2a; }
@media (max-width: 720px) { .due-pop.late-pop { inset: auto 16px 16px 16px; } }

/* What an order is, written after its number everywhere */
.o-what { color: var(--muted, #6b6b6b); font-weight: 400; font-size: .86em; }
h1 .o-what { font-size: .55em; display: block; margin-top: 2px; }

a .o-what { display: inline-block; text-decoration: none; }
