@font-face { font-family: WarehouseIcons; src: url("vendor/warehouse-icons.otf") format("opentype"); font-display: block; }
.glyph { font: normal 24px/1 WarehouseIcons; flex-shrink: 0; }
:root {
  color-scheme: light;
  --ink: #1d2538;
  --muted: #536078;
  --bg: #f5f6fa;
  --surface: #fff;
  --border: #d9dde8;
  --nav: #20283e;
  --accent: #433ea0;
  --accent-hover: #312d81;
  --soft: #eeedfc;
  --danger: #a12634;
  --focus: #706aca;
  --shadow: 0 2px 5px #20283e08;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); overflow-wrap: anywhere; }
.hidden, [hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.025em; line-height: 1.15; }
h3 { font-size: 18px; line-height: 1.25; }
p + p { margin-top: 8px; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.empty { padding: 16px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted); }
button, input, textarea { font: inherit; }
button { min-height: 44px; min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; padding: 8px 14px; border: 1px solid transparent; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 650; cursor: pointer; }
button:hover { background: var(--accent-hover); }
button:disabled { opacity: .6; cursor: default; }
button.secondary { background: var(--surface); color: var(--accent); border-color: var(--border); }
button.secondary:hover, button.quiet:hover, button.link:hover { background: var(--soft); }
button.quiet, button.link { background: transparent; color: var(--accent); }
button.link { padding-inline: 9px; text-decoration: underline; text-underline-offset: .2em; }
button.danger { background: var(--danger); color: #fff; }
button.danger:hover { background: #821b28; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
input:not([type="checkbox"]), textarea {
  min-height: 44px; min-width: 0; max-width: 100%; padding: 8px 11px; border: 1px solid #aebfcd;
  border-radius: 10px; background: var(--surface); color: var(--ink);
}
input::placeholder { color: var(--muted); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
input[type="file"] { max-width: 100%; padding: 5px; }
input::file-selector-button { background: var(--soft); color: var(--accent); font: inherit; font-weight: 650; border: 0; border-radius: 6px; padding: 5px 9px; margin-right: 8px; cursor: pointer; }
.field { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; max-width: 100%; font-weight: 600; }
.field span { font-size: 14px; }
.field input, .field textarea { font-weight: 400; }
.check { display: inline-flex; gap: 6px; align-items: center; min-height: 44px; padding: 2px 8px; border-radius: 8px; background: var(--bg); cursor: pointer; }

#app { min-height: 100vh; }
.brand-mark { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; color: #252d48; background: #cfcdff; border-radius: 10px; font-size: 24px; }
.home-link { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; color: var(--ink); font-weight: 750; text-decoration: none; }
.topbar .home-link { color: white; font-size: 18px; }
.topbar .home-link:hover { color: #dedcff; }
.topbar .user { margin-right: auto; }
.home-menu { display: grid; gap: 24px; }
.home-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr)); gap: 16px; }
.home-tools .search .field { flex-basis: 100%; }
.home-tools .search .field span { color: var(--ink); font-size: 18px; font-weight: 700; }
#quick-result:empty { display: none; }
.menu-sections { display: grid; gap: 12px; }
.menu-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.menu-tile { display: grid; grid-template-columns: 1fr auto; align-content: start; gap: 5px; position: relative; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.menu-tile .glyph { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--soft); color: var(--accent); margin-bottom: 6px; }
.menu-tile strong, .menu-tile .tile-detail { grid-column: 1 / -1; }
.menu-tile b, .important-tile b { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 22px; }
.menu-tile b { top: 22px; right: 18px; transform: none; color: #667086; }
.important-tile { display: grid; align-content: start; gap: 10px; padding: 16px 20px; background: linear-gradient(115deg,#292e50,#393e66); color: white; border-radius: 16px; }
.important-tile strong { font-size: 21px; }
.important-tile span { color: #e4e4fa; }
.important-tile a { color: white; }
.notice-inbox { display: flex; align-items: center; gap: 12px; min-height: 44px; text-decoration: none; }
.notice-inbox .glyph { color: #e3e0ff; }
.unread-total:not(:empty) { margin-left: auto; background: #e3e3f7; padding: 3px 10px; border-radius: 20px; font-size: 13px; }
.important-tile .unread-total { color: #282642; font-weight: 700; }
.important-tile .has-new { background: #ffe3a0; color: #543400; }
.notice-preview a { display: grid; gap: 4px; align-content: center; min-height: 48px; border-top: 1px solid #ffffff40; padding-top: 12px; text-decoration: none; }
.notice-preview strong { font-size: 17px; }
.notice-preview a:hover strong, .notice-inbox:hover strong { text-decoration: underline; }
.notice-link { text-decoration: none; color: var(--ink); }
.notice-link strong, .notice-list .notice-new { color: var(--accent); }
.notice-list { display: grid; gap: 10px; }
.notice-list small { color: var(--muted); }
#view:not([data-tab="home"]) { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
#section-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 3px; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: white; }
#section-nav a, #section-nav select { display: grid; place-items: center; min-height: 44px; padding: 4px 9px; color: var(--ink); font-size: 14px; font-weight: 650; text-decoration: none; border-radius: 8px; }
#section-nav a { display: flex; align-items: center; gap: 5px; }
#section-nav .glyph { font-size: 19px; }
#section-nav a[aria-current] { background: var(--soft); color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
#section-nav select { display: none; max-width: 43%; min-width: 0; background: var(--bg); border: 1px solid var(--border); }
@media (max-width: 1140px) {
  #section-nav a:not(.primary) { display: none; }
  #section-nav select { display: block; }
  #section-nav a { flex: 1 1 auto; flex-direction: column; justify-content: center; gap: 1px; font-size: 12px; padding-inline: 4px; }
}
@media print { #section-nav { display: none; } }
.menu-tile:hover, .menu-tile:focus-visible { background: var(--soft); border-color: var(--accent); }
.menu-tile strong { font-size: 18px; color: var(--ink); }
.menu-tile span { color: var(--muted); }
.workspace { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; min-height: 64px; padding: 8px max(18px, calc((100vw - 1240px)/2)); background: var(--nav); color: white; }
.topbar button.secondary, .topbar button.quiet { background: transparent; color: white; }
.topbar button.secondary { border-color: #586078; }
.topbar button:hover { background: #353d56; }
.user { display: grid; overflow-wrap: anywhere; }
#user-roles { color: #d6d8ec; font-size: 13px; font-weight: 600; }
.top-actions, .row, .dialog-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#learn span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid #a4acc5; margin-right: 3px; }
main { max-width: 1304px; margin: 0 auto; padding: clamp(16px, 3vw, 32px); }
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-intro { max-width: 75ch; }
.card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; padding: clamp(14px, 2vw, 20px); border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.card > div:empty { display: none; }
.row { min-width: 0; }
.search { align-items: end; }
.search .field { flex: 0 1 340px; }
.search button { flex: 0 0 auto; }
.result-count { margin-bottom: 8px; color: var(--muted); }
.login { display: grid; place-items: center; min-height: 100svh; padding: 16px; background: linear-gradient(145deg, #e3e3f4, var(--bg) 60%); }
.login .card { width: min(100%, 410px); padding: clamp(18px, 6vw, 32px); gap: 16px; }
.login h1 { font-size: clamp(24px, 5vw, 30px); letter-spacing: -.025em; line-height: 1.15; }
#login-error:empty { display: none; }

.table-scroll { overflow-x: auto; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; overflow-wrap: anywhere; }
th { color: #344a61; background: #edf3f7; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
tr:nth-child(even) td { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td button + button { margin-top: 4px; }
.badge { display: inline-block; border-radius: 7px; background: #e8eef8; color: #2c4e70; padding: 3px 8px; font-size: 13px; font-weight: 650; }
.badge.ok { background: #e2f4eb; color: #165a41; }
.badge.warn { background: #fff0cc; color: #744400; }
.badge.bad { background: #fce9ec; color: #922430; }
.badge.qty { font-size: inherit; font-variant-numeric: tabular-nums; }

.seg, .choices { display: flex; flex-wrap: wrap; gap: 4px; width: fit-content; max-width: 100%; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: #edf3f7; }
.seg button, .choices span { display: block; border: 1px solid transparent; background: transparent; color: var(--ink); border-radius: 8px; }
.seg button.active, .choices input:checked + span { background: var(--surface); color: var(--accent); border-color: #aba7d0; box-shadow: 0 1px 3px #15263a17; }
.choices { margin: 0; min-inline-size: 0; }
.choices legend { padding: 0; font-size: 14px; font-weight: 650; }
.choices label { position: relative; cursor: pointer; flex: 1 1 auto; min-width: 0; max-width: 100%; }
.choices input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; padding: 0; }
.choices span { display: grid; place-items: center; padding: 6px 10px; min-height: 44px; text-align: center; font-weight: 650; line-height: 1.2; }
.choices input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.seg button:hover, .choices label:hover span { border-color: #aba7d0; }
.print-controls .row { align-items: end; }
.map-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 28px; padding: 16px 20px; background: white; border: 1px solid var(--border); border-radius: 14px; }
.map-summary { display: flex; gap: clamp(14px, 4vw, 52px); margin: 0; }
.map-summary > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; }
.map-summary dt, .row-count { color: var(--muted); font-size: 13px; }
.map-summary dd { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 3px; background: #fff; border: 1px solid #8792a5; }
.dot.scanned { background: #26785d; border-color: #26785d; }
.cell-find { display: grid; gap: 4px; font-weight: 650; }
.cell-find label { font-size: 14px; }
.cell-find > div { display: flex; gap: 6px; }
.cell-find input { width: 11em; flex: 1; }
.cell-find small:empty { display: none; }
.cell-map { display: grid; gap: 12px; }
.cell-map > .cells-row { padding: 14px; background: white; border: 1px solid var(--border); border-radius: 14px; }
.cells-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cells-row .row-name { flex: 0 0 100%; font-weight: 750; }
.cell { display: grid; align-content: center; width: 56px; min-height: 52px; padding: 3px 5px; color: var(--ink); background: var(--surface); border-color: var(--border); font-size: 13px; font-weight: 500; text-align: center; }
.cell b { font-size: 15px; }
.cell.filled { background: #e2f4eb; border-color: #85baa3; color: #165a41; }
.cell.service { width: auto; padding-inline: 10px; }
.cell:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.cell.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-acc { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; }
.row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; width: 100%; padding: 12px; background: transparent; color: var(--ink); text-align: left; }
.row-head:hover { background: var(--soft); }
.row-head .chev, .prod-toggle .chev { display: inline-block; color: var(--accent); transition: transform .16s ease; }
.row-head[aria-expanded="true"] .chev, .prod-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.row-head .fill { margin-left: auto; width: 84px; height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.row-head .fill span { display: block; height: 100%; background: var(--accent); }
.row-body { padding: 0 12px 12px; }
.acc-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.acc-heading .row-head { flex: 1 1 14rem; }
.acc-heading .pick-row { margin: 4px 8px; }
.picking .cell::before { content: ""; width: 16px; height: 16px; border: 1px solid var(--muted); border-radius: 4px; justify-self: center; margin-bottom: 3px; }
.picking .cell[aria-pressed="true"] { background: var(--soft); border: 2px solid var(--accent); }
.picking .cell[aria-pressed="true"]::before { content: "✓"; line-height: 14px; font-weight: 750; color: white; background: var(--accent); border-color: var(--accent); }
.pick-row[aria-pressed="true"] { background: var(--soft); border-color: var(--accent); }
.label-preview { width: min(900px, calc(100% - 16px)); height: min(90dvh, 900px); padding: 12px; }
.label-preview[open] { display: flex; flex-direction: column; gap: 10px; }
.preview-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.label-preview iframe { width: 100%; flex: 1 1 0; min-height: 80px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.cell-tip { position: fixed; inset: 0 auto auto 0; z-index: 10; pointer-events: none; width: max-content; max-width: min(340px, calc(100vw - 16px)); background: var(--nav); color: #fff; border-radius: 10px; padding: 10px 12px; font-size: 14px; box-shadow: 0 8px 24px #15263a40; visibility: hidden; }
.cell-tip.visible { visibility: visible; display: flex; flex-direction: column; overflow: hidden; }
.tip-body { min-height: 0; overflow: hidden; }
.tip-section + .tip-section { margin-top: 8px; }
.tip-head, .tip-hint { flex: none; }
.cell-tip .muted, .tip-hint { color: #c2d4e5; }
.tip-head, .tip-line, .unit-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.tip-head { margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid #47617a; }
.tip-sizes { color: #b5fae4; }
.tip-hint { margin-top: 6px; }

dialog { color: var(--ink); border: 1px solid var(--border); border-radius: 16px; padding: 20px; background: var(--surface); box-shadow: 0 12px 40px #15263a38; }
dialog::backdrop { background: #13263b70; }
#action-dialog { width: min(100% - 24px, 460px); }
#action-form, #drawer-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
#action-form h2, #drawer h2 { font-size: 24px; }
#action-form .dialog-actions { justify-content: flex-end; }
#drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(100%, 690px); height: 100%; max-height: none; max-width: none; border-radius: 0; padding: clamp(12px, 3vw, 24px); overflow: auto; }
.drawer-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.drawer-head > :first-child { min-width: 0; flex: 1 1 10em; }
#drawer .hist-filter { align-items: end; }
#drawer .history { font-size: 14px; }
.unit-line { font-family: ui-monospace, Consolas, monospace; padding-block: 3px; }
.toast { margin: 8px 0; background: var(--nav); color: white; padding: 12px 16px; border-radius: 10px; }
.toast.error { background: var(--danger); }

#guide { position: fixed; inset: 0; margin: 0; padding: 0; width: 100%; height: 100%; max-height: none; max-width: none; border: 0; border-radius: 0; background: transparent; overflow: hidden; box-shadow: none; }
#guide::backdrop { background: transparent; }
.guide-active .workspace { padding-bottom: 100vh; }
#guide-outline { position: absolute; inset: 0; border: 3px solid #7ce8c9; border-radius: 12px; box-shadow: 0 0 0 200vmax #101e31c9; pointer-events: none; }
#guide-outline.no-target { background: #101e31c9; border: 0; border-radius: 0; box-shadow: none; }
.guide-panel { position: absolute; z-index: 1; display: grid; gap: 8px; width: min(390px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow: auto; padding: 14px 16px; border-radius: 14px; background: var(--surface); box-shadow: 0 12px 36px #101e3155; }
.guide-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; color: var(--accent); font-weight: 750; }
.guide-panel h2 { font-size: 22px; }
.guide-panel .dialog-actions { justify-content: space-between; }

@media (max-width: 580px) {
  body { font-size: 16px; }
  main, .topbar { padding: 12px; }
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 4px; padding-block: 6px; }
  .topbar .home-link { min-width: 0; font-size: 16px; }
  .topbar .user { grid-column: 1; display: flex; flex-wrap: wrap; gap: 0 6px; }
  .topbar .user strong:empty { display: none; }
  .top-actions { grid-area: 1 / 2 / 3 / 3; gap: 2px; }
  .top-actions button { padding-inline: 7px; }
  #learn { width: 44px; font-size: 0; }
  #learn span { display: inline-grid; font-size: 15px; margin: 0; }
  .home-menu { gap: 16px; }
  .home-tools, .menu-tiles { gap: 8px; }
  .menu-tile { grid-template-columns: 38px 1fr; column-gap: 12px; padding: 12px 28px 12px 12px; }
  .menu-tile .glyph { grid-row: 1/3; align-self: center; width: 36px; height: 36px; margin: 0; }
  .menu-tile strong, .menu-tile .tile-detail { grid-column: 2; }
  .menu-tile .tile-detail { font-size: 14px; }
  .menu-tile b { top: 50%; right: 10px; transform: translateY(-50%); }
  .map-tools { padding: 12px; gap: 12px; }
  .map-summary, .cell-find { width: 100%; }
  .map-summary { display: grid; grid-template-columns: 0.95fr 1.2fr 1fr; gap: 8px; }
  .map-summary dd { font-size: 22px; }
  .cell-map > .cells-row { padding: 10px; }
  .page { gap: 12px; }
  .search .field { flex: 1 1 100%; }
  .search button { flex: 1 1 auto; }
  .row-head .fill { display: none; }
  .row-head .muted { flex: 1 1 100%; }
  .table-scroll { border: none; border-radius: 0; background: transparent; }
  table, table tbody { display: grid; gap: 8px; }
  table .table-head { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { display: grid; min-width: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  td, td.num, tr:nth-child(even) td { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); align-items: start; gap: 6px; padding: 5px 0; text-align: left; background: transparent; }
  td::before { content: attr(data-label); font-size: 14px; font-weight: 650; color: var(--muted); overflow-wrap: anywhere; }
  td[data-label=""], td[colspan] { display: block; }
  td[colspan]::before { content: none; }
  td:empty { display: none; }
  .guide-panel { font-size: 15px; max-height: 60%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { scroll-behavior: auto !important; transition: none !important; }
}
@media (max-height: 480px) {
  .guide-panel { max-height: 55%; }
}
.product-form, .product-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px),1fr)); gap: 12px; margin: 12px 0; align-items: end; }
.product-facts { align-items: start; }
.product-facts dt { color: var(--muted); font-size: 14px; }
.product-facts dd { margin: 0; font-weight: 650; }
.product-history p { padding: 8px 0; border-bottom: 1px solid var(--border); }
details.card > summary { cursor: pointer; font-weight: 650; padding-block: 8px; }
