/* Store Inventory 3D · same look as JUNG Project Control (Apple HIG theme, accent #396992).
   Light / Dark follow the device unless the switch in the top bar forces one (html[data-theme]). */
:root {
  --hig-blue: #396992; --hig-blue-hover: #30597d; --hig-blue-pressed: #284b69; --hig-blue-tint: rgba(57, 105, 146, .10);
  --hig-accent-text: #396992;
  --hig-green: #007a2d; --hig-green-tint: rgba(52, 199, 89, .12);
  --hig-orange: #a84600; --hig-orange-tint: rgba(255, 141, 40, .14);
  --hig-red: #c8102a; --hig-red-tint: rgba(255, 56, 60, .10);
  --hig-purple: #6e3fb0; --hig-purple-tint: rgba(175, 82, 222, .12);
  --hig-label: #1d1d1f; --hig-secondary: #6e6e73; --hig-tertiary: #aeaeb2; --hig-placeholder: #8e8e93;
  --hig-separator: #e5e5ea; --hig-hairline: rgba(0, 0, 0, .08);
  --hig-fill: rgba(120, 120, 128, .12); --hig-fill-strong: rgba(120, 120, 128, .2);
  --hig-bg: #f5f5f7; --hig-surface: #fff; --hig-surface-2: #fafafc;
  --hig-material: rgba(255, 255, 255, .78);
  --hig-field-border: rgba(0, 0, 0, .18);
  --hig-card-radius: 14px;
  --hig-card-shadow: 0 0 0 .5px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .05);
  --hig-pop-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 10px 30px rgba(0, 0, 0, .14);
  --hig-sheet-shadow: 0 0 0 .5px rgba(0, 0, 0, .1), 0 22px 70px rgba(0, 0, 0, .25);
  --viewport-bg: #e5e5ea;
  --hig-sidebar: rgba(250, 250, 252, .86);
  --topbar-h: 64px;
  --sidebar-w: 236px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hig-blue: #3f73a0; --hig-blue-hover: #4a7fae; --hig-blue-pressed: #356289; --hig-blue-tint: rgba(110, 160, 210, .18);
    --hig-accent-text: #8fb4d8;
    --hig-green: #30d158; --hig-green-tint: rgba(48, 209, 88, .18);
    --hig-orange: #ff9230; --hig-orange-tint: rgba(255, 146, 48, .18);
    --hig-red: #ff6165; --hig-red-tint: rgba(255, 66, 69, .18);
    --hig-purple: #c48cf0; --hig-purple-tint: rgba(191, 90, 242, .2);
    --hig-label: #f5f5f7; --hig-secondary: rgba(235, 235, 245, .62); --hig-tertiary: rgba(235, 235, 245, .32); --hig-placeholder: rgba(235, 235, 245, .38);
    --hig-separator: #38383a; --hig-hairline: rgba(255, 255, 255, .1);
    --hig-fill: rgba(120, 120, 128, .32); --hig-fill-strong: rgba(120, 120, 128, .4);
    --hig-bg: #000; --hig-surface: #1c1c1e; --hig-surface-2: #232325;
    --hig-material: rgba(28, 28, 30, .78);
    --hig-field-border: rgba(255, 255, 255, .16);
    --hig-card-shadow: 0 0 0 .5px rgba(255, 255, 255, .08);
    --hig-pop-shadow: 0 0 0 .5px rgba(255, 255, 255, .12), 0 10px 30px rgba(0, 0, 0, .5);
    --hig-sheet-shadow: 0 0 0 .5px rgba(255, 255, 255, .12), 0 22px 70px rgba(0, 0, 0, .6);
    --viewport-bg: #2c2c2e; --hig-sidebar: rgba(28, 28, 30, .9);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --hig-blue: #3f73a0; --hig-blue-hover: #4a7fae; --hig-blue-pressed: #356289; --hig-blue-tint: rgba(110, 160, 210, .18);
  --hig-accent-text: #8fb4d8;
  --hig-green: #30d158; --hig-green-tint: rgba(48, 209, 88, .18);
  --hig-orange: #ff9230; --hig-orange-tint: rgba(255, 146, 48, .18);
  --hig-red: #ff6165; --hig-red-tint: rgba(255, 66, 69, .18);
  --hig-purple: #c48cf0; --hig-purple-tint: rgba(191, 90, 242, .2);
  --hig-label: #f5f5f7; --hig-secondary: rgba(235, 235, 245, .62); --hig-tertiary: rgba(235, 235, 245, .32); --hig-placeholder: rgba(235, 235, 245, .38);
  --hig-separator: #38383a; --hig-hairline: rgba(255, 255, 255, .1);
  --hig-fill: rgba(120, 120, 128, .32); --hig-fill-strong: rgba(120, 120, 128, .4);
  --hig-bg: #000; --hig-surface: #1c1c1e; --hig-surface-2: #232325;
  --hig-material: rgba(28, 28, 30, .78);
  --hig-field-border: rgba(255, 255, 255, .16);
  --hig-card-shadow: 0 0 0 .5px rgba(255, 255, 255, .08);
  --hig-pop-shadow: 0 0 0 .5px rgba(255, 255, 255, .12), 0 10px 30px rgba(0, 0, 0, .5);
  --hig-sheet-shadow: 0 0 0 .5px rgba(255, 255, 255, .12), 0 22px 70px rgba(0, 0, 0, .6);
  --viewport-bg: #2c2c2e; --hig-sidebar: rgba(28, 28, 30, .9);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--hig-bg); color: var(--hig-label); font-size: 14px; letter-spacing: -.01em; }
