:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #1d232a;
  --muted: #68717c;
  --line: #d8dde3;
  --head: #25364a;
  --ok: #1f7a4d;
  --warn: #a15c08;
  --attention: #8c2f39;
  --focus: #2f6fed;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 760px;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 14px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  background: var(--head);
  color: #fff;
  border-bottom: 1px solid #172335;
}

.topbarBrand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  white-space: nowrap;
}

.menuIconButton {
  display: inline-grid;
  gap: 4px;
  width: 38px;
  min-width: 38px;
  min-height: 36px;
  padding: 8px 9px;
}

.menuIconButton span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.topbarActions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbarActions .actionButton,
.topbarActions button {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  line-height: 1;
}

.sessionUser {
  max-width: 180px;
  overflow: hidden;
  color: #d7dee8;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sideMenuBackdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgb(23 35 53 / 28%);
}

.sideMenu {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 21;
  width: 320px;
  max-width: calc(100vw - 48px);
  overflow: auto;
  background: #fff;
  border-right: 1px solid var(--line);
  box-shadow: 16px 0 32px rgb(29 35 42 / 18%);
}

.sideMenuHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 14px 16px;
  background: var(--head);
  color: #fff;
}

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

.sideMenuCloseButton {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.sideMenuNav {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.sideMenuSection {
  display: grid;
  gap: 8px;
}

.sideMenuSection h2 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.sideMenuLink {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  color: var(--head);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  font-weight: 700;
  text-decoration: none;
}

.sideMenuLink:hover,
.sideMenuLink[data-active="true"] {
  border-color: var(--focus);
  background: #edf3ff;
}

button,
select,
input {
  font: inherit;
}

button,
.actionButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #91a1b7;
  border-radius: 6px;
  background: #fff;
  color: var(--head);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.actionButton:hover {
  background: #edf3ff;
}

main {
  padding: 18px 24px 28px;
}

.loginView {
  display: grid;
  min-height: calc(100vh - 118px);
  place-items: center;
}

.loginPanel {
  display: grid;
  gap: 12px;
  width: min(360px, 100%);
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.loginPanel h2 {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.25;
}

.loginPanel input,
.loginPanel button {
  width: 100%;
}

.loginPanel p {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.loginPanel p[data-tone="error"] {
  color: var(--attention);
}

.accountPanel,
.rolesPanel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rolesPanel {
  grid-template-columns: 1fr;
}

.accountPanel h2,
.rolesPanel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.25;
}

.accountFields {
  display: grid;
  gap: 10px;
  margin: 0;
}

.accountFields dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.accountFields dd {
  margin: 0;
  font-weight: 700;
}

.accountPasswordForm,
.passwordResetForm {
  display: grid;
  gap: 10px;
}

.accountPasswordForm input,
.passwordResetForm input {
  width: 100%;
}

.formActions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.formActions span,
.rolesPanel p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.formActions span[data-tone="ok"],
.rolesPanel p[data-tone="ok"] {
  color: var(--ok);
}

.formActions span[data-tone="error"],
.rolesPanel p[data-tone="error"] {
  color: var(--attention);
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.metric strong {
  font-size: 24px;
  line-height: 1;
}

.metric.ok strong {
  color: var(--ok);
}

.metric.warn strong {
  color: var(--warn);
}

.metric.attention strong {
  color: var(--attention);
}

.controls {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

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

.filterRowTitle {
  display: inline-flex;
  align-items: center;
  min-width: 150px;
  min-height: 36px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.filterRowDate label {
  min-width: 230px;
}

.statusComboLabel {
  min-width: 360px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.controls label,
.manualFilters label,
.reportControls label,
.paginationControls .pageSizeLabel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

select,
input {
  height: 36px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.search input {
  width: 360px;
}

.quickFilters {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.quickDateFilter {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border-color: var(--line);
  white-space: nowrap;
}

.quickDateFilter[data-active="true"] {
  border-color: var(--focus);
  background: #dfeaff;
  color: #183a70;
}

.toggleGroup {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.toggleOption {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.toggleOption + .toggleOption {
  border-left: 1px solid var(--line);
}

.toggleOption[data-active="true"] {
  background: #dfeaff;
  color: #183a70;
}

.activeFiltersBar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin: -4px 0 14px;
  padding: 7px 10px;
  overflow-x: auto;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.activeFiltersTitle {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  white-space: nowrap;
}

.activeFilterChips {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
}

.activeFilterChip,
.clearAllFiltersButton {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 9px;
  border-color: #b8c3d1;
  font-size: 12px;
  white-space: nowrap;
}

.activeFilterChip {
  gap: 7px;
  background: #fff;
}

.activeFilterChipRemove {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.clearAllFiltersButton {
  color: #8c2f39;
}

.multiSelect {
  position: relative;
}

.multiSelectButton {
  justify-content: space-between;
  width: 240px;
  min-height: 36px;
  padding: 0 10px;
  border-color: var(--line);
  font-weight: 650;
}

.multiSelectButton::after {
  content: "▼";
  margin-left: 12px;
  color: var(--muted);
  font-size: 10px;
}

.multiSelectButton[aria-expanded="true"]::after {
  content: "▲";
}

.multiSelectMenu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 5;
  width: 280px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgb(29 35 42 / 16%);
}

.multiSelectOptions {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
}

.multiSelectOption {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-transform: none;
}

.multiSelectOption:hover {
  background: #edf3ff;
}

.multiSelectOption input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
}

.multiSelectEmpty {
  padding: 8px 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.multiSelectClear {
  width: 100%;
  min-height: 30px;
  margin-top: 8px;
  padding: 0 10px;
}

select:focus,
input:focus,
button:focus,
.actionButton:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.tableShell {
  overflow: visible;
  max-height: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.paginationControls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.pageSizeLabel {
  align-items: center;
  text-transform: uppercase;
}

.pageSizeLabel select {
  min-width: 150px;
}

.paginationSummary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.paginationNav,
.paginationPages {
  display: flex;
  align-items: center;
  gap: 6px;
}

.paginationNav button,
.pageNumberButton {
  min-height: 32px;
  padding: 0 10px;
}

.pageNumberButton {
  min-width: 32px;
}

.pageNumberButton[data-active="true"] {
  border-color: var(--focus);
  background: #dfeaff;
  color: #183a70;
}

.paginationEllipsis {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.reportToolbar #reportExportButton {
  margin-left: auto;
  border-color: var(--head);
  background: var(--head);
  color: #fff;
}

.reportToolbar #reportExportButton:hover {
  background: #334a63;
}

.reportControls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.reportPrintArea {
  display: grid;
  gap: 14px;
}

.reportScreenContent {
  display: grid;
  gap: 14px;
}

.reportHeader {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.reportHeader h2 {
  margin: 0;
  font-size: 18px;
}

.reportHeader p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reportFooter {
  display: flex;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.reportTableShell th,
.reportTableShell td {
  max-width: none;
}

.reportView[data-report-type="materialScale"] .reportTableShell th,
.reportView[data-report-type="materialScale"] .reportTableShell td {
  min-width: 82px;
  padding: 7px 8px;
}

.reportView[data-report-type="materialScale"] .reportTableShell .reportJrtiOrderCell {
  min-width: 110px;
}

.reportView[data-report-type="materialScale"] .reportTableShell .reportProductCell {
  min-width: 180px;
}

.reportView[data-report-type="materialScale"] .reportTableShell .reportColorCell {
  min-width: 150px;
}

.reportView[data-report-type="materialScale"] .reportTableShell .materialStatusCell {
  min-width: 120px;
  width: 120px;
  text-align: center;
}

.reportView[data-report-type="materialScale"] .reportTableShell .reportActionCell {
  min-width: 74px;
  width: 74px;
  text-align: center;
}

.reportView[data-report-type="expedition"] .reportTableShell th,
.reportView[data-report-type="expedition"] .reportTableShell td {
  min-width: 82px;
  padding: 7px 8px;
}

.reportView[data-report-type="expedition"] .reportTableShell .reportProductCell {
  min-width: 170px;
}

.reportView[data-report-type="expedition"] .reportTableShell .reportColorCell {
  min-width: 130px;
}

.reportView[data-report-type="expedition"] .reportTableShell .reportActionCell {
  min-width: 74px;
  width: 74px;
  text-align: center;
}

.materialStatusCell {
  text-align: center;
}

.reportPrintPages {
  display: none;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  min-width: 120px;
  max-width: 260px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e9edf3;
  color: #263342;
  font-size: 12px;
  text-transform: uppercase;
}

.sortHeader,
.manualSortHeader,
.shortageSortHeader {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 750;
  text-align: left;
  text-transform: inherit;
}

.sortHeader:hover,
.manualSortHeader:hover,
.shortageSortHeader:hover {
  background: transparent;
  color: var(--focus);
}

.sortHeader::after,
.manualSortHeader::after,
.shortageSortHeader::after {
  content: "";
  color: var(--muted);
  font-size: 11px;
}

.sortHeader[data-active="true"][data-direction="asc"]::after,
.manualSortHeader[data-active="true"][data-direction="asc"]::after,
.shortageSortHeader[data-active="true"][data-direction="asc"]::after {
  content: "▲";
}

.sortHeader[data-active="true"][data-direction="desc"]::after,
.manualSortHeader[data-active="true"][data-direction="desc"]::after,
.shortageSortHeader[data-active="true"][data-direction="desc"]::after {
  content: "▼";
}

td {
  background: #fff;
}

tr.unmatched td,
tr.magento_only td {
  background: #fff7ea;
}

tr.ambiguous td {
  background: #fff0f2;
}

tr.hasShortages td {
  background: #ffe3e6;
}

tr.hasShortages td:first-child {
  box-shadow: inset 4px 0 0 #c52233;
}

.actionHeader,
.actionCell {
  min-width: 88px;
  max-width: 88px;
  text-align: center;
}

.actionButton {
  min-height: 28px;
  padding: 0 10px;
}

.shortageButton {
  min-height: 28px;
  padding: 0 10px;
}

.productionHistoryButton {
  min-height: 28px;
  padding: 0 10px;
}

.shortageFormRow td {
  max-width: none;
  padding: 10px;
  background: #f5f9ff;
}

.shortageForm {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(240px, 1.6fr) minmax(120px, 0.7fr) minmax(150px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
}

.shortageField {
  min-width: 0;
  text-transform: uppercase;
}

.shortageField input {
  width: 100%;
  min-width: 0;
}

.shortageFormActions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.shortageFormActions button {
  min-height: 32px;
  padding: 0 10px;
}

.shortageFormStatus {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.shortageFormStatus[data-tone="ok"] {
  color: var(--ok);
}

.shortageFormStatus[data-tone="error"] {
  color: var(--attention);
}

.shortageListRow td {
  max-width: none;
  padding: 10px;
  background: #fffaf0;
}

.shortageListRow.shortageReceived td {
  background: #f0fbf5;
}

.shortageList {
  display: grid;
  gap: 8px;
}

.shortageList strong {
  color: var(--warn);
  font-size: 12px;
  text-transform: uppercase;
}

.shortageListTable {
  width: auto;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
}

.shortageListTable th,
.shortageListTable td {
  min-width: 120px;
  max-width: 360px;
  padding: 7px 8px;
  background: #fff;
}

.shortageListTable tr.shortageReceived td {
  background: #f0fbf5;
}

.shortageListTable tr.shortageOpen td {
  background: #fffaf0;
}

.shortageListTable th {
  position: static;
  background: #f2e8d2;
}

.productionHistoryRow td {
  max-width: none;
  padding: 10px 10px 12px 28px;
  background: #f5f9ff;
}

.productionHistory {
  display: grid;
  gap: 8px;
}

.productionHistory strong {
  color: #25527a;
  font-size: 12px;
  text-transform: uppercase;
}

.productionHistoryTable {
  width: auto;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0;
}

.productionHistoryTable th,
.productionHistoryTable td {
  min-width: 130px;
  max-width: 420px;
  padding: 7px 8px;
  background: #fff;
}

.productionHistoryTable th {
  position: static;
  background: #e1edf8;
}

.detailToolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.dangerButton {
  border-color: #b42318;
  color: #b42318;
  background: #fff7f5;
}

.dangerButton:hover {
  background: #fee4df;
}

.toolbarStatus {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toolbarStatus[data-tone="ok"] {
  color: var(--ok);
}

.toolbarStatus[data-tone="error"] {
  color: var(--attention);
}

.detailHeader {
  margin-bottom: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detailHeader h2 {
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.25;
}

.detailFields {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px 18px;
  margin: 0;
}

.detailFields .wide {
  grid-column: span 2;
}

.detailFields dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.detailFields dd {
  margin: 0;
  font-weight: 700;
}

.statusControl dd,
.dispatchDeadlineControl dd {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.statusControl select {
  min-width: 220px;
}

.dispatchDeadlineControl input {
  min-width: 150px;
}

.statusControl button,
.dispatchDeadlineControl button {
  min-height: 32px;
  padding: 0 12px;
}

.statusControl span,
.dispatchDeadlineControl span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.statusControl span[data-tone="ok"],
.dispatchDeadlineControl span[data-tone="ok"] {
  color: var(--ok);
}

.statusControl span[data-tone="error"],
.dispatchDeadlineControl span[data-tone="error"] {
  color: var(--attention);
}

.detailItems {
  max-height: calc(100vh - 300px);
}

.shortagesTable {
  max-height: calc(100vh - 220px);
}

.shortageTreeRow {
  cursor: pointer;
}

.shortageTreeRow.shortageReceived td {
  background: #f0fbf5;
}

.shortageTreeRow:hover td,
.shortageTreeRow:focus td {
  background: #edf3ff;
}

.shortageTreeRow:focus {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.treeMarker {
  display: inline-block;
  width: 18px;
  color: var(--muted);
  font-size: 11px;
}

.shortageTreeDetailRow td {
  max-width: none;
  padding: 10px 10px 12px 28px;
  background: #fffaf0;
}

.shortageTreeDetailRow.shortageReceived td {
  background: #f0fbf5;
}

.shortageTreeDetailTable {
  width: auto;
  min-width: 700px;
  border-collapse: separate;
  border-spacing: 0;
}

.shortageTreeDetailTable th,
.shortageTreeDetailTable td {
  min-width: 130px;
  max-width: 420px;
  padding: 7px 8px;
  background: #fff;
}

.shortageTreeDetailTable tr.shortageReceived td {
  background: #f0fbf5;
}

.shortageTreeDetailTable tr.shortageOpen td {
  background: #fffaf0;
}

.shortageReceiptCell {
  min-width: 260px;
  max-width: 360px;
}

.shortageReceiptControl,
.shortageReceiptSummary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.shortageReceiptControl {
  flex-wrap: wrap;
}

.shortageReceiptControl input {
  width: 132px;
  min-width: 132px;
}

.shortageReceiptControl button {
  min-height: 30px;
  padding: 0 10px;
}

.shortageReceiptStatus {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.shortageReceiptStatus[data-tone="error"] {
  color: var(--attention);
}

.shortageReceiptBadge.open {
  background: #fff0d8;
  color: var(--warn);
}

.shortageReceiptBadge.received {
  background: #e4f3eb;
  color: var(--ok);
}

.shortageReceiptDate {
  color: var(--ok);
  font-weight: 750;
}

.shortageTreeDetailTable th {
  position: static;
  background: #f2e8d2;
}

.manualPanel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.usersPanel {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(560px, 1.6fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.usersPanel h2,
.rolePanel h3 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.25;
}

.usersPanel p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
}

.usersPanel p[data-tone="ok"] {
  color: var(--ok);
}

.usersPanel p[data-tone="error"] {
  color: var(--attention);
}

.userCreateForm {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(220px, 1.2fr) minmax(160px, 1fr) minmax(130px, 0.7fr) auto;
  gap: 10px;
  align-items: end;
}

.userCreateForm input,
.userCreateForm select {
  width: 100%;
  min-width: 0;
}

.usersTable {
  max-height: calc(100vh - 330px);
}

.passwordResetRow td {
  max-width: none;
  padding: 10px;
  background: #f5f9ff;
}

.passwordResetForm {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: end;
}

.userActions {
  display: flex;
  gap: 8px;
}

.userActions button {
  min-height: 30px;
  padding: 0 10px;
}

.rolePanel {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rolePermissionsList {
  display: grid;
  gap: 10px;
}

.rolePermissionsItem {
  display: grid;
  gap: 5px;
}

.rolePermissionsItem strong {
  text-transform: uppercase;
}

.rolePermissionsItem span {
  color: var(--muted);
  line-height: 1.35;
}

.rolesList {
  display: grid;
  gap: 14px;
}

.roleEditor {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.roleEditorHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.roleEditorHeader h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.permissionGroups {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.permissionGroup {
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.permissionGroup strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.permissionOption {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-transform: none;
}

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

.roleEditorStatus {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.roleEditorStatus[data-tone="ok"] {
  color: var(--ok);
}

.roleEditorStatus[data-tone="error"] {
  color: var(--attention);
}

.manualPanel h2 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.25;
}

.manualPanel p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
}

.manualPanel p[data-tone="ok"] {
  color: var(--ok);
}

.manualPanel p[data-tone="error"] {
  color: var(--attention);
}

.manualFilters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.2fr);
  gap: 12px;
  margin-bottom: 14px;
}

.manualFilters input {
  width: 100%;
}

.manualGrid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(560px, 1.4fr);
  gap: 14px;
  align-items: start;
}

.manualColumn {
  min-width: 0;
}

.manualColumnHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 0 2px;
}

.manualColumnHeader h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.manualColumnHeader strong {
  color: var(--head);
  font-size: 18px;
}

.manualTable {
  max-height: calc(100vh - 300px);
}

.manualTable tr {
  cursor: pointer;
}

.manualTable tr.selectedRow td {
  background: #edf3ff;
}

.selectHeader,
.selectCell {
  min-width: 56px;
  max-width: 56px;
  text-align: center;
}

.selectCell input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
}

.manualNameCell {
  min-width: 180px;
  max-width: 260px;
  white-space: normal;
}

.manualProductCell {
  min-width: 160px;
  max-width: 260px;
  white-space: normal;
}

.manualPostoCell {
  min-width: 150px;
  max-width: 240px;
  white-space: normal;
}

.importPanel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(340px, 1.4fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.importPanel h2 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.25;
}

.importPanel p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
}

.importPanel p[data-tone="ok"] {
  color: var(--ok);
}

.importPanel p[data-tone="attention"] {
  color: var(--attention);
}

.importPanel p[data-tone="error"] {
  color: var(--attention);
}

.dropZone {
  display: grid;
  grid-template-columns: minmax(130px, auto) minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px dashed #91a1b7;
  border-radius: 8px;
  background: #fbfcfe;
}

.dropZone.dragActive {
  border-color: var(--focus);
  background: #edf3ff;
}

.dropZone strong {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
}

.dropZone span {
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropZone input {
  min-width: 190px;
}

.importActions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 10px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.importSummary {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.importTable {
  max-height: calc(100vh - 340px);
}

.changesCell {
  min-width: 360px;
  max-width: 720px;
  line-height: 1.35;
  white-space: normal;
}

tr.import-new td {
  background: #f0fbf5;
}

tr.import-existing td {
  background: #f7f8fa;
}

tr.import-changed td {
  background: #fff0f2;
}

tr.import-unmatched td {
  background: #fff7ea;
}

.badge.importBadge.new {
  background: #e4f3eb;
  color: var(--ok);
}

.badge.importBadge.changed {
  background: #ffe3e6;
  color: var(--attention);
}

.badge.importBadge.unchanged {
  background: #edf0f4;
  color: var(--muted);
}

.badge.importBadge.existing {
  background: #edf0f4;
  color: var(--muted);
}

.badge.importBadge.unmatched {
  background: #fff0d8;
  color: var(--warn);
}

.quantityCell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.materialEscalationCell {
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.badge.matched {
  background: #e4f3eb;
  color: var(--ok);
}

.badge.unmatched {
  background: #fff0d8;
  color: var(--warn);
}

.badge.ambiguous {
  background: #ffe3e6;
  color: var(--attention);
}

.materialEscalationBadge.ok {
  background: #e4f3eb;
  color: var(--ok);
}

.materialEscalationBadge.pending {
  background: #fff0d8;
  color: var(--warn);
}

.empty {
  color: var(--muted);
  text-align: center;
}

@page {
  size: A4 portrait;
  margin: 12mm;
}

@media print {
  body.reportPrintMode {
    min-width: 0;
    background: #fff;
    color: #000;
    font-size: 10px;
  }

  body.reportPrintMode .topbar,
  body.reportPrintMode .sideMenu,
  body.reportPrintMode .sideMenuBackdrop,
  body.reportPrintMode main > *:not(#reportView),
  body.reportPrintMode .reportToolbar,
  body.reportPrintMode .reportControls,
  body.reportPrintMode .reportScreenContent {
    display: none !important;
  }

  body.reportPrintMode main {
    padding: 0;
  }

  body.reportPrintMode #reportView,
  body.reportPrintMode .reportPrintArea,
  body.reportPrintMode .reportPrintPages {
    display: block !important;
  }

  body.reportPrintMode .reportPrintPage {
    position: relative;
    height: 273mm;
    overflow: hidden;
    padding-bottom: 12mm;
    break-after: page;
    page-break-after: always;
  }

  body.reportPrintMode .reportPrintPage[data-report-type="materialScale"] {
    height: 186mm;
  }

  body.reportPrintMode .reportPrintPage:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  body.reportPrintMode .reportPrintPageHeader {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8mm;
    margin-bottom: 5mm;
    padding-bottom: 3mm;
    border-bottom: 0.3mm solid #000;
  }

  body.reportPrintMode .reportPrintPageHeader h2 {
    margin: 0;
    font-size: 15px;
    line-height: 1.2;
  }

  body.reportPrintMode .reportPrintPageHeader span {
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
  }

  body.reportPrintMode .reportPrintTableWrap {
    width: 100%;
  }

  body.reportPrintMode table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
  }

  body.reportPrintMode th,
  body.reportPrintMode td {
    min-width: 0;
    max-width: none;
    padding: 2.2mm 2mm;
    border: 0.25mm solid #888;
    background: #fff !important;
    color: #000;
    font-size: 9px;
    line-height: 1.2;
    white-space: normal;
  }

  body.reportPrintMode th {
    position: static;
    background: #e8e8e8 !important;
    color: #000;
    font-size: 8.5px;
    text-transform: uppercase;
  }

  body.reportPrintMode tr.hasShortages td {
    background: #ffe3e6 !important;
  }

  body.reportPrintMode tr.hasShortages td:first-child {
    border-left: 1.2mm solid #c52233;
  }

  body.reportPrintMode td.quantityCell {
    text-align: right;
  }

  body.reportPrintMode .materialEscalationCell {
    text-align: center;
  }

  body.reportPrintMode .materialEscalationBadge.ok {
    background: #e4f3eb !important;
    color: #176b3a !important;
  }

  body.reportPrintMode .materialEscalationBadge.pending {
    background: #fff0d8 !important;
    color: #7a5400 !important;
  }

  body.reportPrintMode .reportMaterialScaleTable {
    table-layout: fixed;
  }

  body.reportPrintMode .reportMaterialScaleTable th,
  body.reportPrintMode .reportMaterialScaleTable td {
    padding: 1.45mm 0.9mm;
    font-size: 7px;
    line-height: 1.12;
  }

  body.reportPrintMode .reportMaterialScaleTable th {
    font-size: 6.6px;
  }

  body.reportPrintMode .reportMaterialScaleTable .reportJrtiOrderCell {
    width: 8%;
  }

  body.reportPrintMode .reportMaterialScaleTable .reportProductCell {
    width: 19%;
  }

  body.reportPrintMode .reportMaterialScaleTable .reportFichaCell {
    width: 6%;
  }

  body.reportPrintMode .reportMaterialScaleTable .reportSkuCell {
    width: 9%;
  }

  body.reportPrintMode .reportMaterialScaleTable .reportColorCell {
    width: 12%;
  }

  body.reportPrintMode .reportMaterialScaleTable .reportSizeCell,
  body.reportPrintMode .reportMaterialScaleTable .quantityCell {
    width: 6%;
  }

  body.reportPrintMode .reportMaterialScaleTable .materialStatusCell {
    width: 7.5%;
  }

  body.reportPrintMode .reportMaterialScaleTable .reportActionCell {
    width: 4%;
  }

  body.reportPrintMode .reportMaterialScaleTable .reportActionCell .actionButton {
    min-height: 16px;
    padding: 0 3px;
    font-size: 6.4px;
  }

  body.reportPrintMode .reportMaterialScaleTable .badge {
    height: 16px;
    padding: 0 3px;
    font-size: 6.4px;
  }

  body.reportPrintMode .reportExpeditionTable {
    table-layout: fixed;
  }

  body.reportPrintMode .reportExpeditionTable th,
  body.reportPrintMode .reportExpeditionTable td {
    padding: 1.55mm 1mm;
    font-size: 7.2px;
    line-height: 1.12;
  }

  body.reportPrintMode .reportExpeditionTable th {
    font-size: 6.8px;
  }

  body.reportPrintMode .reportExpeditionTable .reportJrtiOrderCell,
  body.reportPrintMode .reportExpeditionTable .reportFichaCell,
  body.reportPrintMode .reportExpeditionTable .reportSizeCell,
  body.reportPrintMode .reportExpeditionTable .quantityCell {
    width: 7%;
  }

  body.reportPrintMode .reportExpeditionTable .reportSkuCell {
    width: 10%;
  }

  body.reportPrintMode .reportExpeditionTable .reportProductCell {
    width: 18%;
  }

  body.reportPrintMode .reportExpeditionTable .reportColorCell {
    width: 12%;
  }

  body.reportPrintMode .reportExpeditionTable .reportActionCell {
    width: 4%;
  }

  body.reportPrintMode .reportExpeditionTable .reportActionCell .actionButton {
    min-height: 16px;
    padding: 0 3px;
    font-size: 6.4px;
  }

  body.reportPrintMode .reportPrintPageFooter {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding-top: 3mm;
    border-top: 0.25mm solid #000;
    font-size: 9px;
    font-weight: 700;
    text-align: right;
  }
}
