:root {
  --bg: #f3f7f5;
  --panel: #ffffff;
  --panel-soft: #f7fbf9;
  --text: #071d19;
  --muted: #60736e;
  --line: #d7e2dd;
  --primary: #0f6d5b;
  --primary-strong: #084f43;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #c2410c;
  --green: #15803d;
  --sidebar: #10231d;
  --shadow: 0 18px 45px rgba(24, 45, 38, .10);
  --sidebar-expanded: 260px;
  --sidebar-collapsed: 76px;
  --sidebar-width: var(--sidebar-expanded);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--sidebar);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 10px;
  padding: 22px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card h1,
.brand-row h1,
.topbar h2 {
  margin: 0;
}

.login-card p,
.brand-row p,
.eyebrow,
.sub,
#modalSubtitle {
  margin: 0;
  color: var(--muted);
}

.login-card label,
.field {
  display: grid;
  gap: 6px;
}

.login-card input,
.field input,
.field select,
.field textarea,
.search {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  outline: 0;
}

.field textarea {
  min-height: 70px;
  padding: 8px 10px;
  resize: vertical;
}

.login-error {
  min-height: 20px;
  color: var(--red);
}

.app {
  width: calc(100% * var(--raw-wms-zoom-inverse, 1));
  min-height: calc(100vh * var(--raw-wms-zoom-inverse, 1));
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  zoom: var(--raw-wms-zoom, 1);
}

.app.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: var(--sidebar-width);
  height: calc(100vh * var(--raw-wms-zoom-inverse, 1));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
  padding: 18px 14px;
  background: var(--sidebar);
  color: #eef8f3;
  transition: width .18s ease, padding .18s ease, box-shadow .18s ease;
  overflow: hidden;
}

.app.sidebar-collapsed .sidebar:hover {
  width: var(--sidebar-expanded);
  box-shadow: 18px 0 40px rgba(0, 0, 0, .20);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-row > div:not(.brand-mark) {
  min-width: 0;
}

.sidebar-toggle {
  margin-left: auto;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: #eef8f3;
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #ffd166;
  color: #102016;
  font-weight: 900;
}

.nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.nav button {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #e8f2ee;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
}

.nav button::before,
.nav-group summary::before {
  content: attr(data-icon);
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, .10);
  color: #e8f2ee;
  font-size: 13px;
  font-weight: 900;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  color: #9fb3ad;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary::after {
  content: "";
  margin-left: auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform .16s ease;
}

.nav-group:not([open]) summary::after {
  transform: rotate(-90deg);
}

.nav-group-items {
  display: grid;
  gap: 6px;
  padding-left: 10px;
}

.nav-group-items button {
  min-height: 36px;
}

.app.sidebar-collapsed .sidebar:not(:hover) {
  padding-left: 10px;
  padding-right: 10px;
}

.app.sidebar-collapsed .sidebar:not(:hover) .brand-row {
  justify-content: center;
}

.app.sidebar-collapsed .sidebar:not(:hover) .brand-row > div:not(.brand-mark),
.app.sidebar-collapsed .sidebar:not(:hover) .nav button,
.app.sidebar-collapsed .sidebar:not(:hover) .nav-group summary,
.app.sidebar-collapsed .sidebar:not(:hover) #logoutBtn {
  font-size: 0;
}

.app.sidebar-collapsed .sidebar:not(:hover) .sidebar-toggle {
  position: absolute;
  top: 60px;
  right: 10px;
  width: 28px;
  height: 28px;
  font-size: 16px;
}

.app.sidebar-collapsed .sidebar:not(:hover) .nav {
  justify-items: center;
  gap: 8px;
}

.app.sidebar-collapsed .sidebar:not(:hover) .nav-group {
  width: 100%;
}

.app.sidebar-collapsed .sidebar:not(:hover) .nav-group-items {
  padding-left: 0;
}

.app.sidebar-collapsed .sidebar:not(:hover) .nav button,
.app.sidebar-collapsed .sidebar:not(:hover) .nav-group summary,
.app.sidebar-collapsed .sidebar:not(:hover) #logoutBtn {
  width: 42px;
  min-width: 42px;
  justify-content: center;
  padding: 0;
}

.app.sidebar-collapsed .sidebar:not(:hover) .nav button::before,
.app.sidebar-collapsed .sidebar:not(:hover) .nav-group summary::before {
  font-size: 13px;
}

.app.sidebar-collapsed .sidebar:not(:hover) .nav-group summary::after {
  display: none;
}

.app.sidebar-collapsed .sidebar:not(:hover) #logoutBtn::before {
  content: "退";
  font-size: 13px;
}