button, input, select { font: inherit; color: inherit; letter-spacing: inherit; }
code { font-size: .92em; }
h3 { margin: 20px 0 8px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
h2 { margin: 0 0 14px; font-size: 20px; font-weight: 600; letter-spacing: -.015em; }
.small { font-size: 12px; }
.muted { color: var(--hig-secondary); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.num, .tbl td.num { font-variant-numeric: tabular-nums; }
::placeholder { color: var(--hig-placeholder); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--hig-blue); }

/* ---------- app shell: sidebar (logo + menu) | workspace (same as JUNG Project Control) ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0; padding: 18px 12px 14px;
  background: var(--hig-sidebar); border-right: .5px solid var(--hig-hairline);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: flex; align-items: center; gap: 11px; white-space: nowrap; min-width: 0; padding: 4px 7px 18px; border-bottom: .5px solid var(--hig-separator); }
.brand img { width: 52px; height: 20px; object-fit: contain; flex: none; }
.brand > div { display: flex; flex-direction: column; min-width: 0; }
.brand strong { font-size: 15px; font-weight: 600; color: var(--hig-label); }
.brand small { font-size: 11px; color: var(--hig-secondary); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.mainnav { display: grid; gap: 3px; margin-top: 14px; }
.mainnav button {
  height: 36px; width: 100%; display: flex; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 8px;
  background: none; color: var(--hig-label); font-size: 14px; text-align: left; cursor: pointer; transition: background-color .12s ease;
}
.mainnav button svg { width: 18px; height: 18px; flex: none; color: var(--hig-accent-text); }
.mainnav button > span { white-space: nowrap; }
.mainnav .lbl-short { display: none; }
.mainnav button:hover { background: rgba(0, 0, 0, .05); }
.mainnav button.active { background: var(--hig-blue); color: #fff; font-weight: 500; }
.mainnav button.active svg { color: #fff; }
.mainnav button:focus { outline: none; }
.mainnav button:focus-visible { outline: 3px solid rgba(57, 105, 146, .35); outline-offset: 1px; }
.nav-count { margin-left: auto; min-width: 22px; padding: 2px 7px; border-radius: 999px; background: var(--hig-fill); color: var(--hig-secondary); font-size: 12px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.mainnav button.active .nav-count { background: rgba(255, 255, 255, .25); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 14px 7px 0; border-top: .5px solid var(--hig-separator); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mainnav button:not(.active):hover { background: rgba(255, 255, 255, .07); } }
:root[data-theme="dark"] .mainnav button:not(.active):hover { background: rgba(255, 255, 255, .07); }

.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--hig-bg); }
.page { flex: 1; min-height: 0; }

/* ---------- top bar (toolbar material) ---------- */
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: var(--hig-material); border-bottom: .5px solid var(--hig-hairline);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: relative; z-index: 20;
}
.page-title { min-width: 0; }
.page-title h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.015em; white-space: nowrap; }
.page-title p { margin: 2px 0 0; font-size: 13px; color: var(--hig-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand img { filter: invert(1) hue-rotate(180deg); mix-blend-mode: lighten; } }
:root[data-theme="dark"] .brand img { filter: invert(1) hue-rotate(180deg); mix-blend-mode: lighten; }

.gsearch { position: relative; flex: 1; max-width: 560px; margin-left: auto; }
.gsearch input { width: 100%; background: var(--hig-fill); border: 0; border-radius: 9px; box-shadow: none; padding-left: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center; background-size: 15px; }
.gsearch input:focus { box-shadow: 0 0 0 3px rgba(57, 105, 146, .25); }
.dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--hig-surface); border-radius: 10px;
  box-shadow: var(--hig-pop-shadow); max-height: 60vh; overflow: auto; z-index: 50; padding: 4px;
}
.dropdown button {
  display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; cursor: pointer;
  border-radius: 7px;
}
.dropdown button:hover, .dropdown button:focus-visible { background: var(--hig-blue); color: #fff; outline: 0; }
.dropdown button:hover span, .dropdown button:hover em, .dropdown button:focus-visible span, .dropdown button:focus-visible em { color: rgba(255, 255, 255, .85); }
.dropdown b { font-weight: 600; }
.dropdown span { flex: 1; color: var(--hig-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown em { font-style: normal; color: var(--hig-secondary); font-size: 12px; white-space: nowrap; }
.dropdown .empty { padding: 10px 12px; color: var(--hig-secondary); }

.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--hig-fill); color: var(--hig-secondary); white-space: nowrap; }
.pill.ok { color: var(--hig-green); background: var(--hig-green-tint); }
.pill.err { color: var(--hig-red); background: var(--hig-red-tint); }

/* System / Light / Dark switch (same as Project Control) */
.theme-switch { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 9px; background: rgba(127, 127, 135, .16); flex: none; }
.theme-switch button { display: inline-flex; align-items: center; justify-content: center; height: 28px; min-width: 30px; padding: 0 8px; border: 0;
  border-radius: 7px; background: none; color: var(--hig-secondary); cursor: pointer; }
.theme-switch button:hover { color: var(--hig-label); }
.theme-switch button[aria-pressed="true"] { background: var(--hig-surface); color: var(--hig-label); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.theme-switch button:focus-visible { outline: 2px solid var(--hig-blue); outline-offset: 1px; }
.theme-switch svg { width: 14px; height: 14px; }

.banner { padding: 10px 24px; background: var(--hig-orange-tint); color: var(--hig-label); border-bottom: .5px solid var(--hig-hairline); }
.banner .btn { margin-left: 8px; }

/* ---------- controls ---------- */
input, select {
  background: var(--hig-surface); border: .5px solid var(--hig-field-border); border-radius: 8px; padding: 8px 10px; min-width: 0; min-height: 38px;
  box-shadow: 0 .5px 1px rgba(0, 0, 0, .05) inset; color: var(--hig-label);
}
input:focus, select:focus { outline: none; border-color: var(--hig-blue); box-shadow: 0 0 0 3px rgba(57, 105, 146, .25); }
input[readonly] { background: var(--hig-surface-2); }
input[type="checkbox"], input[type="radio"] { min-height: 0; box-shadow: none; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--hig-label); margin: 10px 0; }
label > input, label > select { font-size: 15px; font-weight: 400; }
label.inline { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
label.check { flex-direction: row; align-items: center; gap: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px;
  border-radius: 8px; border: .5px solid rgba(0, 0, 0, .16); background: var(--hig-surface); color: var(--hig-label); cursor: pointer;
  white-space: nowrap; font-weight: 500; letter-spacing: -.005em; box-shadow: 0 .5px 1px rgba(0, 0, 0, .1);
  transition: background-color .12s ease, box-shadow .12s ease;
}
.btn:hover { background: var(--hig-surface-2); border-color: rgba(0, 0, 0, .2); }
.btn:active { background: var(--hig-fill); }
.btn:focus { outline: none; }
.btn:focus-visible { outline: 3px solid rgba(57, 105, 146, .35); outline-offset: 1px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { min-height: 30px; padding: 4px 11px; font-size: 13px; }
.btn.primary { background: var(--hig-blue); color: #fff; border: 0; box-shadow: none; }
.btn.primary:hover { background: var(--hig-blue-hover); }
.btn.primary:active { background: var(--hig-blue-pressed); }
.btn.danger { color: var(--hig-red); }
.btn.danger:hover { background: var(--hig-red-tint); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--hig-accent-text); }
.btn.ghost:hover { background: var(--hig-fill); }
.btn.wide { width: 100%; margin-top: 12px; min-height: 40px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.primary) { border-color: rgba(255, 255, 255, .14); box-shadow: none; } }
:root[data-theme="dark"] .btn:not(.primary) { border-color: rgba(255, 255, 255, .14); box-shadow: none; }

.chip {
  border: 0; background: var(--hig-fill); color: var(--hig-label); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13px; text-align: left;
}
.chip:hover { background: var(--hig-blue-tint); color: var(--hig-accent-text); }
.chips, .presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.toolbar { display: flex; gap: 8px; margin: 10px 0; align-items: center; }
.toolbar input { flex: 1; }
.toolbar.wrap { flex-wrap: wrap; }
.row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.grid2, .grid3, .grid4 { display: grid; gap: 0 10px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.grid4 { grid-template-columns: repeat(4, 1fr); }
.sub { font-size: 13px; font-weight: 600; color: var(--hig-secondary); margin: 14px 0 6px; }
.card { border: 0; border-radius: var(--hig-card-radius); padding: 14px 16px; background: var(--hig-surface); box-shadow: var(--hig-card-shadow); margin: 12px 0; }
details.card summary { cursor: pointer; font-weight: 600; color: var(--hig-accent-text); }
.badge { font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 999px; vertical-align: middle; margin-left: 4px; }
.badge.sample { background: var(--hig-purple-tint); color: var(--hig-purple); }
.note { background: var(--hig-blue-tint); padding: 10px 12px; border-radius: 12px; font-size: 13px; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 440px; }
.layout[hidden], .page[hidden] { display: none !important; }

/* ---------- Projects page (grouped cards, large numbers, plain table) ---------- */
.projects-page { overflow: auto; }
.projects-page .content { padding: 24px 30px 48px; max-width: 1400px; }
.project-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.project-pick { flex: 1 1 380px; margin: 0; max-width: 620px; }
.project-pick > span { font-size: 13px; font-weight: 600; color: var(--hig-secondary); }
.project-pick select { min-height: 40px; font-size: 15px; font-weight: 600; }
.project-bar .check { margin: 0 0 10px; font-size: 13px; font-weight: 400; color: var(--hig-secondary); }
.project-bar .btn { min-height: 40px; }
.project-context {
  display: flex; align-items: center; gap: 34px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 14px;
  background: var(--hig-surface); border-radius: var(--hig-card-radius); box-shadow: var(--hig-card-shadow);
}
.project-context > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.project-context span { font-size: 12px; font-weight: 500; color: var(--hig-secondary); }
.project-context strong { font-size: 14px; font-weight: 600; }
.project-context .st { align-self: flex-start; margin-top: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 16px 18px; border: 0; cursor: pointer; color: var(--hig-label);
  background: var(--hig-surface); border-radius: var(--hig-card-radius); box-shadow: var(--hig-card-shadow); transition: background-color .15s ease;
}
.kpi:hover { background: var(--hig-surface-2); }
.kpi:focus { outline: none; }
.kpi:focus-visible { outline: 3px solid rgba(57, 105, 146, .35); outline-offset: 1px; }
.kpi > span { font-size: 13px; font-weight: 500; color: var(--hig-secondary); display: flex; align-items: center; gap: 7px; }
.kpi > span i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.kpi strong { font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 12px; color: var(--hig-secondary); margin-top: 2px; }
.kpi.ok > span i { color: var(--hig-green); } .kpi.warn > span i { color: var(--hig-orange); }
.kpi.err > span i { color: var(--hig-red); } .kpi.muted > span i { color: var(--hig-tertiary); }
.kpi.selected { box-shadow: 0 0 0 2px var(--hig-blue); }
.table-card { background: var(--hig-surface); border-radius: var(--hig-card-radius); box-shadow: var(--hig-card-shadow); overflow: hidden; }
.table-toolbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: .5px solid var(--hig-separator); flex-wrap: wrap; }
.search-field { flex: 0 1 340px; margin: 0; flex-direction: row; align-items: center; gap: 7px; background: var(--hig-fill); border-radius: 9px; padding: 0 10px; color: var(--hig-secondary); }
.search-field svg { width: 15px; height: 15px; flex: none; }
.search-field input { flex: 1; border: 0; background: transparent; box-shadow: none; padding-left: 0; font-size: 14px; }
.search-field input:focus { box-shadow: none; }
.search-field:focus-within { box-shadow: 0 0 0 3px rgba(57, 105, 146, .25); }
.tablewrap.flat { border-radius: 0; box-shadow: none; max-height: none; }
#projTable td { vertical-align: middle; }
#projTable td.num b { font-size: 15px; }
#projTable .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.foot-note { margin-top: 14px; max-width: 80ch; line-height: 1.5; }

/* ---------- Delivery requests page ---------- */
.requests-page { overflow: auto; }
.requests-page .content { padding: 24px 30px 48px; max-width: 1500px; }
.requests-page .project-bar { align-items: center; }
.requests-page .search-field { min-height: 36px; }
.seg-control { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: rgba(127, 127, 135, .16); }
.seg-control button { border: 0; background: none; border-radius: 7px; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--hig-label); cursor: pointer; }
.seg-control button[aria-pressed="true"] { background: var(--hig-surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-control button[aria-pressed="true"] { background: #636366; color: #fff; } }
:root[data-theme="dark"] .seg-control button[aria-pressed="true"] { background: #636366; color: #fff; }
.kpi.info > span i { color: var(--hig-accent-text); }
.st.info { color: var(--hig-accent-text); background: var(--hig-blue-tint); }
.nav-count.alert { background: var(--hig-red); color: #fff; }
.mainnav button.active .nav-count.alert { background: #fff; color: var(--hig-red); }
.overdue { color: var(--hig-red) !important; font-weight: 600; }
.req-layout { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 14px; align-items: start; }
.req-list { display: flex; flex-direction: column; max-height: calc(100vh - 330px); min-height: 200px; overflow: auto; }
.req-item { display: flex; flex-direction: column; gap: 3px; text-align: left; border: 0; border-bottom: .5px solid var(--hig-separator); background: none; padding: 12px 14px; cursor: pointer; color: var(--hig-label); }
.req-item:hover { background: var(--hig-surface-2); }
.req-item.active { background: var(--hig-blue-tint); box-shadow: inset 3px 0 0 var(--hig-blue); }
.req-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.req-top .st { margin-top: 0; }
.req-proj { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { padding: 28px 18px; text-align: center; }
.req-detail { padding: 18px 18px 14px; min-height: 200px; }
.req-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.req-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.req-head .st { margin-top: 4px; font-size: 13px; }
.project-context.flat { box-shadow: none; background: var(--hig-surface-2); border: .5px solid var(--hig-separator); gap: 14px 30px; }
.req-detail .note { margin: 0 0 12px; }
.req-detail .tablewrap.flat { border: .5px solid var(--hig-separator); border-radius: 12px; }
.req-items select { min-height: 32px; padding: 4px 8px; font-size: 13px; max-width: 220px; }
.req-items input { min-height: 32px; width: 76px; padding: 4px 8px; text-align: right; }
.req-items td { vertical-align: middle; }
.req-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.req-actions label.inline { font-size: 13px; color: var(--hig-secondary); }
.req-actions select { min-height: 36px; }
.req-actions #reqDO { min-height: 36px; width: 180px; }
#rItems input.rq { width: 80px; min-height: 32px; padding: 4px 8px; text-align: right; }
#reqDlg .tablewrap { max-height: 46vh; }
@media (max-width: 1100px) {
  .req-layout { grid-template-columns: 1fr; }
  .req-list { max-height: 320px; min-height: 0; }
  .req-detail { min-height: 0; }
  .requests-page .content { padding: 20px 20px 40px; }
}
@media (max-width: 600px) {
  .requests-page .content { padding: 16px 12px 32px; }
  .requests-page .project-bar > * { flex: 1 1 100%; }
  .seg-control { display: flex; } .seg-control button { flex: 1; padding: 6px 4px; }
  .req-items th:nth-child(3), .req-items td:nth-child(3) { display: none; }
  #rItems th:nth-child(2), #rItems td:nth-child(2), #rItems th:nth-child(4), #rItems td:nth-child(4) { display: none; }
}
#viewport { position: relative; overflow: hidden; min-height: 0; background: var(--viewport-bg); }
#viewport canvas { display: block; }
.panel { background: var(--hig-bg); border-left: .5px solid var(--hig-hairline); display: flex; flex-direction: column; min-height: 0; }

/* Tabs = segmented control */
.tabs { display: flex; gap: 2px; margin: 14px 16px 4px; padding: 2px; border-radius: 9px; background: rgba(127, 127, 135, .16); }
.tab { flex: 1; padding: 6px 6px; border: 0; border-radius: 7px; background: none; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--hig-label); }
.tab:hover:not(.active) { background: rgba(127, 127, 135, .12); }
.tab.active { background: var(--hig-surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.tab:focus { outline: none; }
.tab:focus-visible { outline: 2px solid var(--hig-blue); outline-offset: 1px; }
.panes { flex: 1; overflow: auto; padding: 4px 16px 24px; }

/* ---------- viewport overlays (floating material) ---------- */
.viewbtns { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 5; }
.viewbtns .btn { background: var(--hig-material); color: var(--hig-label); border: .5px solid var(--hig-hairline);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.viewbtns .btn:hover { background: var(--hig-surface); }
.viewbtns label.btn { margin: 0; flex-direction: row; font-size: 13px; font-weight: 500; }
.viewbtns #streetBtn.active { background: var(--hig-blue); color: #fff; border-color: transparent; }
.hint { position: absolute; bottom: 10px; left: 12px; font-size: 11px; color: var(--hig-secondary); background: var(--hig-material);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding: 4px 10px; border-radius: 999px; z-index: 4; pointer-events: none; }
.placebanner {
  position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; gap: 10px; align-items: center;
  background: var(--hig-blue); color: #fff; padding: 6px 6px 6px 16px; border-radius: 999px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: calc(100% - 24px);
}
.placebanner .btn { background: #fff; color: #396992; border: 0; border-radius: 999px; box-shadow: none; }
.tip {
  position: absolute; z-index: 8; max-width: 360px; background: var(--hig-surface); color: var(--hig-label); border-radius: 12px;
  box-shadow: var(--hig-pop-shadow); padding: 10px 12px; font-size: 13px; pointer-events: none;
}
.tip table { border-collapse: collapse; margin: 6px 0; width: 100%; }
.tip td { padding: 3px 6px 3px 0; vertical-align: top; border-top: .5px solid var(--hig-separator); }
.tip-h { font-size: 14px; font-weight: 600; }
.loc { color: var(--hig-accent-text); font-weight: 600; font-size: 12px; margin-top: 2px; }
.st { display: inline-block; font-size: 12px; font-weight: 600; margin-top: 4px; padding: 1px 8px; border-radius: 999px; }
.st.ok { color: var(--hig-green); background: var(--hig-green-tint); }
.st.err { color: var(--hig-red); background: var(--hig-red-tint); }
.st.warn { color: var(--hig-orange); background: var(--hig-orange-tint); }
.st.muted { color: var(--hig-secondary); background: var(--hig-fill); }
.tbl .st { margin-top: 0; white-space: nowrap; }
.demand { margin: 8px 0 4px; padding: 8px 10px; border-radius: 10px; background: var(--hig-blue-tint); display: flex; flex-direction: column; gap: 2px; }
.selcard {
  position: absolute; right: 12px; bottom: 38px; width: min(380px, calc(100% - 24px)); max-height: 60%; overflow: auto; z-index: 7;
  background: var(--hig-surface); border-radius: var(--hig-card-radius); box-shadow: var(--hig-pop-shadow); padding: 14px 16px;
}
.selcard .x { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: var(--hig-fill);
  cursor: pointer; font-size: 13px; color: var(--hig-secondary); padding: 0; display: grid; place-items: center; }
.selcard .x:hover { background: var(--hig-fill-strong); color: var(--hig-label); }
.sel-h { font-size: 17px; font-weight: 600; margin-bottom: 4px; padding-right: 30px; letter-spacing: -.01em; }
.locs { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.loc-btn { text-align: left; border: 0; background: var(--hig-fill); border-radius: 10px; padding: 8px 10px; cursor: pointer; color: var(--hig-label); }
.loc-btn:hover { background: var(--hig-blue-tint); }
.loc-btn.active { background: var(--hig-blue); color: #fff; }
.loc-btn.active .loc, .loc-btn.active .muted, .loc-btn.active .small { color: rgba(255, 255, 255, .85); }
.rack-lv { margin-top: 10px; padding-top: 8px; border-top: .5px solid var(--hig-separator); }
.rack-lv .locs { margin: 4px 0 0; }
table.mini { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
table.mini td { border-top: .5px solid var(--hig-separator); padding: 5px 6px 5px 0; }

/* ---------- tables & lists ---------- */
.tablewrap { overflow: auto; border: 0; border-radius: var(--hig-card-radius); background: var(--hig-surface); box-shadow: var(--hig-card-shadow); max-height: 52vh; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { position: sticky; top: 0; background: var(--hig-surface-2); text-align: left; padding: 9px 10px; font-size: 12px; font-weight: 600;
  color: var(--hig-secondary); border-bottom: .5px solid var(--hig-separator); z-index: 1; }
.tbl td { padding: 8px 10px; border-bottom: .5px solid var(--hig-separator); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--hig-blue-tint); }
.num { text-align: right; white-space: nowrap; }
.type { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.t-IN { background: var(--hig-green-tint); color: var(--hig-green); }
.t-OUT { background: var(--hig-red-tint); color: var(--hig-red); }
.t-RETURN { background: var(--hig-blue-tint); color: var(--hig-accent-text); }
.t-ADJUST { background: var(--hig-orange-tint); color: var(--hig-orange); }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.list-item { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; background: var(--hig-surface); box-shadow: var(--hig-card-shadow);
  border-radius: 12px; padding: 10px 12px; cursor: pointer; color: var(--hig-label); }
.list-item:hover { background: var(--hig-surface-2); }
.out-card { margin: 0; }
.out-row { display: flex; gap: 8px; justify-content: space-between; align-items: center; border-top: .5px solid var(--hig-separator); padding: 8px 0; }
a { color: var(--hig-accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- items editor ---------- */
.items { display: flex; flex-direction: column; gap: 8px; }
.itemrow { display: grid; grid-template-columns: 1fr 90px 36px; gap: 6px; align-items: start; }
.itemrow .idesc, .itemrow .ihint { grid-column: 1 / -1; }
.itemrow .idesc[hidden] { display: none; }

/* ---------- voice ---------- */
.voicebox { display: flex; align-items: center; gap: 16px; margin: 14px 0; padding: 16px; background: var(--hig-surface); border-radius: var(--hig-card-radius); box-shadow: var(--hig-card-shadow); }
.mic {
  width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--hig-blue); color: #fff; cursor: pointer; flex: none;
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(57, 105, 146, .35);
}
.mic:hover { background: var(--hig-blue-hover); }
.mic.on { background: var(--hig-red); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, .45); } 100% { box-shadow: 0 0 0 18px rgba(255, 59, 48, 0); } }
.transcript { min-height: 46px; background: var(--hig-fill); border: 0; border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-style: italic; }

/* ---------- dialogs (sheets) ---------- */
.dlg {
  border: 0; border-radius: 14px; padding: 20px 22px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
  background: var(--hig-surface); color: var(--hig-label); box-shadow: var(--hig-sheet-shadow);
}
.dlg h2 { font-size: 17px; }
.dlg.wide { width: min(720px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(0, 0, 0, .28); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; margin-bottom: 8px; padding: 2px; border-radius: 9px; background: rgba(127, 127, 135, .16); }
.seg label { flex-direction: row; justify-content: center; align-items: center; gap: 6px; margin: 0; border: 0; border-radius: 7px; padding: 7px 4px;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--hig-label); }
.seg label:has(input:checked) { background: var(--hig-surface); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--hig-blue); outline-offset: 1px; }
/* dark: the selected segment is a lighter grey, as in macOS / iOS */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg label:has(input:checked), :root:not([data-theme="light"]) .tab.active, :root:not([data-theme="light"]) .theme-switch button[aria-pressed="true"] { background: #636366; color: #fff; }
}
:root[data-theme="dark"] .seg label:has(input:checked), :root[data-theme="dark"] .tab.active, :root[data-theme="dark"] .theme-switch button[aria-pressed="true"] { background: #636366; color: #fff; }
.issues { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.issues li { padding: 8px 11px; border-radius: 10px; font-size: 13px; }
.issues li.err { background: var(--hig-red-tint); color: var(--hig-red); }
.issues li.warn { background: var(--hig-orange-tint); color: var(--hig-orange); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; transition: .25s; z-index: 100;
  background: rgba(29, 29, 31, .92); color: #fff; padding: 10px 18px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  max-width: calc(100vw - 32px); pointer-events: none; font-weight: 500;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: #248a3d; }
.toast.err { background: #c8102a; }
.toast.warn { background: #a84600; }

/* ---------- accessibility ---------- */
@media (prefers-reduced-motion: reduce) { .btn, .toast { transition: none; } .mic.on { animation: none; } }
@media (pointer: coarse) { .btn { min-height: 44px; } .btn.sm { min-height: 36px; } .tab { min-height: 36px; } }

/* ---------- responsive (iPad portrait / phones) ---------- */
@media (max-width: 1280px) {
  .layout { grid-template-columns: minmax(0, 1fr) 400px; }
  .page-title p { display: none; }
}
/* laptops / iPad landscape: the menu becomes an icon rail so the 3D view keeps its width */
@media (max-width: 1100px) {
  :root { --sidebar-w: 68px; }
  .sidebar { padding: 14px 8px; align-items: stretch; }
  .brand { justify-content: center; padding: 6px 0 14px; }
  .brand img { width: 44px; }
  .brand > div, .mainnav button span, #dbStatus { display: none; }
  .mainnav button { justify-content: center; padding: 0; height: 44px; position: relative; }
  .mainnav button svg { width: 21px; height: 21px; }
  .nav-count { position: absolute; top: 3px; right: 3px; min-width: 18px; padding: 1px 5px; font-size: 11px; background: #8e8e93; color: #fff; }
  .nav-count.alert { background: var(--hig-red); }
  .sidebar-foot { padding: 12px 0 0; justify-content: center; }
  .theme-switch { flex-direction: column; }
  .topbar { padding: 0 16px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .projects-page .content { padding: 20px 20px 40px; }
}
/* iPad portrait / phones: logo + menu across the top, 3D view above the panel */
@media (max-width: 900px) {
  html, body { height: auto; }
  .app-shell { display: block; height: auto; }
  .sidebar { position: sticky; top: 0; z-index: 30; flex-direction: row; align-items: center; gap: 10px; padding: 8px 12px; border-right: 0; border-bottom: .5px solid var(--hig-hairline); }
  .brand { border: 0; padding: 0; }
  .mainnav { display: flex; margin: 0; gap: 4px; }
  .mainnav button { width: auto; height: 36px; padding: 0 12px; }
  .mainnav button span { display: inline; }
  .mainnav button svg { width: 18px; height: 18px; }
  .nav-count { position: static; background: var(--hig-fill); color: var(--hig-secondary); }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .theme-switch { flex-direction: row; }
  .workspace { display: block; }
  .page-title { display: none; }
  .topbar { position: static; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 58vh auto; }
  .panel { border-left: 0; border-top: .5px solid var(--hig-hairline); }
  .panes { overflow: visible; }
  .tablewrap { max-height: 60vh; }
  .projects-page { overflow: visible; }
}
@media (max-width: 600px) {
  :root { --topbar-h: 56px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .sidebar { gap: 6px; padding: 8px; }
  .brand img { width: 40px; }
  .mainnav button { padding: 0 10px; gap: 6px; font-size: 13px; }
  .theme-switch button { min-width: 26px; padding: 0 5px; }
  #btnBack { padding: 6px 10px; }
  #btnBack .lbl { display: none; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .hint { display: none; }
  .projects-page .content { padding: 16px 12px 32px; }
  .kpi { padding: 12px 14px; }
  .kpi strong { font-size: 22px; margin-top: 6px; }
  .project-context { gap: 14px 24px; }
  #projShow3d { width: 100%; }
  .project-pick { flex: 1 1 100%; max-width: none; min-width: 0; }
  .project-pick select { width: 100%; }
  #projTable:not(.pivot) th:nth-child(3), #projTable:not(.pivot) td:nth-child(3), #projTable:not(.pivot) th:nth-child(4), #projTable:not(.pivot) td:nth-child(4) { display: none; }
  #projTable .row-actions { flex-direction: column; align-items: stretch; }
}
@media (max-width: 600px) {
  .mainnav .lbl-long { display: none; } .mainnav .lbl-short { display: inline; }
  .mainnav { gap: 2px; }
  .mainnav button { padding: 0 8px; }
}
@media (max-width: 900px) {
  .sidebar .brand { flex: none; }
  .mainnav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
}
@media (max-width: 420px) {
  .theme-switch, #navProjCount { display: none; }
  .mainnav button svg { display: none; }
  .mainnav button { padding: 0 7px; font-size: 13px; gap: 5px; }
  .sidebar { gap: 4px; }
}

/* ---------------------------------------------------------------- sign-in */
body.signed-out .app-shell { display: none; }
.login-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--hig-bg); z-index: 1000; overflow-y: auto; }
.login-screen[hidden] { display: none; }
.login-card { width: min(400px, 100%); display: grid; gap: 14px; padding: 28px; border-radius: 16px; background: var(--hig-surface); box-shadow: var(--hig-sheet-shadow); }
.login-card h1 { margin: 0; font-size: 1.5rem; }
.login-card p { margin: 0; }
.login-card label { display: grid; gap: 6px; font-weight: 600; }
.login-card label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.login-card input[type=email], .login-card input[type=password] { font-size: 16px; padding: 10px 12px; }
.login-logo { width: 56px; height: 56px; border-radius: 12px; }
.login-error { color: var(--hig-red); background: var(--hig-red-tint); border-radius: 8px; padding: 8px 10px; }
.me-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.me-box[hidden] { display: none; }
.me-box strong { display: block; font-size: .85rem; }
.me-box small { display: block; color: var(--hig-secondary); font-size: .75rem; }
/* signed-in user in the narrow icon rail (iPad landscape) and the top bar (phones) */
@media (max-width: 1100px) {
  .me-box { flex-direction: column; gap: 6px; text-align: center; }
  .me-box strong { font-size: .7rem; word-break: break-word; }
  .me-box small { display: none; }
  .me-box .btn.sm { padding: 0 6px; font-size: .7rem; }
}
@media (max-width: 900px) {
  .me-box { flex-direction: row; width: auto; }
  .me-box > div { display: none; }
}

/* ===================================================================== logistics pages (public/js/pages/*.js) */
.lg-page { overflow: auto; }
.lg-page .content { padding: 22px 30px 48px; max-width: 1500px; }
.nav-group-label { display: block; margin: 14px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--hig-secondary); }
.lg-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.lg-bar .grow, .dlg-actions .grow { flex: 1; }
.lg-bar .search-field input, .lg-bar select { min-height: 36px; }
.lg-h2 { margin: 0; font-size: 20px; } .lg-h3 { margin: 18px 0 8px; font-size: 16px; }
.lg-section { margin-bottom: 14px; } .lg-pad { padding: 0 14px; }
.lg-section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.lg-section-head h3, .lg-section-head h4 { margin: 0; font-size: 15px; }
.lg-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--hig-fill); color: var(--hig-secondary); }
.lg-pill.ok { background: var(--hig-green-tint); color: var(--hig-green); } .lg-pill.warn { background: var(--hig-orange-tint); color: var(--hig-orange); } .lg-pill.err { background: var(--hig-red-tint); color: var(--hig-red); }
.btn.warn { border-color: var(--hig-orange); color: var(--hig-orange); } .btn.ok { border-color: var(--hig-green); color: var(--hig-green); }
.lg-row-alarm td { background: var(--hig-red-tint); }
.lg-dim td { opacity: .6; }
.lg-changed { background: var(--hig-orange-tint); }
.lg-need { color: var(--hig-red); font-weight: 600; }
.lg-actions { white-space: nowrap; } .lg-actions .btn { margin: 2px 2px 2px 0; }
.lg-alarmline { font-size: 13px; margin: -6px 0 12px; }
.lg-kpi-main strong { color: var(--hig-blue); }
.lg-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.lg-two .tbl td { padding: 7px 14px; }
.lg-field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.lg-field input, .lg-field select, .lg-field textarea { font-weight: 400; min-width: 0; }
.lg-grow { flex: 1; min-width: 240px; }
/* dialogs */
.lg-dialog { width: min(640px, calc(100vw - 20px)); }
.lg-dialog.wide { width: min(1080px, calc(100vw - 20px)); }
.lg-form h2 { margin: 0 0 6px; }
.lg-form h4 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--hig-secondary); }
.lg-body { display: grid; gap: 10px; max-height: calc(100dvh - 190px); overflow: auto; padding: 2px; }
.lg-body .full { grid-column: 1 / -1; }
.lg-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lg-grid3 .span2 { grid-column: span 2; }
.lg-body .tbl input, .lg-body .tbl select { width: 100%; min-width: 70px; }
.lg-error { color: var(--hig-red); background: var(--hig-red-tint); border-radius: 8px; padding: 8px 10px; margin: 8px 0 0; }
.lg-history { margin: 0; padding-left: 18px; } .lg-history li { margin-bottom: 8px; }
/* article suggestions */
.lg-suggest { position: absolute; z-index: 80; margin-top: 2px; min-width: 280px; max-width: 520px; background: var(--hig-surface); border: 1px solid var(--hig-separator); border-radius: 10px; box-shadow: var(--hig-pop-shadow); padding: 4px; }
label:has(+ .lg-suggest), td:has(> .lg-suggest), .lg-field:has(.lg-suggest) { position: relative; }
.lg-suggest button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 8px; border-radius: 7px; cursor: pointer; color: inherit; font: inherit; }
.lg-suggest button:hover, .lg-suggest button.on { background: var(--hig-fill); }
.lg-suggest span { color: var(--hig-secondary); } .lg-suggest em { color: var(--hig-orange); font-size: 11px; }
/* PO import */
.lg-tab { border: 1px solid var(--hig-separator); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; }
.lg-tab summary { cursor: pointer; } .lg-tab[open] summary { margin-bottom: 8px; }
.lg-colmap { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.lg-stickers { border-top: 1px solid var(--hig-separator); padding-bottom: 8px; }
.lg-stickers .tbl { margin: 0 0 4px; }
/* walk-in totals */
.cs-sum { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.cs-sum-figs { font-size: 14px; }
/* box-to-box segregation */
.lg-move { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: start; margin-bottom: 12px; }
.lg-move-col { background: var(--hig-surface); border-radius: var(--hig-card-radius); box-shadow: var(--hig-card-shadow); padding: 12px; min-height: 220px; }
.lg-move-col.over { outline: 2px dashed var(--hig-blue); }
.lg-move-arrow { align-self: center; font-size: 28px; color: var(--hig-secondary); }
.lg-move-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.lg-move-list li { display: grid; grid-template-columns: 1fr auto 90px auto; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; background: var(--hig-fill); }
.lg-move-list li[draggable] { cursor: grab; }
.lg-move-list li.lg-staged { grid-template-columns: 1fr auto auto; background: var(--hig-blue-tint); }
.lg-move-list li.lg-dim, .lg-move-list li.muted { grid-template-columns: 1fr auto; background: transparent; }
.lg-move-list span { font-size: 12px; color: var(--hig-secondary); }
/* photos */
.lg-photo-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; } .lg-photo-add .lg-caption { flex: 1; min-width: 220px; }
.lg-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.lg-gallery figure { margin: 0; background: var(--hig-surface); border-radius: 10px; overflow: hidden; box-shadow: var(--hig-card-shadow); }
.lg-gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--hig-fill); }
.lg-gallery figcaption { padding: 6px 8px 8px; font-size: 12px; }
.lg-gallery figcaption small { display: block; color: var(--hig-secondary); }
.link-btn { border: 0; background: none; padding: 0; color: var(--hig-blue); cursor: pointer; font-size: 12px; }
/* alerts banner */
.lg-alerts { margin: 10px 24px 0; padding: 8px 14px; border-radius: 12px; background: var(--hig-orange-tint); }
.lg-alerts summary { cursor: pointer; font-weight: 600; }
.lg-alerts ul { margin: 6px 0 2px; padding-left: 18px; max-height: 160px; overflow: auto; }
.lg-alerts li { margin: 3px 0; } .lg-alerts li.err a { color: var(--hig-red); } .lg-alerts a { color: inherit; }
@media (max-width: 1100px) {
  .lg-page .content { padding: 18px 18px 40px; }
  .nav-group-label { display: none; }
  .lg-colmap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .mainnav { overflow-x: auto; scrollbar-width: none; } .mainnav::-webkit-scrollbar { display: none; }
  .mainnav button { flex: none; }
  .lg-two, .lg-move { grid-template-columns: 1fr; } .lg-move-arrow { transform: rotate(90deg); justify-self: center; }
  .lg-alerts { margin: 8px 12px 0; }
}
@media (max-width: 600px) {
  .lg-page .content { padding: 14px 10px 32px; }
  .lg-grid3, .lg-colmap { grid-template-columns: minmax(0, 1fr); } .lg-grid3 .span2 { grid-column: auto; }
  .lg-move-list li { grid-template-columns: 1fr 80px auto; } .lg-move-list li span { grid-column: 1; }
}

/* Stock List */
.sl-search { flex: 1 1 320px; }
.sl-search input { width: 100%; }
.sl-totals { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; font-size: .92em; color: var(--muted, #6b7280); }
.sl-totals .err { color: var(--err, #b91c1c); }
.sl-table th[data-sort] { cursor: pointer; user-select: none; }
.sl-table th.sorted::after { content: ' ▾'; }
.sl-table .sl-ok { color: var(--ok, #15803d); }
.sl-table .sl-neg { color: var(--err, #b91c1c); }
.sl-table tr.sl-detail td { padding-top: 0; border-top: 0; }
.sl-table tr.sl-detail .chip { margin: 2px 4px 2px 0; }
.sl-table td:nth-child(2) { min-width: 220px; }
.sl-totals .grow-note { margin-left: auto; font-size: .9em; }

/* Store Inventory: row actions, Excel import preview, delete */
.sl-actions .btn { margin-left: 2px; }
.sl-unplaced { font-size: 12px; color: var(--hig-accent-text, #1d4ed8); }
.btn.delete-action { background: var(--hig-red, #d92d20); border-color: var(--hig-red, #d92d20); color: #fff; }
.btn.delete-action:hover { filter: brightness(.94); }
.del-why { margin: 8px 0; padding-left: 18px; color: var(--hig-red, #d92d20); }
.lg-dialog .check-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.lg-dialog .lg-span { grid-column: 1 / -1; }
.imp-pick { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 10px; }
.imp-summary { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 8px 0; font-size: 13px; }
.imp-summary .st { margin-top: 0; }
.imp-warn { background: var(--hig-blue-tint, #eef4ff); padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.imp-bar { margin: 6px 0; }
.imp-table { max-height: 52vh; overflow: auto; }
.imp-table th { position: sticky; top: 0; background: var(--hig-bg, #fff); z-index: 1; }
.imp-table td { vertical-align: top; font-size: 12.5px; }
.imp-table .imp-desc { min-width: 220px; }
.imp-table .imp-fix { width: 150px; font-family: inherit; }
.imp-table tr.imp-missing, .imp-table tr.imp-ambiguous, .imp-table tr.imp-unmatched, .imp-table tr.imp-invalid, .imp-table tr.imp-duplicate { background: var(--hig-red-tint, #fdecea); }
.imp-table tr.imp-skipped { opacity: .55; }
@media (max-width: 700px) { .imp-pick { grid-template-columns: 1fr; } }

/* shared product catalog */
.lg-dialog .sl-h { margin: 6px 0 0; font-size: 14px; }
.sl-aliases ul { margin: 4px 0 6px; padding-left: 18px; }
.sl-alias-add { display: flex; gap: 6px; }
.sl-alias-add input { flex: 1; }
.imp-new { display: flex; gap: 4px; align-items: center; font-size: 12px; margin-top: 4px; white-space: nowrap; }
.st.warn { color: #9a6700; background: #fff4d6; }
.link-btn.err { color: var(--hig-red, #d92d20); }

/* Project Packing */
.pk-layout { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.pk-list { display: flex; flex-direction: column; gap: 6px; }
.pk-req { text-align: left; border: 1px solid var(--hig-separator, #e5e5ea); border-radius: 10px; padding: 8px 10px; background: var(--hig-surface, #fff); color: inherit; cursor: pointer; font: inherit; }
.pk-req.active { border-color: var(--hig-accent, #445d75); box-shadow: 0 0 0 1px var(--hig-accent, #445d75) inset; }
.pk-req .st { margin-top: 4px; }
.pk-qty { width: 80px; }
.pk-cartons { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 12px; }
.pk-carton { border: 1px solid var(--hig-separator, #e5e5ea); border-radius: 10px; padding: 10px; background: var(--hig-surface, #fff); }
.pk-carton.sealed { background: var(--hig-fill, #f7f7f9); }
.pk-carton-h { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pk-carton-h .st { margin-top: 0; }
.pk-carton ul { margin: 8px 0; padding-left: 18px; font-size: 13px; }
.pk-carton-a { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 900px) { .pk-layout { grid-template-columns: 1fr; } }

/* Box sizes: Width / Depth / Height always fit side by side, also in the narrow side panel */
.grid2, .grid3, .grid4 { min-width: 0; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
:is(.grid2, .grid3, .grid4) > label { min-width: 0; }
:is(.grid2, .grid3, .grid4) input, :is(.grid2, .grid3, .grid4) select { width: 100%; min-width: 0; box-sizing: border-box; }

/* Boxes: colour, drawing, recent sizes */
.size-help { margin: 0 0 8px; }
.size-help summary { cursor: pointer; font-size: 13px; color: var(--hig-accent-text, #345); }
.box-look { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 10px; align-items: center; margin: 8px 0; }
.box-preview { background: var(--hig-fill, #f5f5f7); border-radius: 10px; padding: 6px; text-align: center; min-height: 160px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(0,0,0,.15); cursor: pointer; padding: 0; }
.swatch.on { outline: 3px solid var(--hig-accent, #445d75); outline-offset: 1px; }
.color-pick { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.color-pick input[type=color] { width: 40px; height: 28px; padding: 0; border: 1px solid var(--hig-separator, #ddd); border-radius: 6px; background: none; }
#nbRecent { align-items: center; }
.chip .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; border: 1px solid rgba(0,0,0,.2); vertical-align: -1px; }
@media (max-width: 520px) { .box-look { grid-template-columns: 1fr; } }

/* "Where is …?" answer in the Voice tab */
.locate-result { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: var(--hig-blue-tint, #eef4ff); }
.locate-result .chips { margin-top: 4px; }

/* Table zoom (iPad / touch): pinch a table or use the − 100% + control; one level for all tables */
table { zoom: var(--table-zoom, 1); }
.tablewrap, .table-wrap { touch-action: pan-x pan-y; }
.table-zoom { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.92);
  box-shadow: 0 4px 18px rgba(0,0,0,.16); backdrop-filter: blur(8px); }
.table-zoom[hidden] { display: none; }
.table-zoom button { min-width: 40px; height: 36px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-weight: 600; font-size: 16px; color: var(--hig-label, #1d1d1f); cursor: pointer; }
.table-zoom button:active { background: var(--hig-fill, #f2f2f7); }
.table-zoom #tzValue { min-width: 58px; font-size: 13px; color: var(--hig-secondary, #6e6e73); }

/* Menu auto-hide (as in Project Control): on wider screens the menu is a 72 px icon strip that slides open on hover.
   Nothing is added or removed when it opens, so the icons never move; the strip only clips the width and the words
   fade in after the slide. The pin keeps it open. Smaller screens keep their own icon rail / top bar. */
.menu-pin { display: none; }
@media (min-width: 1101px) {
  .menu-pin { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; flex: none; width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--hig-secondary); cursor: pointer; }
  .menu-pin:hover, .menu-pin[aria-pressed="true"] { background: var(--hig-fill); color: var(--hig-label); }
  .app-shell.menu-auto { grid-template-columns: 72px minmax(0, 1fr); }
  .app-shell.menu-auto > .sidebar { position: relative; z-index: 45; width: 72px; overflow-x: hidden; overflow-y: auto; padding-left: 12px; padding-right: 12px;
    transition: width .26s cubic-bezier(.2, .8, .2, 1) .1s, box-shadow .26s ease .1s; }
  .app-shell.menu-auto > .sidebar:hover, .app-shell.menu-auto > .sidebar:focus-within { width: var(--sidebar-w); box-shadow: 12px 0 35px rgba(0, 0, 0, .14); }
  /* the same left offset in both states: icons centred in the 72 px strip */
  .app-shell.menu-auto .brand { padding-left: 2px; padding-right: 2px; }
  .app-shell.menu-auto .brand img { width: 44px; }
  .app-shell.menu-auto .mainnav button { padding-left: 15px; padding-right: 10px; }
  .app-shell.menu-auto :is(.mainnav button, .brand, .nav-group-label) { white-space: nowrap; }
  /* words and footer controls keep their space and are faded: out quickly, in after the slide */
  .app-shell.menu-auto > .sidebar :is(.brand > div, .menu-pin, .mainnav button > span, .nav-group-label, .sidebar-foot > *) { transition: opacity .1s ease, visibility 0s linear .1s; }
  .app-shell.menu-auto > .sidebar:not(:hover):not(:focus-within) :is(.brand > div, .menu-pin, .mainnav button > span, .nav-group-label, .sidebar-foot > *) { opacity: 0; visibility: hidden; }
  .app-shell.menu-auto > .sidebar:is(:hover, :focus-within) :is(.brand > div, .menu-pin, .mainnav button > span, .nav-group-label, .sidebar-foot > *) { opacity: 1; visibility: visible; transition: opacity .18s ease .24s, visibility 0s linear 0s; }
  /* counts: a small badge on the icon in the strip */
  .app-shell.menu-auto .mainnav button { position: relative; }
  .app-shell.menu-auto > .sidebar:not(:hover):not(:focus-within) .nav-count { position: absolute; top: 2px; left: 30px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; }
}
@media (min-width: 1101px) and (prefers-reduced-motion: reduce) { .app-shell.menu-auto > .sidebar, .app-shell.menu-auto > .sidebar * { transition: none !important; } }

/* Borrow from a box */
.borrow-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.borrow-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 80px auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: var(--hig-fill, #f5f5f7); }
.borrow-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.borrow-row input[type=number] { width: 80px; }

/* One path for every request: Picked → Packed → (Site ready) → Dispatched */
.req-steps { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; padding: 0; list-style: none; counter-reset: s; }
.req-steps li { position: relative; padding: 4px 10px 4px 24px; border-radius: 999px; font-size: 12px; background: var(--hig-fill, #f2f2f7); color: var(--hig-secondary, #6e6e73); }
.req-steps li::before { content: '○'; position: absolute; left: 9px; }
.req-steps li.done { background: #e7f6ec; color: #1f6b3a; }
.req-steps li.done::before { content: '✓'; }
.req-steps li.active { background: #fff4d6; color: #8a5a00; }
.req-steps li.active::before { content: '●'; }
.req-steps li.wait { background: #fdecea; color: #a1281e; }
.req-steps li.wait::before { content: '⏸'; left: 7px; }
.req-steps.compact { margin: 4px 0 2px; }
.req-steps.compact li { font-size: 10.5px; padding: 2px 7px 2px 18px; }
.req-steps.compact li::before { left: 6px; }

/* ---------- Tap-to-pack: box sizes, item tiles, the box being filled ---------- */
.tp { border: 1px solid var(--hig-separator, #e5e5ea); border-radius: 14px; background: var(--hig-surface, #fff); padding: 12px 14px; margin: 10px 0 14px; }
.tp-step { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 4px 0 8px; }
.tp-step b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--hig-accent, #445d75); color: #fff; font-size: 12px; }
.tp-step .grow { flex: 1; }
.tp-sizes, .tp-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; margin-bottom: 12px; }
.tp-items { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tp-size, .tp-item { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; padding: 8px 6px; border-radius: 12px;
  border: 1.5px solid var(--hig-separator, #e5e5ea); background: var(--hig-fill, #f7f7f9); cursor: pointer; font: inherit; color: inherit; min-height: 44px; touch-action: manipulation; }
.tp-size:hover, .tp-item:hover { border-color: var(--hig-accent, #445d75); }
.tp-size.on { border-color: var(--hig-accent, #445d75); background: #e9eef4; box-shadow: 0 0 0 1px var(--hig-accent, #445d75) inset; }
.tp-size svg { width: 74px; height: 58px; }
.tp-size b { font-size: 14px; }
.tp-size small, .tp-item small { font-size: 11.5px; color: var(--hig-secondary, #6e6e73); }
.tp-size.add { justify-content: center; border-style: dashed; background: transparent; color: var(--hig-accent, #445d75); }
.tp-item { align-items: flex-start; text-align: left; padding: 10px 12px; }
.tp-item b { font-size: 15px; }
.tp-item small.d { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tp-item .left { margin-top: 4px; font-size: 12px; font-weight: 600; color: #8a5a00; background: #fff4d6; border-radius: 999px; padding: 1px 8px; }
.tp-item:active, .tp-size:active { transform: scale(.97); }
.tp-box { border: 2px dashed #c49a5e; background: #fbf6ee; border-radius: 12px; padding: 10px 12px; }
.tp-box-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.tp-box-h b { font-size: 15px; }
.tp-lines { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tp-lines li { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 8px; padding: 4px 8px; }
.tp-lines li .a { flex: 1; min-width: 0; }
.tp-lines li .a small { display: block; color: var(--hig-secondary, #6e6e73); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-lines input { width: 70px; text-align: right; }
.tp-lines .btn.sm { min-width: 34px; }
.tp-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tp-foot input { width: 90px; }
.tp-empty { color: var(--hig-secondary, #6e6e73); font-size: 13px; padding: 6px 2px; }

/* Project Requirements → All projects: one Required · Balance pair per project */
#projTable.pivot { border-collapse: separate; border-spacing: 0; }
#projTable.pivot th, #projTable.pivot td { padding-left: 8px; padding-right: 8px; }
#projTable.pivot .pv-a { position: sticky; left: 0; z-index: 2; background: var(--hig-surface, #fff); min-width: 110px; }
#projTable.pivot thead .pv-a { z-index: 4; }
#projTable.pivot .pv-d { min-width: 220px; max-width: 320px; white-space: normal; }
#projTable.pivot th.pv-h { text-align: center; border-left: 1px solid var(--hig-separator, #e5e5ea); white-space: nowrap; }
#projTable.pivot th.pv-s { font-size: 11px; font-weight: 600; }
#projTable.pivot .pv-p:not(.pv-b), #projTable.pivot th.pv-s:not(.pv-b) { border-left: 1px solid var(--hig-separator, #e5e5ea); }
#projTable.pivot .pv-b b { color: #8a5a00; }
#projTable.pivot .pv-t { background: #f4f6f8; }
#projTable.pivot td.pv-t:not(.pv-b), #projTable.pivot th.pv-t.pv-s:not(.pv-b), #projTable.pivot th.pv-h.pv-t { border-left: 2px solid #cfd6de; }
#projTable.pivot tbody tr:hover td { background: #f7f9fb; }
#projTable.pivot tbody tr:hover td.pv-a { background: #f7f9fb; }
#projTable.pivot thead tr:first-child th { height: 32px; box-sizing: border-box; padding-top: 6px; padding-bottom: 6px; }
#projTable.pivot thead tr:nth-child(2) th { top: 32px; }
#projTable.pivot thead th.pv-a { background: var(--hig-surface-2); }
