* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #e8edf5;
  --text: #172033;
  --muted: #7c879d;
  --primary: #4475f2;
  --primary-soft: #edf3ff;
  --green: #2fbf71;
  --green-soft: #e9f9f0;
  --amber: #f3a633;
  --amber-soft: #fff6df;
  --violet: #7a66f2;
  --violet-soft: #f2efff;
  --red: #e65757;
  --red-soft: #ffeded;
  --sidebar: #11192b;
  --sidebar-2: #18233a;
  --shadow: 0 10px 28px rgba(27, 39, 68, 0.06);
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button, input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 252px;
  min-width: 252px;
  background: linear-gradient(180deg, #11192b 0%, #121c31 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
}

.brand {
  height: 78px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #5d8cff, #3f6ce4);
  font-size: 12px;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.brand .brand-customer-code {
  display: block;
  max-width: 158px;
  margin-top: 4px;
  overflow: hidden;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-menu {
  padding: 18px 12px;
  overflow-y: auto;
  flex: 1;
}

.nav-title {
  color: #5f6e8c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  margin: 18px 12px 8px;
}

.nav-title:first-child {
  margin-top: 2px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  background: transparent;
  color: #9ba8c1;
  border-radius: 10px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  transition: .18s ease;
  margin-bottom: 3px;
}

.nav-item:hover {
  background: rgba(255,255,255,.05);
  color: #fff;
}

.nav-item.active {
  background: #244277;
  color: #fff;
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 17px;
}

.nav-item .badge {
  margin-left: auto;
  font-size: 10px;
  background: rgba(255,255,255,.12);
  color: #c9d6ee;
  padding: 3px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  padding: 14px;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3bd47d;
  box-shadow: 0 0 0 4px rgba(59,212,125,.12);
}

.status-dot.offline {
  background: #d95a5a;
  box-shadow: 0 0 0 4px rgba(217,90,90,.12);
}

.server-status strong,
.server-status small {
  display: block;
}

.server-status strong {
  font-size: 12px;
}

.server-status small {
  color: #7f8da8;
  font-size: 10px;
  margin-top: 3px;
}

.main {
  width: calc(100% - 252px);
  margin-left: 252px;
}

.topbar {
  min-height: 78px;
  background: rgba(255,255,255,.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 15;
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h1 {
  font-size: 20px;
  line-height: 1.2;
}

.topbar p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.global-search {
  width: 340px;
  height: 42px;
  border: 1px solid var(--line);
  background: #f8fafd;
  border-radius: 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  color: #8e99ad;
}

.global-search input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 12px;
}

.global-search kbd {
  font-size: 9px;
  background: #fff;
  border: 1px solid #dce3ee;
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 3px 5px;
  color: #8a95a9;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: #5b6680;
  display: grid;
  place-items: center;
  position: relative;
}

.notification .notify-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef5b5b;
  position: absolute;
  right: 8px;
  top: 7px;
  border: 2px solid #fff;
}

.profile {
  min-width: 175px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #eaf0ff;
  color: #355fc9;
  font-size: 11px;
  font-weight: 700;
}

.profile-text strong,
.profile-text span {
  display: block;
}

.profile-text strong {
  font-size: 12px;
}

.profile-text span {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.chevron {
  margin-left: auto;
  color: #8e99ad;
}

.content {
  padding: 28px 28px 58px;
  max-width: 1600px;
  margin: 0 auto;
}

.welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.welcome-row h2 {
  font-size: 24px;
  margin-bottom: 7px;
}

.welcome-row p {
  color: var(--muted);
  font-size: 13px;
}

.date-filter {
  display: flex;
  gap: 10px;
}

.primary-btn,
.secondary-btn {
  height: 40px;
  border-radius: 10px;
  padding: 0 15px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(68,117,242,.22);
}

.primary-btn:hover {
  background: #3769e5;
}

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

.danger-btn {
  height: 40px;
  border: 1px solid #dc2626;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  padding: 0 15px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.danger-btn:disabled {
  cursor: not-allowed;
  border-color: #fecaca;
  background: #fee2e2;
  color: #991b1b;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 19px;
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 116px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
}

.stat-icon.blue {
  color: #4475f2;
  background: var(--primary-soft);
}

.stat-icon.green {
  color: #25a962;
  background: var(--green-soft);
}

.stat-icon.amber {
  color: #e59823;
  background: var(--amber-soft);
}

.stat-icon.violet {
  color: #7159e9;
  background: var(--violet-soft);
}

.stat-info span {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.stat-info strong {
  display: block;
  font-size: 25px;
  margin: 5px 0;
  letter-spacing: -.02em;
}

.stat-info small {
  font-size: 10px;
  color: #99a3b6;
}

.stat-info .positive {
  color: #28a765;
}

.stat-info .warning {
  color: #de8c1a;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(330px, .9fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.panel-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #eef2f7;
}

.panel-header h3 {
  font-size: 14px;
  margin-bottom: 5px;
}

.panel-header p {
  font-size: 10px;
  color: var(--muted);
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #79859a;
  font-size: 10px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.inbound {
  background: #4475f2;
}

.legend-dot.outbound {
  background: #ff8a45;
}

.chart-wrap {
  height: 292px;
  padding: 20px 22px 22px 16px;
  display: flex;
  gap: 12px;
}

.chart-y {
  width: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 21px;
  color: #a4adbd;
  font-size: 9px;
  text-align: right;
}

.chart {
  flex: 1;
  position: relative;
  height: 100%;
}

.grid-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #edf1f6;
}

.chart svg {
  position: absolute;
  inset: 0 0 20px;
  width: 100%;
  height: calc(100% - 20px);
  overflow: visible;
}

.chart-x {
  height: 20px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  color: #9ca6b8;
  font-size: 9px;
}

.text-btn {
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.alert-list {
  padding: 5px 18px 10px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 2px;
  border-bottom: 1px solid #f0f3f7;
}

.alert-item:last-child {
  border-bottom: none;
}

.material-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #f1f4fa;
  color: #667187;
  font-size: 10px;
  font-weight: 700;
  flex: 0 0 auto;
}

.alert-info {
  min-width: 0;
  flex: 1;
}

.alert-info strong {
  display: block;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-info span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-qty {
  text-align: right;
}

.alert-qty strong {
  font-size: 12px;
  color: var(--red);
}

.alert-qty span {
  font-size: 9px;
  color: #9ba4b4;
}

.table-panel {
  overflow: hidden;
}

.table-header {
  gap: 20px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.table-actions .secondary-btn {
  height: 34px;
}

.table-scroll {
  overflow-x: auto;
  scrollbar-width: none;
}

.table-scroll::-webkit-scrollbar {
  height: 0;
}

.floating-table-scrollbar {
  position: fixed;
  left: 296px;
  right: 24px;
  bottom: 12px;
  z-index: 70;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #dbe4f4;
  border-radius: 10px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 12px 28px rgba(37, 51, 79, .14);
}

.floating-table-scrollbar[hidden] {
  display: none;
}

#floatingTableScrollbarInner {
  height: 1px;
}

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

.spreadsheet-table {
  table-layout: auto;
}

.spreadsheet-table th,
.spreadsheet-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

thead th {
  position: relative;
  padding: 12px 18px;
  text-align: left;
  background: #f9fbfd;
  color: #5f6b82;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #dfe7f3;
  white-space: nowrap;
}

tbody td {
  padding: 15px 18px;
  font-size: 10px;
  color: #5f6a80;
  border-bottom: 1px solid #f0f3f7;
  border-right: 1px solid #edf2f8;
  vertical-align: middle;
  white-space: nowrap;
}

thead th:last-child,
tbody td:last-child {
  border-right: 0;
}

.table-th-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.table-th-label {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
  font-weight: 900;
}

.table-filter-btn {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid #d4deec;
  border-radius: 4px;
  background: #fff;
  color: #6d7890;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.table-filter-btn-floating {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
}

th.is-filtered .table-filter-btn {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef4ff;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 3;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}

.column-resizer:hover {
  background: rgba(65, 111, 244, .22);
}

.is-resizing-column {
  cursor: col-resize;
  user-select: none;
}

.table-filter-menu {
  position: fixed;
  z-index: 260;
  max-height: min(620px, calc(100vh - 24px));
  overflow: auto;
  padding: 12px;
  border: 1px solid #dbe4f4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(22, 34, 58, .18);
}

.table-filter-title {
  color: #101b33;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 10px;
}

.table-filter-section {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f8;
}

.table-filter-sort {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: #344054;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
}

.table-filter-sort:hover,
.filter-value-row:hover {
  background: #f4f7fc;
}

.table-filter-search,
.condition-grid label {
  display: grid;
  gap: 6px;
}

.table-filter-search {
  margin: 10px 0;
}

.table-filter-menu span,
.table-filter-search span,
.condition-grid span {
  color: #667187;
  font-size: 10px;
  font-weight: 800;
}

.table-filter-menu input,
.table-filter-menu select {
  width: 100%;
  height: 34px;
  border: 1px solid #dbe4f4;
  border-radius: 7px;
  padding: 0 10px;
  color: #101b33;
  font-size: 11px;
  background: #fff;
}

.table-filter-values {
  border: 1px solid #edf2f8;
  border-radius: 8px;
  overflow: hidden;
}

.filter-value-divider {
  height: 1px;
  background: #edf2f8;
}

.filter-value-list {
  max-height: 250px;
  overflow: auto;
}

.filter-value-row {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  color: #344054;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.filter-value-row[hidden],
.condition-grid label[hidden] {
  display: none;
}

.filter-value-row input {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.filter-value-row span {
  min-width: 0;
  color: #344054;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-all-row {
  background: #fbfcff;
}

.filter-value-empty {
  padding: 12px;
  color: #8c96a9;
  font-size: 11px;
}

.table-condition-box {
  margin-top: 10px;
  border: 1px solid #edf2f8;
  border-radius: 8px;
  background: #fbfcff;
}

.table-condition-box summary {
  cursor: pointer;
  padding: 9px 10px;
  color: #344054;
  font-size: 11px;
  font-weight: 900;
}

.condition-grid {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.clear-all-filters {
  width: 100%;
  height: 30px;
  margin-top: 10px;
  border-radius: 7px;
  background: #fff4f3;
  color: #c94747;
  font-size: 10px;
  font-weight: 900;
}

.table-filter-actions {
  position: sticky;
  bottom: -12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 10px -12px -12px;
  padding: 10px 12px 12px;
  border-top: 1px solid #edf2f8;
  background: #fff;
}

.table-filter-actions button {
  min-width: 76px;
  height: 30px;
  border-radius: 7px;
  background: #f6f8fc;
  color: #546078;
  font-size: 10px;
  font-weight: 800;
}

.table-filter-actions button[data-filter-action="apply"] {
  background: var(--primary);
  color: #fff;
}

tbody tr:hover {
  background: #fbfcff;
}

tbody td strong {
  color: #33405a;
  font-size: 10px;
}

.cell-main {
  color: #35415a;
  font-weight: 600;
  font-size: 10px;
}

.cell-sub {
  color: #9ca5b5;
  font-size: 9px;
  margin-top: 4px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
}

.chip-in {
  background: var(--green-soft);
  color: #24945a;
}

.chip-out {
  background: var(--red-soft);
  color: #d65757;
}

.chip-transfer {
  background: var(--violet-soft);
  color: #6954df;
}

.po-check-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: #2f3a52;
  font-size: 9px;
  font-weight: 800;
}

.po-check-status.po-check-partial {
  background: #fff3c4;
  color: #a15c07;
}

.po-check-status.po-check-zero {
  background: #fee2e2;
  color: #c81e1e;
}

.po-note-status {
  display: inline-block;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
  white-space: normal;
}

.po-note-status.po-check-zero {
  background: #fee2e2;
  color: #c81e1e;
}

.po-note-status.po-check-partial {
  background: #fff3c4;
  color: #a15c07;
}

.po-note-status.po-check-complete {
  background: var(--green-soft);
  color: #24945a;
}

.po-check-status.po-check-complete {
  background: var(--green-soft);
  color: #24945a;
}

.qty {
  font-weight: 700;
  color: #505b70;
}

.qty.in {
  color: #289c60;
}

.qty.out {
  color: #d95a5a;
}

.table-footer {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: #8d98ab;
  font-size: 9px;
}

.pagination {
  display: flex;
  gap: 5px;
}

.pagination button {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #fff;
  color: #758096;
  border: 1px solid var(--line);
  font-size: 10px;
}

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

.pagination button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.mobile-menu {
  display: none;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: 340px;
  background: #1b263b;
  color: white;
  font-size: 11px;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 14px 35px rgba(20,32,58,.2);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .global-search {
    width: 280px;
  }
}

@media (max-width: 920px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 10px 0 30px rgba(10,20,40,.2);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    width: 100%;
    margin-left: 0;
  }

  .mobile-menu {
    display: grid;
  }

  .global-search {
    display: none;
  }

  .floating-table-scrollbar {
    left: 16px;
    right: 16px;
    bottom: 10px;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 0 14px;
  }

  .profile {
    min-width: auto;
  }

  .profile-text,
  .chevron {
    display: none;
  }

  .content {
    padding: 18px 14px 56px;
  }

  .welcome-row {
    align-items: flex-start;
    gap: 14px;
    flex-direction: column;
  }

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

  .date-filter {
    width: 100%;
  }

  .date-filter button {
    flex: 1;
  }

  .table-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-actions {
    width: 100%;
    justify-content: space-between;
  }
}


/* ===== INBOUND PAGE ===== */
.inbound-page{display:flex;flex-direction:column;gap:16px}
.inbound-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px}
.inbound-toolbar h2{font-size:24px;margin-bottom:6px}
.inbound-toolbar p{font-size:12px;color:var(--muted)}
.toolbar-actions{display:flex;gap:10px}
.form-panel{padding:20px}
.section-title-row{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px}
.section-title-row h3{font-size:14px}
.section-title-row p{margin-top:4px;font-size:10px;color:var(--muted)}
.form-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
#outboundPrintModal .norm-modal { width: min(560px, calc(100vw - 32px)); }
#outboundPrintForm { display: grid; gap: 16px; padding: 20px; }
#outboundPrintForm .field label { font-size: 12px; }
#outboundPrintForm .entry-input { font-size: 13px; border-radius: 6px; }
.field{min-width:0}
.field.span-2{grid-column:span 2}
.field label{display:block;font-size:10px;font-weight:700;color:#68748b;margin-bottom:7px}
.field input,.field select,.field textarea{width:100%;min-height:40px;border:1px solid var(--line);border-radius:9px;background:#fff;outline:none;color:var(--text);font-size:11px}
.field input,.field select{padding:0 11px}
.field textarea{resize:vertical;min-height:74px;padding:10px 11px}
.field input:focus,.field select:focus,.field textarea:focus{border-color:#9bb5f8;box-shadow:0 0 0 3px rgba(68,117,242,.08)}
.required{color:#df5d5d}
.receipt-code{background:#f8fafd!important;color:#4d5a72!important;font-weight:600}
.material-entry{padding:0;overflow:hidden}
.material-entry-head{padding:18px 20px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between}
.material-entry-head h3{font-size:14px;margin-bottom:4px}
.material-entry-head p{font-size:10px;color:var(--muted)}
.scan-chip{padding:7px 10px;border-radius:8px;background:var(--primary-soft);color:var(--primary);font-size:10px;font-weight:700}
.material-entry-body{padding:18px 20px 20px}
.material-main-grid{display:grid;grid-template-columns:1.4fr 1.4fr .8fr .8fr;gap:12px;align-items:end}
.add-material-btn{height:40px}
.quick-note{margin-top:10px;font-size:9px;color:#9aa4b6}
.receipt-summary{display:flex;align-items:center;gap:14px;margin-left:auto}
.summary-box{min-width:100px;padding:9px 12px;background:#f8fafd;border:1px solid var(--line);border-radius:9px}
.summary-box span,.summary-box strong{display:block}
.summary-box span{font-size:9px;color:var(--muted)}
.summary-box strong{font-size:14px;margin-top:3px}
.empty-row td{padding:42px 18px;text-align:center;color:#9aa4b6}
.empty-state strong{display:block;color:#5d687e;font-size:12px;margin-bottom:6px}
.empty-state span{font-size:10px}
.receipt-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:16px 20px;border-top:1px solid var(--line);background:#fbfcfe}
.receipt-footer .left-note{font-size:10px;color:var(--muted)}
.receipt-footer-actions{display:flex;gap:10px}
@media(max-width:1100px){.form-grid,.material-main-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){
  .inbound-toolbar,.section-title-row,.receipt-footer{align-items:flex-start;flex-direction:column}
  .toolbar-actions,.receipt-footer-actions{width:100%}
  .toolbar-actions button,.receipt-footer-actions button{flex:1}
  .form-grid,.material-main-grid{grid-template-columns:1fr}
  .field.span-2{grid-column:span 1}
  .receipt-summary{margin-left:0;width:100%}
  .summary-box{flex:1}
}


/* ===== EXCEL IMPORT / BBBG ===== */
.excel-import-panel {
  overflow: hidden;
}

.excel-import-head {
  min-height: 72px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.excel-import-head h3 {
  font-size: 14px;
  margin-bottom: 5px;
}

.excel-import-head p {
  font-size: 10px;
  color: var(--muted);
}

.template-btn {
  white-space: nowrap;
}

.norm-upload-btn {
  cursor: pointer;
}

.norm-upload-input {
  display: none;
}

.excel-import-body {
  padding: 18px 20px 20px;
}

.excel-dropzone {
  min-height: 122px;
  border: 1.5px dashed #cfd8e8;
  border-radius: 13px;
  background: #fbfcff;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.excel-file-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #e9f8ef;
  color: #25945c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
}

.excel-drop-text strong,
.excel-drop-text span,
.excel-drop-text small {
  display: block;
}

.excel-drop-text strong {
  font-size: 12px;
  color: #33405a;
}

.excel-drop-text span {
  margin-top: 4px;
  font-size: 10px;
  color: #758198;
}

.excel-drop-text small {
  margin-top: 7px;
  font-size: 9px;
  color: #a0a9b8;
}

.choose-excel-btn {
  min-width: 132px;
}

.inbound-history-filters {
  display: grid;
  grid-template-columns: minmax(150px, .55fr) minmax(150px, .55fr) minmax(260px, 1.4fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px 18px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}

.inbound-history-filters .field {
  min-width: 0;
}

.history-code-field {
  min-width: 260px;
}

.inbound-history-table {
  min-width: 1180px;
}

@media (max-width: 920px) {
  .inbound-history-filters {
    grid-template-columns: 1fr;
  }

  .history-code-field {
    min-width: 0;
  }
}

.excel-selected {
  margin-top: 12px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
}

.excel-selected-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.excel-mini-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #f0f4fa;
  color: #637089;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.excel-selected-label strong,
.excel-selected-label span {
  display: block;
}

.excel-selected-label strong {
  font-size: 10px;
  color: #465269;
}

.excel-selected-label span {
  margin-top: 4px;
  font-size: 9px;
  color: #98a2b4;
}

.excel-waiting {
  background: #f2f4f8;
  color: #7b879c;
}

@media (max-width: 680px) {
  .excel-import-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .template-btn {
    width: 100%;
  }

  .excel-dropzone {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .excel-file-icon {
    margin: 0 auto;
  }

  .choose-excel-btn {
    width: 100%;
  }

  .excel-selected {
    align-items: flex-start;
    flex-direction: column;
  }
}


/* ===== OPTIONAL FIELD TOGGLES ===== */
.optional-label-row {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.optional-label-row > label:first-child {
  margin-bottom: 0;
}

.field-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  margin: 0 !important;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.field-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  min-height: 0;
}

.toggle-box {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  border: 1px solid #b9c5d8;
  background: #fff;
  display: inline-grid;
  place-items: center;
  color: transparent;
  font-size: 10px;
  font-weight: 800;
  transition: .15s ease;
}

.field-toggle input:checked + .toggle-box {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.field-toggle small {
  font-size: 9px;
  color: #7e899d;
  font-weight: 600;
}

.optional-field.is-disabled > input,
.optional-field.is-disabled > select {
  background: #f1f3f7 !important;
  color: #a6afbf !important;
  border-color: #e1e5ec !important;
  cursor: not-allowed;
}

.optional-field.is-disabled .optional-label-row > label:first-child {
  color: #a8b0bf;
}

.compact-row {
  grid-template-columns: 1.2fr .8fr .8fr;
}

.action-field {
  align-self: end;
}

.action-field .add-material-btn {
  width: 100%;
}

@media (max-width: 1100px) {
  .compact-row {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }

  .action-field {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .compact-row {
    grid-template-columns: 1fr;
  }

  .action-field {
    grid-column: span 1;
  }
}


/* ===== RECENT STOCK SEARCH / EDIT / DELETE ===== */
.recent-stock-panel {
  overflow: hidden;
}

.recent-stock-header {
  gap: 18px;
}

.recent-stock-toolbar {
  min-height: 62px;
  padding: 11px 18px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.recent-search {
  width: min(560px, 100%);
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
}

.recent-search:focus-within {
  border-color: #9bb5f8;
  box-shadow: 0 0 0 3px rgba(68,117,242,.08);
}

.recent-search-icon {
  color: #8d98aa;
  font-size: 15px;
}

.recent-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
  color: var(--text);
}

.recent-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recent-toolbar-actions .secondary-btn {
  height: 36px;
}

.recent-stock-table tbody td {
  vertical-align: middle;
}

.qty-edit-wrap {
  display: flex;
  align-items: center;
}

.qty-edit-input {
  width: 92px;
  height: 34px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  outline: 0;
  padding: 0 9px;
  font-size: 10px;
  font-weight: 700;
  color: #33405a;
}

.qty-edit-input:focus {
  border-color: #8eacf7;
  box-shadow: 0 0 0 3px rgba(68,117,242,.08);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-save-btn,
.row-delete-btn {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.row-save-btn {
  background: #edf3ff;
  color: #416fdc;
  border-color: #dbe6ff;
}

.row-save-btn:hover {
  background: #e5edff;
}

.row-delete-btn {
  background: #fff1f1;
  color: #d65b5b;
  border-color: #ffdede;
}

.row-delete-btn:hover {
  background: #ffe8e8;
}

.recent-stock-footer {
  min-height: 48px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #929caf;
  font-size: 9px;
}

@media (max-width: 760px) {
  .recent-stock-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .recent-search {
    width: 100%;
  }

  .recent-toolbar-actions {
    width: 100%;
  }

  .recent-toolbar-actions button {
    flex: 1;
  }

  .recent-stock-footer {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 12px;
  }
}


.save-all-btn {
  min-width: 112px;
  height: 36px;
  white-space: nowrap;
}

.compact-row {
  margin-top: 12px;
}


/* ===== PAGE VIEWS ===== */
.page-view {
  display: block;
}

.page-view[hidden] {
  display: none;
}


/* ===== INVENTORY PAGE ===== */
.inventory-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inventory-search-box {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  background: #f8fafd;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: #8d98aa;
}

.inventory-search-box:focus-within {
  border-color: #9bb5f8;
  box-shadow: 0 0 0 3px rgba(68,117,242,.08);
}

.inventory-search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.inventory-table-search {
  padding: 12px 18px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}

.inventory-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr)) minmax(300px, .9fr);
  gap: 16px;
}

.inventory-stat-card {
  margin: 0;
}

.inventory-ratio-card {
  justify-content: space-between;
  gap: 18px;
}

.usage-donut {
  --received-percent: 50%;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: conic-gradient(#4475f2 0 var(--received-percent), #25a962 var(--received-percent) 100%);
  box-shadow: inset 0 0 0 1px rgba(44, 62, 94, .06);
}

.usage-donut-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  align-content: center;
}

.usage-donut-inner strong {
  color: #1f2d49;
  font-size: 15px;
  line-height: 1;
}

.usage-donut-inner span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.ratio-info {
  min-width: 0;
  flex: 1;
}

.ratio-info > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.ratio-info > strong {
  display: block;
  margin: 7px 0 11px;
  color: #1f2d49;
  font-size: 18px;
}

.ratio-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: #79859a;
  font-size: 10px;
  font-weight: 700;
}

.ratio-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ratio-legend .legend-dot.outbound {
  background: #25a962;
}

.inventory-layout {
  display: block;
}

.inventory-table-panel {
  overflow: hidden;
}

.inventory-table-panel .table-scroll {
  max-height: calc(100vh - 250px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #b8c4d8 #edf2f8;
}

.inventory-table-panel .table-scroll::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.inventory-table-panel .table-scroll::-webkit-scrollbar-track {
  background: #edf2f8;
  border-radius: 10px;
}

.inventory-table-panel .table-scroll::-webkit-scrollbar-thumb {
  background: #b8c4d8;
  border: 3px solid #edf2f8;
  border-radius: 10px;
}

.inventory-table {
  min-width: 1520px;
  margin-right: 18px;
  --inventory-freeze-col-1: 260px;
  --inventory-freeze-col-2: 230px;
  --inventory-freeze-col-3: 260px;
}

.inventory-table thead th {
  position: sticky;
  top: 0;
  z-index: 14;
  background: #f9fbfd;
  box-shadow: inset 0 -1px 0 #dfe7f3;
}

.inventory-table th:nth-child(n+2):nth-child(-n+4),
.inventory-table td:nth-child(n+2):nth-child(-n+4) {
  position: sticky;
  z-index: 7;
  background: #fff;
  background-clip: border-box;
}

.inventory-table thead th:nth-child(n+2):nth-child(-n+4) {
  z-index: 18;
  background: #f9fbfd;
}

.inventory-table th:nth-child(2),
.inventory-table td:nth-child(2) {
  left: 0;
  width: var(--inventory-freeze-col-1);
  min-width: var(--inventory-freeze-col-1);
}

.inventory-table th:nth-child(3),
.inventory-table td:nth-child(3) {
  left: var(--inventory-freeze-left-2, calc(var(--inventory-freeze-col-1) - 1px));
  width: var(--inventory-freeze-col-2);
  min-width: var(--inventory-freeze-col-2);
  white-space: normal;
  line-height: 1.45;
}

.inventory-table th:nth-child(4),
.inventory-table td:nth-child(4) {
  left: var(--inventory-freeze-left-3, calc(var(--inventory-freeze-col-1) + var(--inventory-freeze-col-2) - 2px));
  width: var(--inventory-freeze-col-3);
  min-width: var(--inventory-freeze-col-3);
  box-shadow: 2px 0 0 #fff, 3px 0 0 #dfe7f3;
}

.inventory-table .pn-cell {
  min-width: 0;
}

.pn-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.mounting-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.mounting-type-smd {
  color: #146c43;
  background: #e2f6ec;
}

.mounting-type-thc {
  color: #8a4b08;
  background: #fff0cf;
}

.inventory-table .alt-code-list {
  max-width: 300px;
}

.inventory-table th:last-child,
.inventory-table td:last-child {
  box-sizing: border-box;
  width: 132px;
  min-width: 132px !important;
}

.inventory-table th:last-child {
  padding-right: 20px;
}

.inventory-table th:last-child .table-th-shell {
  justify-content: space-between;
  padding-left: 0;
}

.inventory-table th:last-child .table-filter-btn {
  position: static;
  transform: none;
}

.inventory-table td:last-child {
  padding-right: 22px;
  padding-left: 18px;
}

.stock-number {
  color: #111827;
  font-weight: 800;
}

.stock-number.negative {
  color: #d95a5a;
}

.stock-number.positive {
  color: #24945a;
}

@media (max-width: 1260px) {
  .inventory-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-layout {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 760px) {
  .inventory-summary-grid {
    grid-template-columns: 1fr;
  }
}


/* ===== PO / COMPONENT MATRIX PAGE ===== */
.po-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.purchase-order-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.po-entry-panel {
  overflow: hidden;
}

.po-product-entry {
  display: grid;
  grid-template-columns: minmax(160px, .7fr) minmax(240px, 1.2fr) minmax(150px, .6fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.po-draft-scroll {
  border-top: 1px solid var(--line);
}

.po-draft-table,
.purchase-order-table {
  min-width: 760px;
}

.po-product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.po-product-tags span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eef4ff;
  color: #315fd5;
  padding: 0 9px;
  font-size: 10px;
  font-weight: 800;
}

.purchase-order-model-cell,
.purchase-order-row-actions,
.po-entry-actions {
  display: flex;
  align-items: center;
}

.purchase-order-model-cell {
  gap: 10px;
}

.purchase-order-row-actions,
.po-entry-actions {
  gap: 7px;
  flex: 0 0 auto;
}

.purchase-order-row-actions button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  margin: 0;
}

.inbound-draft-mounting-type {
  width: 160px;
  max-width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #000;
  font: inherit;
}

.inbound-column-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.inbound-column-preview {
  max-width: 100%;
  max-height: 240px;
  overflow: auto;
  scrollbar-width: auto;
  scrollbar-color: #8793a7 #eef1f5;
  border: 1px solid var(--line);
}

.inbound-column-preview::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.inbound-column-preview::-webkit-scrollbar-track {
  background: #eef1f5;
}

.inbound-column-preview::-webkit-scrollbar-thumb {
  background: #8793a7;
  border: 2px solid #eef1f5;
  border-radius: 6px;
}

.inbound-column-preview table {
  width: max-content;
  min-width: 100%;
}

.inbound-column-preview th,
.inbound-column-preview td {
  min-width: 140px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .inbound-column-fields { grid-template-columns: minmax(0, 1fr); }
}

.customer-return-invalid-cell {
  background: #fff0f0 !important;
  color: #c62828 !important;
  box-shadow: inset 0 0 0 1px #ef5350;
  font-weight: 800;
}

.customer-return-preview-quantity {
  width: 112px;
  min-width: 0;
  height: 36px;
  padding: 6px 10px;
}

.customer-return-preview-actions {
  justify-content: center;
  white-space: nowrap;
}

.po-list-panel {
  overflow: hidden;
}

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

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

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

[data-outbound-view-panel][hidden] {
  display: none !important;
}

.po-stat-card {
  margin: 0;
}

.po-stat-card .stat-info {
  min-width: 0;
}

.po-stat-card .stat-info strong {
  font-size: 22px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.po-model-progress-card .stat-info {
  flex: 1 1 auto;
}

.model-progress-chart {
  --progress: 0deg;
  position: relative;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  margin-left: auto;
  border-radius: 50%;
  background: conic-gradient(#25a962 var(--progress), #e8edf4 0deg);
  display: grid;
  place-items: center;
}

.model-progress-chart::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px #edf1f6;
}

.model-progress-chart span {
  position: relative;
  z-index: 1;
  color: #25334d;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 520px) {
  .model-progress-chart {
    flex-basis: 58px;
    width: 58px;
    height: 58px;
  }
}

.po-matrix-panel {
  overflow: hidden;
}

.po-matrix-panel .table-scroll {
  max-height: calc(100vh - 250px);
  min-height: 420px;
  overflow: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: #b8c4d8 #edf2f8;
}

.po-matrix-panel .table-scroll::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.po-matrix-panel .table-scroll::-webkit-scrollbar-track {
  background: #edf2f8;
  border-radius: 10px;
}

.po-matrix-panel .table-scroll::-webkit-scrollbar-thumb {
  background: #b8c4d8;
  border: 3px solid #edf2f8;
  border-radius: 10px;
}

.po-matrix-tabs {
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f6f8fc;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.matrix-view-switch {
  width: fit-content;
  margin-top: 12px;
}

.po-matrix-tabs button {
  height: 28px;
  min-width: 58px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #7a8598;
  font-size: 10px;
  font-weight: 700;
}

.po-matrix-tabs button.is-active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(40, 55, 80, .08);
}

.po-matrix-table {
  min-width: max(2200px, 100%);
  --po-freeze-col-1: 150px;
  --po-freeze-col-2: 230px;
  --po-freeze-col-3: 220px;
}

.po-matrix-table th:nth-child(-n+3),
.po-matrix-table td:nth-child(-n+3) {
  position: sticky;
  background: #fff;
  z-index: 7;
  background-clip: border-box;
  box-shadow: 2px 0 0 #fff, 3px 0 0 #dfe7f3;
}

.po-matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 14;
  background: #f9fbfd;
  box-shadow: inset 0 -1px 0 #dfe7f3;
}

.po-matrix-table thead th:nth-child(-n+3) {
  background: #f9fbfd;
  z-index: 18;
  box-shadow: inset 0 -1px 0 #dfe7f3, 1px 0 0 #f9fbfd, 2px 0 0 #dfe7f3;
}

.po-matrix-table th:nth-child(1),
.po-matrix-table td:nth-child(1) {
  left: 0;
  width: var(--po-freeze-col-1);
  min-width: var(--po-freeze-col-1);
}

.po-matrix-table th:nth-child(2),
.po-matrix-table td:nth-child(2) {
  left: var(--po-freeze-left-2, calc(var(--po-freeze-col-1) - 1px));
  width: var(--po-freeze-col-2);
  min-width: var(--po-freeze-col-2);
}

.po-matrix-table th:nth-child(3),
.po-matrix-table td:nth-child(3) {
  left: var(--po-freeze-left-3, calc(var(--po-freeze-col-1) + var(--po-freeze-col-2) - 2px));
  width: var(--po-freeze-col-3);
  min-width: var(--po-freeze-col-3);
}

.po-matrix-table td:nth-child(2) {
  white-space: normal;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.po-matrix-table thead th:nth-child(-n+3) .column-resizer {
  z-index: 24;
}

.po-matrix-table .alt-code-list {
  max-width: 310px;
}

.po-matrix-table th:last-child,
.po-matrix-table td:last-child {
  min-width: 280px;
  padding-right: 52px;
  white-space: normal;
}

.po-product-column {
  min-width: 165px;
  text-align: center;
  white-space: normal;
}

.po-product-column.product-status-zero {
  background: #ef4444;
  color: #fff;
}

.po-product-column.product-status-partial {
  background: #facc15;
  color: #263247;
}

.po-product-column.product-status-complete {
  background: #20b978;
  color: #fff;
}

.po-product-column.product-yellow {
  background: #fff36d;
  color: #35415a;
}

.po-product-column.product-gold {
  background: #ffbc31;
  color: #2f3a52;
}

.po-product-column.product-green {
  background: #20b978;
  color: #fff;
}

.product-matrix-head {
  display: grid;
  gap: 6px;
}

.product-head-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.product-line-badge {
  justify-self: center;
  min-height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.65);
  color: #2f3a52;
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 900;
}

.product-completed-note {
  min-height: 20px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, .58);
  border-radius: 6px;
  background: rgba(255, 255, 255, .82);
  color: #344054;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

.product-order-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.matrix-move-product-btn {
  width: 24px;
  height: 22px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 6px;
  background: rgba(255,255,255,.78);
  color: #344054;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.matrix-move-product-btn:hover:not(:disabled) {
  background: #fff;
  border-color: #b9c9e8;
  color: #245dcc;
}

.matrix-move-product-btn:disabled {
  cursor: default;
  opacity: .35;
}

.matrix-delete-product-btn {
  justify-self: center;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 50%;
  background: rgba(255,255,255,.78);
  color: #c63131;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.matrix-delete-product-btn:hover {
  background: #fff;
  border-color: #fecaca;
  color: #b42318;
}

.matrix-delete-product-btn:disabled {
  cursor: wait;
  opacity: .55;
}

.product-check-qty-control {
  display: grid;
  grid-template-columns: minmax(52px, 1fr) auto;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 7px;
  background: rgba(255,255,255,.88);
  padding: 0 8px;
}

.product-check-qty-control input {
  min-height: 26px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: right;
  box-shadow: none;
}

.product-check-qty-control span {
  color: #344054;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.product-matrix-head input {
  width: 100%;
  min-height: 28px;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 7px;
  background: rgba(255,255,255,.72);
  color: #2f3a52;
  outline: 0;
  padding: 0 8px;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
}

.product-matrix-head .product-check-qty-control input {
  min-height: 26px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: right;
  box-shadow: none;
}

.product-matrix-head .product-check-qty-input:focus {
  border-color: transparent;
  box-shadow: none;
}

.product-matrix-head input:focus {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.28);
}

.product-matrix-head .product-name-input {
  min-height: 34px;
  background: rgba(255,255,255,.86);
  line-height: 1.25;
}

.product-matrix-head .product-date-input {
  font-size: 9px;
  font-weight: 700;
}

.po-product-column.product-green .product-matrix-head input {
  border-color: rgba(255,255,255,.45);
  background: rgba(255,255,255,.9);
}

.po-add-product-column {
  min-width: 150px;
  background: #f7f9fc;
  text-align: center;
}

.matrix-add-product-btn {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.matrix-qty-cell {
  min-width: 150px;
  text-align: right;
  background: #fcfdff;
}

.matrix-qty-cell span {
  color: #35415a;
  font-size: 11px;
  font-weight: 800;
}

.matrix-qty-cell.is-empty {
  color: #9fa8b8;
}

.matrix-add-cell {
  text-align: center;
  background: #fbfcfe;
}

.matrix-add-row-btn {
  width: 30px;
  height: 30px;
  border: 1px dashed #bdc8da;
  border-radius: 8px;
  background: #fff;
  color: #66738a;
  font-size: 15px;
  font-weight: 800;
}

.matrix-add-row-btn:hover {
  border-color: #9bb5f8;
  color: var(--primary);
  background: #f7faff;
}

.outbound-matrix-table {
  min-width: max(1800px, 100%);
}

.outbound-date-column {
  width: 210px;
  min-width: 210px;
  text-align: center;
  background: #eef7ff;
}

.outbound-date-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  align-items: center;
  gap: 6px;
}

.outbound-date-sequence {
  grid-column: 1 / -1;
  padding-right: 24px;
  color: #4f5f78;
  font-size: 10px;
  font-weight: 900;
  text-align: left;
}

.outbound-date-input {
  width: 100%;
  min-height: 30px;
  border: 1px solid #d7e3f2;
  border-radius: 8px;
  background: #fff;
  color: #263247;
  padding: 0 7px;
  font-size: 10px;
  font-weight: 800;
}

.matrix-delete-date-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #d7e3f2;
  border-radius: 50%;
  background: #fff;
  color: #d65757;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.matrix-delete-date-btn:hover {
  border-color: #fecaca;
  background: #fff5f5;
  color: #b42318;
}

.outbound-qty-cell {
  min-width: 130px;
  text-align: center;
  background: #fcfdff;
}

.outbound-qty-input {
  width: 100%;
  min-height: 30px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  color: #2f3a52;
  outline: 0;
  padding: 0 9px;
  text-align: right;
  font-size: 11px;
  font-weight: 800;
}

.outbound-qty-input:focus {
  border-color: #86a8ff;
  box-shadow: 0 0 0 3px rgba(67, 111, 241, .12);
}

.po-need-number {
  color: #2f3a52;
  font-size: 12px;
  font-weight: 800;
}

.substitute-control {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
}

.substitute-control input {
  width: 92px;
  height: 34px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  outline: 0;
  padding: 0 9px;
  color: #33405a;
  font-size: 10px;
  font-weight: 700;
}

.substitute-control input:focus {
  border-color: #8eacf7;
  box-shadow: 0 0 0 3px rgba(68,117,242,.08);
}

.substitute-dual-control {
  min-width: 190px;
  display: grid;
  gap: 6px;
}

.substitute-dual-control label {
  display: grid;
  gap: 4px;
  color: #7c879a;
  font-size: 9px;
  font-weight: 800;
}

.substitute-dual-control input {
  width: 100%;
  height: 32px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  outline: 0;
  padding: 0 9px;
  color: #33405a;
  font-size: 10px;
  font-weight: 800;
}

.substitute-dual-control input:focus {
  border-color: #8eacf7;
  box-shadow: 0 0 0 3px rgba(68,117,242,.08);
}

.substitute-values {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.substitution-history-btn {
  height: 24px;
  min-width: auto;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 9px;
}

.substitution-history-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.substitution-history-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.substitution-history-item {
  border: 1px solid #e5ebf4;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafd;
}

.substitution-history-item div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #293852;
  font-size: 11px;
  font-weight: 800;
}

.substitution-history-item span {
  color: #7b879a;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.substitution-history-item p {
  margin: 7px 0 0;
  color: #46546b;
  font-size: 11px;
  line-height: 1.45;
}

.balance-cell {
  min-width: 220px;
}

.balance-cell small {
  display: block;
  margin-top: 6px;
  color: #9aa4b6;
  font-size: 9px;
  line-height: 1.35;
  white-space: normal;
}

.balance-pill {
  min-width: 62px;
  min-height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 800;
}

.balance-pill.positive {
  background: var(--green-soft);
  color: #24945a;
}

.balance-pill.warning {
  background: #fff4dd;
  color: #c98217;
}

.balance-pill.danger {
  background: var(--red-soft);
  color: #d65757;
}

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

@media (max-width: 760px) {
  .po-summary-grid {
    grid-template-columns: 1fr;
  }

  .po-matrix-tabs {
    width: 100%;
  }

  .po-matrix-tabs button {
    flex: 1;
  }
}


/* ===== MATERIAL NORM PAGE ===== */
.models-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.model-search-panel {
  padding: 18px 20px;
}

.model-search-layout {
  display: grid;
  grid-template-columns: minmax(190px, .7fr) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.model-search-copy h3 {
  font-size: 14px;
  margin-bottom: 5px;
}

.model-search-copy p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.model-search-box {
  height: 42px;
  border: 1px solid var(--line);
  background: #f8fafd;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: #8d98aa;
}

.model-search-box:focus-within {
  border-color: #9bb5f8;
  box-shadow: 0 0 0 3px rgba(68,117,242,.08);
}

.model-search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.model-search-btn {
  min-width: 112px;
}

.sample-template-note {
  margin-top: 10px;
  color: #8d98ab;
  font-size: 10px;
}

.selected-model-strip {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1.1fr 1.4fr .8fr .9fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--line);
}

.selected-model-strip > div {
  min-height: 66px;
  padding: 12px 14px;
  background: #fff;
}

.selected-model-strip span,
.selected-model-strip strong {
  display: block;
}

.selected-model-strip span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.selected-model-strip strong {
  margin-top: 6px;
  color: #33405a;
  font-size: 12px;
}

.norm-edit-head {
  min-height: 62px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.norm-edit-head h3 {
  font-size: 13px;
  margin-bottom: 5px;
}

.norm-edit-head p {
  color: var(--muted);
  font-size: 10px;
}

.norm-edit-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1.4fr .55fr 1.6fr auto;
  gap: 12px;
  align-items: end;
}

.add-norm-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1.35fr 1.25fr .55fr .5fr;
  gap: 12px;
  align-items: end;
}

.add-norm-modal {
  width: min(980px, 100%);
}

.norm-field {
  min-width: 104px;
}

.norm-action-field {
  min-width: 132px;
}

.norm-action-field .primary-btn {
  width: 100%;
}

.material-norm-table {
  min-width: 1080px;
}

.pn-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.pn-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.norm-edit-trigger,
.norm-delete-trigger {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
}

.norm-edit-trigger {
  background: #edf3ff;
  border: 1px solid #dbe6ff;
  color: #416fdc;
}

.norm-edit-trigger:hover {
  background: #e3ecff;
}

.norm-delete-trigger {
  background: #fff1f1;
  border: 1px solid #ffd7d7;
  color: #c93535;
}

.norm-delete-trigger:hover {
  background: #ffe7e7;
}

.material-norm-table tr.is-dirty td {
  background: #fffdf5;
}

.material-norm-table tr.is-dirty .norm-input {
  border-color: #f2b84b;
  background: #fff9e8;
}

.material-norm-table td:nth-child(3),
.material-norm-table td:nth-child(7) {
  white-space: normal;
  line-height: 1.45;
}

.material-norm-table td:nth-child(3) {
  min-width: 204px;
}

.norm-type-control {
  position: relative;
  display: inline-flex;
  width: 168px;
  height: 36px;
  vertical-align: middle;
  border: 1px solid #dce3ee;
  border-radius: 6px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.norm-type-control::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #bd3941;
  pointer-events: none;
}

.norm-type-control::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 12px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid #39465b;
  border-bottom: 1.5px solid #39465b;
  transform: rotate(45deg);
  pointer-events: none;
}

.norm-type-control .norm-mounting-type {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 27px 0 27px;
  border: 0;
  border-radius: 5px;
  outline: 0;
  background: transparent;
  color: #000;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.norm-type-control[data-mounting-type="SMD"] {
  background: #edf9f3;
  border-color: #b7dec9;
}

.norm-type-control[data-mounting-type="SMD"]::before {
  background: #16835c;
}

.norm-type-control[data-mounting-type="THC"] {
  background: #fff7e5;
  border-color: #ebd49f;
}

.norm-type-control[data-mounting-type="THC"]::before {
  background: #b27610;
}

.norm-type-control[data-mounting-type=""] {
  background: #fff4f4;
  border-color: #e9b5b8;
}

.norm-type-control:hover {
  border-color: #7794ce;
}

.norm-type-control:focus-within {
  border-color: #4475f2;
  box-shadow: 0 0 0 3px rgba(68, 117, 242, .12);
}

.norm-mounting-type option {
  color: #000;
  background: #fff;
}

.norm-type-menu {
  position: fixed;
  z-index: 120;
  padding: 5px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(25, 40, 65, .16);
}

.norm-type-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: #000;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.norm-type-option::before {
  content: "";
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #bd3941;
}

.norm-type-option[data-value="SMD"]::before { background: #16835c; }
.norm-type-option[data-value="THC"]::before { background: #b27610; }
.norm-type-option[aria-selected="true"] { background: #edf3ff; font-weight: 700; }
.norm-type-option:hover,
.norm-type-option:focus-visible { background: #f1f5fc; outline: 2px solid #b7cafa; outline-offset: -2px; }
.norm-type-check { margin-left: auto; color: #3567d5; }

.material-norm-table td:nth-child(7) {
  min-width: 260px;
}

.alt-code-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 260px;
}

.alt-code-list span {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f1f4fa;
  color: #5f6b82;
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.norm-input {
  width: 84px;
  height: 34px;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  outline: 0;
  padding: 0 9px;
  color: #33405a;
  font-size: 10px;
  font-weight: 700;
}

.norm-input:focus {
  border-color: #8eacf7;
  box-shadow: 0 0 0 3px rgba(68,117,242,.08);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(17, 25, 43, .46);
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop[hidden] {
  display: none;
}

.norm-modal {
  width: min(960px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
}

.add-model-modal {
  width: min(820px, 100%);
}

.add-model-body {
  padding: 16px;
}

.add-model-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
}

.add-model-message {
  margin-top: 12px;
  min-height: 36px;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #dce6fb;
  background: #f6f9ff;
  color: #41516d;
  font-size: 11px;
  font-weight: 700;
}

.add-model-message.is-error {
  border-color: #ffd2d2;
  background: #fff7f7;
  color: #b42318;
}

.add-model-import-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.add-model-message[hidden],
.add-model-import-panel[hidden],
.add-model-finish-btn[hidden] {
  display: none;
}

.add-model-import-panel strong,
.add-model-import-panel span {
  display: block;
}

.add-model-import-panel strong {
  color: #30405f;
  font-size: 13px;
}

.add-model-import-panel span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.modal-close {
  flex: 0 0 auto;
}

.inventory-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inventory-action-btn {
  width: 28px;
  height: 28px;
  border: 1px solid #dbe4f4;
  border-radius: 8px;
  background: #fff;
  color: #4a5f86;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.inventory-action-btn:hover {
  border-color: #b8c9fb;
  background: #f6f9ff;
}

.inventory-action-btn.delete {
  color: #dc2626;
}

.inventory-material-modal,
.inventory-delete-modal,
.po-product-modal,
.inbound-location-modal,
.inbound-edit-modal {
  width: min(820px, 100%);
}

.po-product-modal-body {
  padding: 16px;
}

.po-product-modal-body .inventory-danger-warning {
  margin: 0 0 14px;
}

.po-product-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, .8fr) minmax(160px, .8fr);
  gap: 12px;
}

.locked-field,
.field input[readonly],
.product-matrix-head input[readonly] {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #344054;
  cursor: default;
}

.locked-field:focus,
.field input[readonly]:focus,
.product-matrix-head input[readonly]:focus {
  border-color: #d5deec;
  box-shadow: none;
}

.inventory-material-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.inventory-material-grid .field {
  min-width: 0;
}

.inventory-danger-warning {
  margin: 16px 16px 0;
  border: 1px solid #dc2626;
  border-radius: 10px;
  background: #fee2e2;
  color: #7f1d1d;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.inventory-danger-warning[hidden] {
  display: none;
}

.inventory-danger-warning strong,
.inventory-danger-warning span {
  display: block;
}

.inventory-danger-warning strong {
  margin-bottom: 4px;
  color: #7f1d1d;
  font-size: 13px;
}

.inventory-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px;
}

.inbound-location-body {
  padding: 16px;
}

.inbound-location-note {
  border: 1px solid #dbe7ff;
  border-radius: 10px;
  background: #f6f9ff;
  padding: 12px 14px;
  color: #41516d;
}

.inbound-location-note strong,
.inbound-location-note span {
  display: block;
}

.inbound-location-note strong {
  color: #263957;
  font-size: 13px;
}

.inbound-location-note span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.inbound-location-grid {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(220px, 1.2fr);
  gap: 12px;
  margin-top: 14px;
}

.inbound-edit-body {
  padding: 16px;
}

.inbound-edit-summary {
  border: 1px solid #dbe7ff;
  border-radius: 10px;
  background: #f6f9ff;
  padding: 12px 14px;
}

.inbound-edit-summary strong,
.inbound-edit-summary span {
  display: block;
}

.inbound-edit-summary strong {
  color: #263957;
  font-size: 13px;
}

.inbound-edit-summary span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.inbound-edit-grid {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(220px, 1.2fr);
  gap: 12px;
  margin-top: 14px;
}

.inbound-adjust-note {
  margin-top: 6px;
  border-left: 3px solid #f59e0b;
  padding-left: 8px;
  color: #9a5a00;
  font-size: 10px;
  font-weight: 800;
}

.inbound-new-material-modal {
  width: min(720px, calc(100vw - 32px));
}

.inbound-new-material-body {
  padding: 16px;
}

.new-material-list {
  max-height: min(420px, 55vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.new-material-item {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(180px, 1.2fr) 90px 80px;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: #56627a;
  font-size: 11px;
}

.new-material-item:last-child {
  border-bottom: 0;
}

.new-material-item strong {
  color: #27344d;
  overflow-wrap: anywhere;
}

.new-material-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.new-material-field > span {
  color: #8792a7;
  font-size: 9px;
  font-weight: 800;
}

.new-material-item .entry-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid #d8e1ef;
  border-radius: 7px;
  background: #fff;
  padding: 0 9px;
  color: #27344d;
  font-size: 10px;
}

.new-material-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff1c2;
  color: #8a5a00;
  font-size: 9px;
  font-weight: 800;
}

.production-history-modal {
  width: min(1380px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}

.production-history-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 520px;
  max-height: calc(100vh - 130px);
}

.production-history-batches {
  overflow: auto;
  border-right: 1px solid var(--line);
  background: #f8fafc;
  padding: 10px;
}

.production-history-batch {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 11px;
  text-align: left;
  color: #55627a;
  cursor: pointer;
}

.production-history-batch + .production-history-batch {
  margin-top: 6px;
}

.production-history-batch:hover,
.production-history-batch.is-active {
  border-color: #cddcff;
  background: #fff;
}

.production-history-batch strong,
.production-history-batch span,
.production-history-batch small {
  display: block;
}

.production-history-batch strong {
  color: #27344d;
  font-size: 12px;
}

.production-history-batch span {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
}

.production-history-batch small {
  margin-top: 5px;
  color: #8b96aa;
  font-size: 9px;
}

.production-history-detail {
  min-width: 0;
  overflow: auto;
  padding: 14px;
}

.production-history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.customer-return-history-periods {
  display: block;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

#customerReturnHistoryModal .production-history-toolbar {
  flex-wrap: wrap;
  align-items: flex-end;
}

#customerReturnHistoryModal .production-history-toolbar > .inventory-search-box {
  flex: 1 1 240px;
  min-width: 0;
}

.customer-return-history-export {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

.customer-return-history-export .field {
  flex: 1 1 140px;
  min-width: 0;
}

.customer-return-history-export .field > span {
  display: block;
  margin-bottom: 5px;
  font-weight: 700;
  font-size: 12px;
}

.customer-return-history-export > button {
  min-height: 40px;
}

.customer-return-history-period {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #34425a;
  text-align: left;
  cursor: pointer;
}

.customer-return-history-period + .customer-return-history-period {
  margin-top: 6px;
}

.customer-return-history-period:hover {
  border-color: #cddcff;
  background: #fff;
}

.customer-return-history-period strong {
  font-size: 11px;
}

.customer-return-history-period span {
  color: #7a8598;
  font-size: 10px;
}

.customer-return-history-period.is-active {
  border-color: #4d78db;
  background: #edf3ff;
  color: #2858bd;
}

.production-history-summary {
  color: #66738b;
  font-size: 11px;
  font-weight: 700;
}

.production-history-table-scroll,
.production-history-product-scroll,
.production-history-entry-scroll {
  max-height: 260px;
  border: 1px solid var(--line);
}

.production-history-subtitle {
  margin: 16px 0 8px;
  color: #27344d;
  font-size: 12px;
}

.inventory-closing-panel {
  overflow: hidden;
}

#inventoryClosingCompleteButton:disabled {
  border-color: #dce4ef;
  background: #e8edf5;
  color: #98a3b5;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

.inventory-closing-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.inventory-closing-summary span {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dce5f1;
  border-radius: 8px;
  background: #fff;
  padding: 0 11px;
  color: #77839a;
  font-size: 10px;
  font-weight: 700;
}

.inventory-closing-summary strong {
  color: #27344d;
  font-size: 12px;
}

.inventory-closing-summary strong.positive {
  color: #24945a;
}

.inventory-closing-summary strong.negative {
  color: #d95a5a;
}

.inventory-closing-scroll {
  width: 100%;
  height: min(560px, calc(100vh - 280px));
  min-height: 280px;
  overflow-x: auto;
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #aebbd0 #edf2f8;
}

.inventory-closing-scroll::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.inventory-closing-scroll::-webkit-scrollbar-track {
  background: #edf2f8;
}

.inventory-closing-scroll::-webkit-scrollbar-thumb {
  border: 3px solid #edf2f8;
  border-radius: 10px;
  background: #aebbd0;
}

.inventory-closing-scroll::-webkit-scrollbar-thumb:hover {
  background: #8797b0;
}

.inventory-closing-table {
  min-width: 820px;
}

.inventory-closing-actual-input {
  width: 118px;
  height: 34px;
  border: 1px solid #d5dfec;
  border-radius: 7px;
  background: #fff;
  padding: 0 10px;
  color: #27344d;
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.inventory-closing-actual-input:disabled {
  background: #f2f5f9;
  color: #9aa5b7;
}

.inventory-closing-history-scroll {
  max-height: calc(100vh - 190px);
  border: 1px solid var(--line);
}

.inbound-new-chip {
  display: inline-flex;
  margin-top: 4px;
  color: #9a6200;
  font-size: 9px;
  font-weight: 800;
}

.model-list-panel {
  overflow: hidden;
}

.model-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.model-card {
  position: relative;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0;
  cursor: pointer;
}

.model-open-btn {
  display: block;
  width: 100%;
  min-height: 118px;
  padding: 15px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #000;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.model-open-btn .model-card-head { padding-right: 36px; }
.model-open-btn:focus-visible { outline: 3px solid #b7cafa; outline-offset: 2px; }
.model-delete-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #f0d5d7;
  border-radius: 6px;
  background: #fff4f4;
  color: #c1313c;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.model-delete-btn:hover { background: #ffe5e7; border-color: #e59ca2; }
.model-delete-btn:focus-visible { outline: 2px solid #c1313c; outline-offset: 2px; }
.model-delete-btn:disabled { opacity: .5; cursor: wait; }

.model-card.is-selected {
  border-color: #b8c9fb;
  background: #f8fbff;
}

.model-card:focus-visible {
  outline: 3px solid rgba(68,117,242,.18);
  outline-offset: 2px;
}

.model-empty-state {
  grid-column: 1 / -1;
}

.model-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.model-card-head strong {
  color: #2f3a52;
  font-size: 12px;
}

.model-card-head span {
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef4ff;
  color: #416fdc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.model-card p {
  margin-top: 11px;
  color: #68748b;
  font-size: 11px;
}

.model-card-meta {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #9aa4b5;
  font-size: 9px;
}

@media (max-width: 1180px) {
  .model-card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .model-search-layout,
  .selected-model-strip,
  .norm-edit-grid,
  .add-norm-grid,
  .add-model-form,
  .po-product-grid {
    grid-template-columns: 1fr 1fr;
  }

  .norm-action-field {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .model-card-grid,
  .model-search-layout,
  .selected-model-strip,
  .norm-edit-grid,
  .add-norm-grid,
  .add-model-form,
  .po-product-grid,
  .po-product-entry,
  .inbound-location-grid,
  .inbound-edit-grid {
    grid-template-columns: 1fr;
  }

  .production-history-layout {
    grid-template-columns: 1fr;
  }

  .production-history-batches {
    max-height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .new-material-item {
    grid-template-columns: 1fr 1fr;
  }

  .model-search-btn,
  .add-model-form .primary-btn,
  .norm-action-field {
    width: 100%;
  }

  .add-model-import-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .norm-action-field {
    grid-column: span 1;
  }

  .norm-edit-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Authentication and account administration */
.login-view[hidden],
.app-shell[hidden] {
  display: none;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(360px, 520px);
  align-items: center;
  justify-content: center;
  gap: 72px;
  padding: 48px 32px;
  background: #eef2f7;
}

.login-brand {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 18px;
}

.login-brand img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(24, 35, 58, .09);
}

.login-brand strong,
.login-brand span {
  display: block;
}

.login-brand strong {
  color: #172033;
  font-size: 28px;
  line-height: 1.2;
}

.login-brand span {
  margin-top: 8px;
  color: #69758c;
  font-size: 13px;
}

.login-panel {
  position: relative;
  width: 100%;
  padding: 38px;
  border: 1px solid #dce3ed;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(22, 34, 55, .11);
}

.language-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  height: 36px;
  padding: 3px;
  border: 1px solid #d7e0ec;
  border-radius: 7px;
  background: #f3f6fa;
}

.language-switcher button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 28px;
  padding: 0 6px;
  border: 0;
  border-radius: 5px;
  color: #536179;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.language-switcher button:hover {
  background: #e7edf6;
}

.language-switcher button.is-active {
  color: #fff;
  background: #356df3;
  box-shadow: 0 2px 6px rgba(53, 109, 243, .25);
}

.language-switcher button img {
  display: block;
  width: 27px;
  height: 18px;
  border: 1px solid rgba(20, 31, 51, .14);
  border-radius: 2px;
  object-fit: cover;
}

.language-switcher-login {
  position: absolute;
  top: 18px;
  right: 18px;
}

.customer-picker-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-heading {
  margin-bottom: 28px;
}

.login-kicker {
  color: #287b5b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-heading h1 {
  margin: 8px 0 7px;
  color: #172033;
  font-size: 26px;
  letter-spacing: 0;
}

.login-heading p {
  margin: 0;
  color: #748097;
  font-size: 12px;
  line-height: 1.6;
}

.login-field {
  display: grid;
  gap: 8px;
  margin-bottom: 17px;
  color: #3a465b;
  font-size: 11px;
  font-weight: 700;
}

.login-field[hidden] {
  display: none;
}

.login-field input,
.login-field select {
  width: 100%;
  height: 44px;
  border: 1px solid #d6deea;
  border-radius: 7px;
  background: #fff;
  padding: 0 12px;
  color: #1f2a3d;
  font: inherit;
  font-size: 12px;
  outline: none;
}

.login-field input:focus,
.login-field select:focus {
  border-color: #4b78e6;
  box-shadow: 0 0 0 3px rgba(75, 120, 230, .12);
}

.login-field input:disabled {
  background: #f2f5f9;
  color: #8a95a8;
}

.password-input-wrap {
  position: relative;
  display: block;
}

.password-input-wrap input {
  padding-right: 62px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  min-width: 45px;
  height: 30px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #4b6cae;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.remember-account {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 3px 0 20px;
  color: #5e6b80;
  font-size: 11px;
  cursor: pointer;
}

.remember-account input {
  width: 15px;
  height: 15px;
  accent-color: #4475f2;
}

.login-error {
  margin-bottom: 15px;
  border: 1px solid #ffc7c7;
  border-radius: 7px;
  background: #fff1f1;
  padding: 10px 12px;
  color: #b22626;
  font-size: 11px;
  line-height: 1.5;
}

.login-submit {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 7px;
  background: #356ce8;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(53, 108, 232, .2);
}

.login-submit:disabled {
  opacity: .65;
  cursor: wait;
}

.login-server-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 18px;
  color: #8a95a7;
  font-size: 9px;
}

.profile-logout {
  width: 30px;
  height: 30px;
  border: 1px solid #dbe3ef;
  border-radius: 7px;
  background: #fff;
  color: #63718a;
  cursor: pointer;
}

.profile-logout:hover {
  border-color: #f0bcbc;
  color: #c43a3a;
}

.admin-users-page {
  display: grid;
  gap: 16px;
}

.admin-user-search {
  width: min(320px, 40vw);
}

.admin-user-count {
  color: #758197;
  font-size: 10px;
  font-weight: 700;
}

.admin-user-table {
  min-width: 860px;
}

.admin-user-table td {
  vertical-align: middle;
}

.account-identity strong,
.account-identity span {
  display: block;
}

.account-identity strong {
  color: #27344b;
  font-size: 11px;
}

.account-identity span {
  margin-top: 4px;
  color: #96a0b1;
  font-size: 9px;
}

.account-role,
.account-status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.account-role {
  background: #edf3ff;
  color: #3c68cb;
}

.account-status.is-active {
  background: #e9f8ef;
  color: #198650;
}

.account-status.is-locked {
  background: #fff3d3;
  color: #956300;
}

.account-status.is-inactive {
  background: #f1f3f6;
  color: #7a8495;
}

.account-edit-button {
  width: 32px;
  height: 32px;
  border: 1px solid #d8e1ed;
  border-radius: 7px;
  background: #fff;
  color: #46658f;
  cursor: pointer;
}

.account-actions {
  display: flex;
  gap: 8px;
  min-width: 72px;
}

.account-delete-button {
  display: grid;
  place-items: center;
  color: #c23442;
}

.account-delete-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.account-delete-icon {
  width: 16px;
  height: 16px;
  background: currentColor;
  mask: url("../icons/trash-2.svg") center / contain no-repeat;
}

.user-delete-modal .customer-delete-body > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.user-account-modal {
  width: min(720px, calc(100vw - 32px));
}

.user-account-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
  padding: 20px 24px 4px;
}

.user-password-field {
  grid-column: 1 / -1;
}

.login-field small {
  color: #8a95a8;
  font-size: 9px;
  font-weight: 500;
}

@media (max-width: 820px) {
  .login-view {
    grid-template-columns: minmax(0, 480px);
    gap: 28px;
    padding: 28px 18px;
  }

  .login-brand {
    justify-content: center;
  }

  .login-brand img {
    width: 68px;
    height: 68px;
  }

  .login-brand strong {
    font-size: 22px;
  }

  .login-panel {
    padding: 28px 22px;
  }

  .admin-user-search {
    width: 100%;
  }

  .user-account-form {
    grid-template-columns: 1fr;
  }

  .user-password-field {
    grid-column: auto;
  }
}

.customer-picker-view {
  min-height: 100vh;
  background: #f4f7fb;
  padding: 32px;
}

.customer-picker-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
}

.customer-picker-header,
.customer-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.customer-picker-header {
  margin-bottom: 28px;
}

.customer-picker-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.customer-picker-brand img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.customer-picker-brand strong,
.customer-picker-brand span {
  display: block;
}

.customer-picker-brand strong {
  color: #172238;
  font-size: 22px;
}

.customer-picker-brand span {
  margin-top: 5px;
  color: #78869c;
  font-size: 11px;
}

.customer-picker-toolbar {
  border-bottom: 1px solid #dfe6f0;
  padding-bottom: 18px;
}

.customer-picker-search {
  width: min(480px, 100%);
}

.customer-picker-search,
.customer-picker-part-search { flex: 1; min-width: 0; }
.customer-picker-part-search { width: min(480px, 100%); }
.customer-picker-part-search[hidden] { display: none; }
.customer-picker-toolbar .admin-only[hidden] { display: none; }
.customer-picker-toolbar .inventory-search-box input { color: #111; font-size: 14px; }
.customer-picker-toolbar .inventory-search-box input::placeholder { color: #111; opacity: 1; }
.customer-picker-part-status { margin-top: 16px; color: #111; font-size: 14px; }
.customer-picker-part-status.is-error { color: #b42318; }
.customer-picker-part-results { margin: 0; padding: 0 14px 14px; list-style: none; }
.customer-picker-part-results li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid #e3e8f0; color: #111; font-size: 13px; }
.customer-picker-part-results .part-code { min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.customer-picker-part-results .part-stock { flex-shrink: 0; color: #146c43; font-weight: 700; }
.customer-picker-part-results .part-unit { margin-left: 4px; color: #111; font-weight: 400; }

.customer-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.customer-picker-card {
  position: relative;
  min-height: 82px;
  border: 1px solid #dce4ef;
  border-radius: 8px;
  background: #fff;
  color: #25324a;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.customer-picker-card:hover,
.customer-picker-card:focus-within {
  border-color: #6f95ef;
  box-shadow: 0 6px 18px rgba(43, 81, 151, .1);
  outline: none;
}

.customer-picker-open {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 80px;
  border: 0;
  background: transparent;
  padding: 14px 42px 14px 14px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.customer-picker-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #e3e8f0;
  border-radius: 6px;
  background: #fff;
  color: #9aa5b6;
  font-size: 14px;
  cursor: pointer;
}

.customer-picker-delete:hover,
.customer-picker-delete:focus-visible {
  border-color: #f0b1b1;
  background: #fff3f3;
  color: #cf3434;
  outline: none;
}

.customer-picker-code {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: #edf3ff;
  color: #356ce8;
  font-size: 12px;
  font-weight: 800;
}

.customer-picker-card strong,
.customer-picker-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-picker-card strong { font-size: 12px; }
.customer-picker-card small { margin-top: 5px; color: #8a96a9; font-size: 9px; }
.customer-picker-arrow { color: #7890b7; font-size: 18px; }

.customer-picker-empty {
  margin-top: 50px;
  color: #7d899d;
  text-align: center;
}

.customer-picker-empty strong,
.customer-picker-empty span { display: block; }
.customer-picker-empty strong { color: #32405a; font-size: 14px; }
.customer-picker-empty span { margin-top: 7px; font-size: 10px; }

.customer-context-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  height: 42px;
  border: 1px solid #dce4ef;
  border-radius: 7px;
  background: #fff;
  padding: 0 11px;
  color: #56657d;
  cursor: pointer;
  text-align: left;
}

.customer-context-button small,
.customer-context-button strong { display: block; }
.customer-context-button small { color: #96a0b1; font-size: 8px; }
.customer-context-button strong { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }

.customer-modal {
  width: min(620px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid #e1e7f0;
  box-shadow: 0 24px 60px rgba(20, 35, 65, .2);
}

.customer-modal .norm-edit-head {
  border-bottom: 1px solid #e8edf5;
  background: #fbfcfe;
  padding: 18px 22px;
}

.customer-modal .norm-edit-head h3 {
  color: #172238;
  font-size: 15px;
}

.customer-modal .norm-edit-head p {
  margin-top: 5px;
  color: #7d899e;
}

.customer-modal-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 16px;
  padding: 22px 22px 6px;
}

.customer-modal-form .login-field {
  margin-bottom: 10px;
}

.customer-modal-form .login-field > span:first-child {
  color: #46546b;
  font-size: 10px;
}

.customer-modal-form input {
  height: 42px;
  background: #fcfdff;
}

.customer-modal-form input.has-error {
  border-color: #ed7474;
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(220, 55, 55, .08);
}

.customer-modal .form-warning {
  position: relative;
  margin: 8px 22px 0;
  border: 1px solid #f2b8b8;
  border-radius: 7px;
  background: #fff4f4;
  padding: 11px 12px 11px 36px;
  color: #b42318;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.45;
}

.customer-modal .form-warning::before {
  content: "!";
  position: absolute;
  top: 10px;
  left: 12px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #dc3f3f;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.customer-modal .form-warning[hidden] {
  display: none;
}

.customer-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid #edf1f6;
  background: #fbfcfe;
  padding: 14px 22px;
}

.customer-modal .modal-actions button {
  min-width: 92px;
  height: 38px;
}

.customer-delete-modal {
  width: min(520px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid #e1e7f0;
  box-shadow: 0 24px 60px rgba(20, 35, 65, .2);
}

.customer-delete-modal .norm-edit-head {
  border-bottom: 1px solid #e8edf5;
  background: #fbfcfe;
  padding: 18px 22px;
}

.customer-delete-body {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 13px;
  padding: 22px;
}

.customer-delete-symbol {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff0f0;
  color: #d73535;
  font-size: 16px;
  font-weight: 900;
}

.customer-delete-body strong { color: #202d44; font-size: 13px; }
.customer-delete-body p { margin: 6px 0; color: #59677e; font-size: 10px; }
.customer-delete-body small { color: #8994a6; font-size: 9px; line-height: 1.55; }

.customer-delete-modal .form-warning {
  margin: 0 22px 14px;
  border: 1px solid #f2b8b8;
  border-radius: 7px;
  background: #fff4f4;
  padding: 10px 12px;
  color: #b42318;
  font-size: 10px;
  font-weight: 700;
}

.customer-delete-modal .form-warning[hidden] { display: none; }

.customer-delete-modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #edf1f6;
  background: #fbfcfe;
  padding: 14px 22px;
}

.customer-delete-modal .modal-actions button { min-width: 104px; height: 38px; }

.account-customer-field {
  grid-column: 1 / -1;
  border: 1px solid #dfe6f0;
  border-radius: 7px;
  padding: 12px;
}

.account-customer-field legend { padding: 0 6px; color: #5d6c84; font-size: 10px; font-weight: 700; }
.account-customer-field small { color: #8a95a8; font-size: 9px; }
.account-customer-access-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 9px; max-height: 160px; overflow-y: auto; }
.account-customer-option { display: flex; align-items: center; gap: 8px; color: #3f4d64; font-size: 10px; }
.account-customer-option input { accent-color: #4475f2; }

@media (max-width: 720px) {
  .customer-picker-view { padding: 20px 14px; }
  .customer-picker-header { align-items: flex-start; }
  .customer-picker-brand span { max-width: 220px; }
  .customer-picker-toolbar { align-items: stretch; flex-direction: column; }
  .customer-picker-grid { grid-template-columns: 1fr; }
  .customer-modal-form { grid-template-columns: 1fr; }
  .customer-modal-form { gap: 2px; padding: 18px 18px 4px; }
  .customer-modal .form-warning { margin-right: 18px; margin-left: 18px; }
  .customer-modal .modal-actions { padding-right: 18px; padding-left: 18px; }
  .account-customer-access-list { grid-template-columns: 1fr; }
  .customer-context-button { min-width: 42px; width: 42px; justify-content: center; padding: 0; }
  .customer-context-button > span:last-child { display: none; }
}

/* Readability: keep supporting copy dark and large enough for daily use. */
.content,
.topbar,
.login-view,
.customer-picker-view,
.modal-backdrop {
  color: #111;
}

.content p,
.content small,
.content label,
.content legend,
.content .cell-sub,
.content .stat-info span,
.content .stat-info small,
.content .panel-header p,
.content .inbound-toolbar p,
.content .section-title-row p,
.content .material-entry-head p,
.content .quick-note,
.content .summary-box span,
.content .receipt-footer .left-note,
.topbar p,
.topbar small,
.topbar .profile-text span,
.login-view p,
.login-view small,
.login-view label,
.customer-picker-view p,
.customer-picker-view small,
.customer-picker-view label,
.modal-backdrop p,
.modal-backdrop small,
.modal-backdrop label,
.modal-backdrop legend,
.customer-modal .norm-edit-head p,
.customer-delete-body p,
.customer-delete-body small,
.account-customer-field legend,
.account-customer-field small,
.account-customer-option {
  color: #111;
}

.content p,
.content .stat-info span,
.content .panel-header p,
.content .inbound-toolbar p,
.content .section-title-row p,
.content .material-entry-head p,
.content .receipt-footer .left-note,
.topbar p,
.login-view p,
.customer-picker-view p,
.modal-backdrop p {
  font-size: 12px;
  line-height: 1.5;
}

.content label,
.content legend,
.modal-backdrop label,
.modal-backdrop legend,
.login-view label,
.customer-picker-view label {
  font-size: 12px;
  line-height: 1.4;
}

.content small,
.content .cell-sub,
.content .stat-info small,
.content .quick-note,
.content .summary-box span,
.topbar small,
.login-view small,
.customer-picker-view small,
.modal-backdrop small {
  font-size: 11px;
  line-height: 1.45;
}

.content input,
.content select,
.content textarea,
.login-view input,
.login-view select,
.customer-picker-view input,
.customer-picker-view select,
.modal-backdrop input,
.modal-backdrop select,
.modal-backdrop textarea {
  color: #111;
  font-size: 13px;
}

.content input::placeholder,
.content textarea::placeholder,
.login-view input::placeholder,
.customer-picker-view input::placeholder,
.modal-backdrop input::placeholder,
.modal-backdrop textarea::placeholder {
  color: #333;
  opacity: 1;
}

.content table th,
.content table td,
.modal-backdrop table th,
.modal-backdrop table td {
  color: #111;
  font-size: 12px;
}

:where(.content, .topbar, .login-view, .customer-picker-view, .modal-backdrop) * {
  font-size: max(11px, 1em);
}

.content :where(.secondary-btn, .table-filter-btn, .cell-main, .cell-sub),
.content .pagination button:not(.active),
.content table td :where(span, div):not(.status-chip):not([class*="status"]):not([class*="positive"]):not([class*="negative"]):not([class*="shortage"]):not([class*="success"]):not([class*="danger"]):not([class*="warning"]),
.modal-backdrop :where(.secondary-btn, .table-filter-btn, .cell-main, .cell-sub),
.modal-backdrop table td :where(span, div):not(.status-chip):not([class*="status"]):not([class*="positive"]):not([class*="negative"]):not([class*="shortage"]):not([class*="success"]):not([class*="danger"]):not([class*="warning"]) {
  color: #111;
}

.content .pagination button.active {
  color: #fff;
}

.edit-history-page {
  display: grid;
  gap: 16px;
}

.edit-history-filters {
  display: grid;
  grid-template-columns: 160px 160px minmax(280px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

.edit-history-filters .field {
  margin: 0;
}

.edit-history-filters .field > span {
  display: block;
  margin-bottom: 6px;
  color: #111;
  font-size: 12px;
  font-weight: 700;
}

.edit-history-search {
  width: 100%;
  min-width: 0;
}

.edit-history-scroll {
  max-height: calc(100vh - 330px);
  min-height: 280px;
  overflow: auto;
}

.edit-history-table {
  min-width: 980px;
}

.edit-history-table th:nth-child(1) { width: 155px; }
.edit-history-table th:nth-child(2) { width: 170px; }
.edit-history-table th:nth-child(3) { width: 125px; }
.edit-history-table th:nth-child(4) { width: 190px; }
.edit-history-table th:nth-child(5) { min-width: 340px; }

.edit-history-user {
  display: grid;
  gap: 3px;
}

.edit-history-user span {
  color: #111;
  font-size: 11px;
}

.edit-history-action {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.edit-history-action.is-create { background: #e8f8ef; color: #137a43; }
.edit-history-action.is-update { background: #eaf1ff; color: #2859ba; }
.edit-history-action.is-delete { background: #ffeaea; color: #bd2f2f; }
.edit-history-action.is-complete { background: #fff3d7; color: #8b5a00; }

.edit-history-detail {
  max-width: 620px;
  overflow-wrap: anywhere;
  color: #111;
  line-height: 1.5;
}

.edit-history-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding: 12px 18px;
}

.edit-history-pagination > label,
.edit-history-page-controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.edit-history-page-size-control {
  position: relative;
}

.edit-history-pagination label span,
.edit-history-page-controls strong {
  color: #111;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.edit-history-pagination select {
  width: 86px;
  height: 38px;
  appearance: none;
  border: 1px solid #d7dfeb;
  border-radius: 6px;
  background: #fff;
  padding: 0 32px 0 12px;
  color: #111;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.edit-history-page-size-control::after {
  content: "⌄";
  position: absolute;
  right: 11px;
  bottom: 8px;
  color: #4a5870;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.edit-history-pagination select:hover {
  border-color: #9eb2d3;
  background: #fbfcff;
}

.edit-history-pagination select:focus {
  outline: none;
  border-color: #4475f2;
  box-shadow: 0 0 0 3px rgba(68, 117, 242, .12);
}

.edit-history-page-controls .icon-btn {
  width: 36px;
  height: 36px;
  color: #111;
  font-size: 20px;
}

.edit-history-page-controls .icon-btn:disabled {
  cursor: not-allowed;
  opacity: .4;
}

@media (max-width: 920px) {
  .edit-history-filters {
    grid-template-columns: 1fr 1fr;
  }

  .edit-history-search {
    grid-column: 1 / -1;
  }

  .edit-history-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .edit-history-page-controls {
    justify-content: space-between;
  }
}