.nav button[draggable="true"] {
  cursor: grab;
}

.nav button.dragging {
  opacity: .45;
}

.nav button.active,
.nav button:hover {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .10);
}

.workspace {
  min-width: 0;
  padding: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.eyebrow {
  color: var(--primary);
  font-weight: 800;
}

.top-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.search {
  width: min(460px, 44vw);
}

.zoom-control {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.zoom-control select {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 900;
  outline: 0;
}

.tab-bar {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  margin: 0 -18px 12px;
  padding: 8px 18px 0;
  border-top: 1px solid rgba(215, 226, 221, .7);
  border-bottom: 1px solid var(--line);
  background: #eef5f2;
  overflow-x: auto;
}

.work-tab {
  min-width: 104px;
  max-width: 180px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: 8px 8px 0 0;
  padding: 0 10px;
  background: #e4ece8;
  color: #4c625c;
  cursor: pointer;
  font-weight: 900;
  white-space: nowrap;
}

.work-tab span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.work-tab b {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #64756f;
  font-style: normal;
  font-size: 15px;
  line-height: 1;
}

.work-tab b:hover {
  background: #d8e4df;
  color: #b42318;
}

.work-tab.active {
  border-color: var(--line);
  border-bottom-color: #fff;
  background: #fff;
  color: var(--primary);
}

.btn,
.icon-btn,
.text-btn {
  border: 0;
  cursor: pointer;
}

.btn:disabled,
.icon-btn:disabled,
.text-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.btn {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 12px;
  font-weight: 800;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.btn.ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.metric,
.toolbar,
.panel,
.modal-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  min-height: 100px;
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-weight: 800;
}

.metric strong {
  color: var(--primary-strong);
  font-size: 28px;
  line-height: 1.1;
}

.toolbar {
  min-height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.toolbar strong {
  font-size: 16px;
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sub-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.sub-tabs button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.document-filters {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.document-filters label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.document-filters span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.document-filters input,
.document-filters select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.movement-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfa;
}

.movement-filters label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.movement-filters span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.movement-filters input,
.movement-filters select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.movement-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.movement-summary strong {
  color: var(--primary-strong);
}

.movement-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pick-submit-lines {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  max-height: 44vh;
  overflow: auto;
  padding-right: 4px;
}

.panel {
  overflow: hidden;
}

.pending-workbench {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfa;
}

.pending-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pending-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: end;
}

.pending-filters label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.pending-filters span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pending-filters input,
.pending-filters select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.pending-result-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.pending-result-line strong {
  color: var(--text);
}

.pending-qty strong {
  color: var(--primary-strong);
  font-size: 16px;
}

.pending-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf4f1;
  color: #40586a;
  font-weight: 900;
}

td strong {
  display: block;
  font-size: 14px;
}

td .sub {
  display: block;
  margin-top: 3px;
}

tr.selected-row {
  background: #ecfdf5;
  outline: 2px solid rgba(15, 109, 91, .18);
}

.select-cell {
  cursor: crosshair;
  user-select: none;
}

[data-pending-row],
[data-pick-line-row] {
  user-select: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 8px;
  background: #edf2f7;
  color: #475569;
  font-weight: 800;
}

.badge-btn {
  border: 0;
  cursor: pointer;
}

.badge.green {
  background: #dcfce7;
  color: var(--green);
}

.badge.amber {
  background: #fef3c7;
  color: var(--amber);
}

.badge.red {
  background: #fee2e2;
  color: #b42318;
}

.badge.blue {
  background: #dbeafe;
  color: var(--blue);
}

.btn.danger {
  border: 1px solid #fecaca;
  background: #fff;
  color: #b42318;
}

.text-btn {
  padding: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 900;
}

.text-btn.danger {
  color: #b42318;
}

.filter-chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.filter-chip span {
  margin-left: 4px;
  color: var(--muted);
}

.filter-chip.active {
  border-color: rgba(15, 109, 91, .28);
  background: #e9f7f2;
  color: var(--primary);
}

.toolbar-check {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.toolbar-check input {
  width: 16px;
  height: 16px;
  min-height: 16px;
}

.multi-select-menu {
  position: relative;
}

.multi-select-menu summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.multi-select-menu summary::-webkit-details-marker {
  display: none;
}

.multi-select-menu summary::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.multi-select-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  width: min(320px, 82vw);
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.multi-select-actions,
.multi-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.multi-select-actions {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.multi-select-option {
  min-height: 34px;
  padding: 0 4px;
  cursor: pointer;
}

.multi-select-option span {
  flex: 1;
  font-weight: 900;
}

.multi-select-option em,
.multi-select-empty {
  color: var(--muted);
  font-style: normal;
}

.empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.empty.compact {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 19, 16, .56);
}

.modal-panel {
  width: min(1180px, 96vw);
  max-height: 92vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  box-shadow: var(--shadow);
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0 0 4px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  overflow: auto;
  padding: 16px 18px;
}

.factory-request-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  padding: 10px 12px;
  background: #f3f8f6;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.wide,
.field.wide,
.line-editor {
  grid-column: 1 / -1;
}

.line-editor {
  display: grid;
  gap: 8px;
}

.line-row {
  display: grid;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.inbound-line {
  grid-template-columns: minmax(250px, 1.5fr) repeat(4, minmax(120px, 1fr));
}

.return-inbound-line {
  grid-template-columns: minmax(300px, 1.5fr) repeat(2, minmax(160px, 1fr));
}

.production-return-picker {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.production-return-line {
  grid-template-columns: 52px minmax(320px, 1.7fr) repeat(5, minmax(120px, 1fr));
}

.check-field {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
  color: var(--text-muted);
}

.check-field input {
  width: 18px;
  height: 18px;
}

.return-verify-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.outbound-line {
  grid-template-columns: minmax(260px, 1.4fr) minmax(230px, 1.2fr) minmax(120px, .8fr) minmax(140px, 1fr);
}

.outbound-batch-editor {
  gap: 10px;
}

.outbound-batch-head,
.outbound-selected-line {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(140px, 180px) minmax(160px, 220px) 72px;
  gap: 10px;
  align-items: end;
}

.outbound-batch-head {
  align-items: center;
  color: var(--muted);
  font-weight: 900;
  padding: 0 2px;
}

.outbound-selected-line .field {
  margin: 0;
}

.stock-prepare-material-box {
  min-height: 42px;
  display: grid;
  gap: 3px;
  align-content: center;
}

.stock-prepare-material-box strong {
  color: var(--text);
  line-height: 1.25;
}

.stock-prepare-material-box span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.outbound-selected-line .text-btn {
  height: 42px;
  justify-content: center;
}

.outbound-batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stock-prepare-empty {
  padding: 14px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.readonly-box {
  min-height: 36px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.notice {
  padding: 10px 12px;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  background: #fff8eb;
  color: #8a4b0f;
  font-weight: 800;
}

.bom-material-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 20, 18, .42);
}

.bom-material-card {
  width: min(1180px, calc(100vw - 32px));
  height: min(760px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
  overflow: hidden;
}

.bom-material-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.bom-material-head h4 {
  margin: 0;
  font-size: 17px;
}

.bom-material-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.bom-select-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(150px, .55fr);
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.bom-select-filters label {
  display: grid;
  gap: 5px;
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.bom-select-filters input,
.bom-select-filters select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  outline: 0;
}

.bom-select-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px minmax(260px, .62fr);
  gap: 12px;
  padding: 14px 16px;
  overflow: hidden;
}

.bom-select-pane {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.bom-select-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #eef5f1;
  color: #40586a;
  font-weight: 900;
}

.bom-select-pane-head span {
  color: var(--primary);
}

.bom-select-list {
  min-height: 0;
  overflow: auto;
  padding: 8px;
}

.bom-select-list.is-slide-checking {
  user-select: none;
  touch-action: none;
}

.bom-select-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px 8px;
  border-bottom: 1px solid #eef2f0;
  cursor: pointer;
}

.bom-select-row:hover {
  background: #f6fbf8;
}

.bom-select-row.is-checked {
  background: #eef8f2;
}

.bom-select-row span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.bom-select-row strong {
  color: var(--primary-strong);
}

.bom-select-row em {
  overflow: hidden;
  color: var(--text);
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bom-select-row small {
  color: var(--muted);
  font-weight: 800;
}

.bom-select-transfer {
  display: grid;
  align-content: center;
  gap: 10px;
}

.bom-select-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.progress-cell {
  min-width: 260px;
  display: grid;
  gap: 5px;
}

.progress-cell > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.progress-cell strong {
  color: var(--blue);
}

.progress-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7f0ec;
}

.progress-track i,
.progress-track b {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
}

.progress-track i {
  background: #bfd7ff;
}

.progress-track b {
  background: var(--blue);
}

.progress-mini {
  min-width: 150px;
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 42px;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  color: var(--blue);
}

.readiness-tabs {
  margin: 0;
  border-width: 0 0 1px;
  border-radius: 0;
  background: var(--panel);
}

.readiness-row-completed {
  background: #f0fdf4;
  box-shadow: inset 4px 0 0 var(--green);
}

.readiness-row-completed td {
  border-bottom-color: #bbf7d0;
}

.readiness-row-partial {
  background: #f8fbff;
}

.readiness-row-warning {
  background: #fff7f7;
}

.readiness-progress-cell {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.readiness-progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.readiness-progress-meta strong {
  color: var(--muted);
  font-size: 14px;
}

.readiness-progress-cell.complete .readiness-progress-meta strong {
  color: var(--green);
  font-size: 17px;
}

.readiness-progress-cell.partial .readiness-progress-meta strong {
  color: var(--blue);
}

.readiness-progress-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.readiness-progress-cell.complete .readiness-progress-meta span {
  color: var(--green);
}

.readiness-progress-bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8f0ed;
}

.readiness-progress-cell.complete .readiness-progress-bar {
  height: 12px;
  background: #bbf7d0;
  box-shadow: inset 0 0 0 1px rgba(22, 163, 74, .18);
}

.readiness-progress-cell.partial .readiness-progress-bar {
  background: #dbeafe;
}

.readiness-progress-bar i,
.readiness-progress-bar b {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
}

.readiness-progress-bar i {
  background: #bfd7ff;
}

.readiness-progress-bar b {
  background: var(--blue);
}

.readiness-progress-cell.complete .readiness-progress-bar b {
  background: linear-gradient(90deg, #16a34a, #22c55e);
}

.readiness-progress-done {
  justify-self: start;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.trace-panel {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 14px;
}

.trace-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.trace-metric {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.trace-metric span,
.trace-section h4 {
  color: var(--muted);
  font-weight: 900;
}

.trace-metric strong {
  color: var(--primary-strong);
  font-size: 18px;
}

.trace-section {
  display: grid;
  gap: 8px;
}

.trace-section h4 {
  margin: 0;
}

.trace-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trace-table table {
  min-width: 920px;
}

.hidden {
  display: none !important;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(320px, .85fr) minmax(480px, 1.15fr);
  gap: 16px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text);
}

.role-grid {
  display: grid;
  gap: 14px;
}

.role-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.role-head,
.role-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.role-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.role-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.check-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.account-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
  color: var(--text);
}

.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  flex: 0 0 18px;
}

.account-role-item {
  justify-content: flex-start;
  overflow: hidden;
}

.account-role-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.toast {
  position: fixed;
  z-index: 80;
  right: 16px;
  bottom: 16px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 8px;
  background: #0c2630;
  color: #fff;
  box-shadow: var(--shadow);
  font-weight: 900;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pending-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .movement-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
  }

  .app.sidebar-collapsed {
    --sidebar-width: 100%;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    grid-template-rows: auto auto auto;
  }

  .app.sidebar-collapsed .sidebar:hover {
    width: 100%;
    box-shadow: none;
  }

  .app.sidebar-collapsed .sidebar:not(:hover) .brand-row > div:not(.brand-mark),
  .app.sidebar-collapsed .sidebar:not(:hover) .nav button,
  .app.sidebar-collapsed .sidebar:not(:hover) .nav-group summary,
  .app.sidebar-collapsed .sidebar:not(:hover) #logoutBtn {
    font-size: inherit;
  }

  .app.sidebar-collapsed .sidebar:not(:hover) .sidebar-toggle {
    position: static;
    width: 32px;
    height: 32px;
  }

  .app.sidebar-collapsed .sidebar:not(:hover) .nav {
    justify-items: stretch;
  }

  .app.sidebar-collapsed .sidebar:not(:hover) .nav button,
  .app.sidebar-collapsed .sidebar:not(:hover) .nav-group summary,
  .app.sidebar-collapsed .sidebar:not(:hover) #logoutBtn {
    width: auto;
    min-width: 0;
    justify-content: flex-start;
    padding: 0 12px;
  }

  .app.sidebar-collapsed .sidebar:not(:hover) .nav-group summary::after {
    display: block;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-group {
    align-content: start;
  }

  .topbar,
  .toolbar {
    display: grid;
  }

  .top-actions,
  .inline-actions {
    justify-content: stretch;
  }

  .search {
    width: 100%;
  }

  .zoom-control {
    width: 100%;
    justify-content: space-between;
  }

  .metric-grid,
  .trace-summary,
  .form-grid,
  .split-grid,
  .check-grid,
  .check-grid.compact,
  .inbound-line,
  .outbound-line,
  .outbound-batch-head,
  .outbound-selected-line,
	  .bom-select-filters,
	  .pending-filters,
	  .movement-filters,
	  .movement-detail-grid,
	  .bom-select-body {
	    grid-template-columns: 1fr;
	  }

  .bom-material-dialog {
    padding: 10px;
  }

  .bom-material-card {
    height: calc(100vh - 20px);
  }

  .bom-select-transfer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
