:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #6b7690;
  --line: #d8e0ec;
  --blue: #2f6bea;
  --blue-dark: #2454bd;
  --blue-soft: #eaf1ff;
  --green: #16825f;
  --amber: #9b6a05;
  --red: #bd3b24;
  --sidebar-width: 188px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
}

.portal-shell {
  width: min(980px, calc(100vw - 240px));
  margin: 18px auto 24px;
}

.portal-head {
  margin-bottom: 12px;
}

.portal-head-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}

.portal-head-company {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #edf4e6;
  color: #637c4f;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.portal-head h1 {
  margin-bottom: 4px;
  font-size: 28px;
  font-weight: 900;
}

.portal-head p {
  margin-bottom: 0;
  color: #76829b;
  font-size: 17px;
  line-height: 1.45;
}

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

.portal-tile {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  min-height: 118px;
  padding: 16px 18px 14px;
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(37,72,128,.08);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.portal-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(37,72,128,.12);
  text-decoration: none;
}

.portal-tile-content {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.portal-tile-main {
  min-width: 0;
}

.portal-tile-main h2 {
  margin: 0 0 8px;
  font-size: 20px;
  color: #fff;
  line-height: 1.2;
}

.portal-tile-main p {
  margin: 0;
  color: rgba(255,255,255,.86);
  font-size: 13px;
  line-height: 1.45;
}

.portal-tile-mark {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: rgba(52, 63, 83, .58);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
}

.portal-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.portal-tile-tag,
.portal-tile-enter {
  color: rgba(255,255,255,.92);
  font-size: 12px;
  font-weight: 700;
}

.portal-tile.is-disabled {
  opacity: .7;
  cursor: default;
}

.portal-tile.is-disabled:hover {
  transform: none;
  box-shadow: 0 10px 26px rgba(37,72,128,.10);
}

.portal-tile.accent-blue { background: linear-gradient(135deg, #de6259, #cc4f45); }
.portal-tile.accent-green { background: linear-gradient(135deg, #57bf62, #389f46); }
.portal-tile.accent-amber { background: linear-gradient(135deg, #f8b556, #ee9c3c); }
.portal-tile.accent-purple { background: linear-gradient(135deg, #5a9ad0, #3d7fba); }
.portal-tile.accent-slate { background: linear-gradient(135deg, #38bea9, #219a89); }

.portal-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.portal-config-span-2 {
  grid-column: span 2;
}

.portal-config-inline {
  display: grid;
  gap: 12px;
}

.toolbar.compact {
  margin-bottom: 12px;
}

.auth-entry {
  display: flex;
  justify-content: flex-end;
  margin: 20px 0 12px;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.sidebar {
  width: var(--sidebar-width);
  background: #f8fbff;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  box-shadow: 2px 0 18px rgba(34,74,130,.06);
  z-index: 20;
}

.sidebar-brand {
  display: grid;
  gap: 5px;
  padding: 18px 16px 16px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff 0%, #f3f7ff 100%);
  border-bottom: 1px solid var(--line);
  position: relative;
}

.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 22px;
  width: 4px;
  height: 28px;
  border-radius: 999px;
  background: var(--blue);
}
.sidebar-brand strong { font-size: 19px; padding-left: 10px; letter-spacing: 0; }
.sidebar-brand span { color: #7a86a0; font-size: 12px; padding-left: 10px; }

.side-nav {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.side-link {
  color: #4c5872;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
}

.side-link:hover {
  background: #eef5ff;
  color: var(--blue-dark);
  text-decoration: none;
}

.side-link.active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(47,107,234,.18);
}

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

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

.topbar-title {
  color: #273248;
  font-size: 16px;
  font-weight: 800;
}

.userbar {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
}

.container {
  width: min(1520px, calc(100vw - var(--sidebar-width) - 36px));
  margin: 12px auto;
  min-width: 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
  min-width: 0;
}

.toolbar > div:first-child {
  min-width: 0;
}

.toolbar h1 {
  margin-bottom: 2px;
  line-height: 1.18;
  font-size: 25px;
}

.toolbar p {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.master-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.catalog-side {
  background: #fff;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  padding: 18px 16px;
  box-shadow: 0 10px 26px rgba(37,72,128,.05);
}

.catalog-side h2 {
  font-size: 16px;
  margin-bottom: 14px;
}

.catalog-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
}

.catalog-link {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #d7e1f0;
  border-radius: 8px;
  color: #324156;
  background: #fff;
}

.catalog-link strong {
  font-size: 14px;
  font-weight: 800;
}

.catalog-link span {
  color: var(--muted);
  font-size: 12px;
}

.catalog-link:hover {
  text-decoration: none;
  border-color: #b9ccff;
  background: #f8fbff;
}

.catalog-link.active {
  border-color: #bfd0ff;
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.catalog-main {
  min-width: 0;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 27px; color: #1d2940; }
h2 { font-size: 18px; margin-bottom: 16px; }
p { color: var(--muted); line-height: 1.55; }

.button, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #ccd6e6;
  border-radius: 8px;
  padding: 0 16px;
  background: #fff;
  color: #22304a;
  font-weight: 700;
  cursor: pointer;
}

.button:hover { text-decoration: none; }
.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 6px 14px rgba(47,107,234,.16); }
.primary:hover { background: var(--blue-dark); }
.danger { background: #fff3ef; border-color: #ffc8ba; color: var(--red); }
button.danger { background: var(--red); border-color: var(--red); color: #fff; }
.drop-ship-action {
  background: #fff1f1;
  border-color: #ffb2a6;
  color: #cf2e2e;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(207,46,46,.10);
}
.drop-ship-action-static {
  cursor: default;
}

.actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

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

.filterbar {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 12px;
}

.filterbar a {
  color: var(--muted);
  font-weight: 700;
}

.receiver-panel {
  margin: 0 0 16px;
  padding: 14px 16px 16px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(37,72,128,.05);
}

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

.receiver-head h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

.receiver-head p {
  margin-bottom: 0;
  font-size: 13px;
}

.receiver-search {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.receiver-search input {
  width: 220px;
  min-width: 220px;
}

.receiver-section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.receiver-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #435067;
}

.receiver-selected,
.receiver-candidates {
  display: grid;
  gap: 8px;
}

.receiver-chip,
.receiver-candidate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fdfefe;
}

.receiver-chip span,
.receiver-candidate strong {
  font-weight: 800;
  color: #334055;
}

.receiver-candidate span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.chip-close {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: #eef3fb;
  color: #6b7690;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.receiver-empty {
  color: var(--muted);
  font-size: 13px;
}

.receiver-results {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.demand-no-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.demand-no-cell > div {
  min-width: 0;
}

.demand-no-cell a {
  display: inline-block;
  max-width: 100%;
}

.receiver-search-live input[type="search"] {
  width: 260px;
  min-width: 260px;
}

@media (max-width: 960px) {
  .receiver-head {
    flex-direction: column;
  }
  .receiver-search input {
    width: 100%;
    min-width: 0;
  }
}

.sync-url-panel {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(37,72,128,.05);
}

.sync-url-panel summary {
  cursor: pointer;
  color: #26344d;
  font-weight: 800;
}

.sync-url-panel input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-panel {
  display: grid;
  gap: 12px;
  background: #fff;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  padding: 12px 16px 14px;
  margin-bottom: 12px;
  box-shadow: 0 10px 26px rgba(37,72,128,.05);
}

.filter-fields {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  justify-content: start;
}

.quick-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.quick-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #ccd6e6;
  background: #fff;
  color: #344158;
  font-weight: 800;
}

.quick-link:hover {
  text-decoration: none;
  border-color: #b9ccff;
  color: var(--blue);
}

.quick-link.active {
  background: var(--blue-soft);
  border-color: #bfd0ff;
  color: var(--blue-dark);
}

.logistics-company-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
}

.logistics-company-chip {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #ccd6e6;
  background: #fff;
  color: #344158;
  font-weight: 800;
  cursor: pointer;
}

.logistics-company-chip:hover {
  border-color: #91aefe;
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.login-panel.supplier-logistics-panel {
  min-height: 0;
  width: min(980px, calc(100% - 48px));
  margin: 36px auto;
  display: block;
  grid-template-columns: none;
  gap: 0;
  align-items: stretch;
}

.supplier-logistics-panel .supplier-logistics-title {
  display: block;
  margin-bottom: 18px;
}

.supplier-logistics-panel .supplier-logistics-title h1 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.12;
}

.supplier-logistics-panel .supplier-logistics-title p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  white-space: normal;
}

.supplier-logistics-panel .supplier-logistics-meta {
  margin-bottom: 18px;
}

.supplier-logistics-panel .supplier-logistics-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.supplier-logistics-panel .supplier-logistics-form {
  margin: 0;
  padding: 18px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(37,72,128,.05);
}

.supplier-logistics-panel .supplier-logistics-items {
  margin: 0;
  width: 100%;
}

.supplier-logistics-panel .supplier-logistics-items .table {
  table-layout: fixed;
}

.supplier-logistics-panel .supplier-logistics-items th:nth-child(1),
.supplier-logistics-panel .supplier-logistics-items td:nth-child(1) {
  width: 18%;
}

.supplier-logistics-panel .supplier-logistics-items th:nth-child(2),
.supplier-logistics-panel .supplier-logistics-items td:nth-child(2) {
  width: 30%;
}

.supplier-logistics-panel .supplier-logistics-items th:nth-child(3),
.supplier-logistics-panel .supplier-logistics-items td:nth-child(3) {
  width: 18%;
}

.supplier-logistics-panel .supplier-logistics-items th:nth-child(4),
.supplier-logistics-panel .supplier-logistics-items td:nth-child(4) {
  width: 12%;
}

.supplier-logistics-panel .supplier-logistics-items th:nth-child(5),
.supplier-logistics-panel .supplier-logistics-items td:nth-child(5) {
  width: 22%;
}

.supplier-logistics-panel .supplier-logistics-items th,
.supplier-logistics-panel .supplier-logistics-items td {
  vertical-align: middle;
  word-break: break-word;
}

.supplier-logistics-panel .supplier-logistics-form .logistics-company-chips {
  margin-bottom: 0;
}

.supplier-logistics-panel .supplier-logistics-form button.primary {
  width: 100%;
}

.filter-panel .filter-field {
  display: grid;
  gap: 6px;
  color: #536079;
  font-size: 12px;
  font-weight: 800;
  position: relative;
}

.filter-panel .filter-field span {
  line-height: 1;
}

.filter-panel .field-date {
  width: auto;
}

.filter-panel .field-product {
  width: auto;
}

.filter-panel .field-demand-no {
  width: auto;
}

.filter-panel .field-user,
.filter-panel .field-warehouse,
.filter-panel .field-status {
  width: auto;
}

.filter-panel .field-supplier {
  width: auto;
}

.filter-panel .field-order-state {
  width: 116px;
  min-width: 116px;
}

.filter-panel .field-status {
  width: 116px;
  min-width: 116px;
}

.filter-panel .field-order-state select {
  width: 100%;
  min-width: 0;
}

.filter-panel .field-date {
  grid-column: span 2;
}

.filter-panel .field-supplier,
.filter-panel .field-customer {
  grid-column: span 1;
}

.filter-panel .field-demand-no,
.filter-panel .field-product,
.filter-panel .field-customer,
.filter-panel .field-user,
.filter-panel .field-channel,
.filter-panel .field-warehouse,
.filter-panel .field-supplier,
.filter-panel .field-status,
.filter-panel .field-order-state {
  min-width: 0;
}

.date-range {
  display: grid;
  grid-template-columns: 1fr 14px 1fr;
  gap: 6px;
  align-items: center;
}

.date-range input {
  padding-left: 9px;
  padding-right: 8px;
  width: 100%;
  min-width: 0;
}

.date-range em {
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
  text-align: center;
}

.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  width: auto;
  order: 2;
}

.filter-actions .button,
.filter-actions button {
  min-width: 70px;
  height: 38px;
  padding: 0 12px;
}

.filter-actions .list-refresh-button {
  font-weight: 900;
}

.filter-actions .list-refresh-button span {
  color: #dc2626;
}

.filter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.filter-footer .quick-filters {
  order: 1;
}

.batchbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 12px;
  background: #fff;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  padding: 12px;
}

.batchbar span {
  color: var(--muted);
  font-size: 13px;
}

.batchbar-dual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

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

.batch-action-item button {
  flex: 0 0 auto;
}

.batch-action-item span {
  display: block;
  line-height: 1.5;
}

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

.wide-actions {
  gap: 8px;
}

.row-actions a,
.row-actions form {
  font-weight: 700;
  white-space: nowrap;
}

.row-actions form {
  margin: 0;
}

.row-actions form .mini-button {
  width: 100%;
}

.inline-form {
  display: inline-flex;
  align-items: center;
}

.user-row-actions .mini-button {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0;
}

.user-row-actions {
  display: grid;
  grid-template-columns: repeat(2, 92px);
  gap: 8px;
  justify-content: start;
}

.user-row-actions .inline-form,
.user-row-actions a.mini-button {
  width: 92px;
}

.row-actions a {
  white-space: nowrap;
}

.actions-cell, .actions-head {
  width: 220px;
}

.wide-actions .mini-button {
  min-width: 72px;
}

.check-col {
  width: 42px;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #d2dbea;
  border-radius: 6px;
  background: #fff;
  color: #344158;
  font-size: 12px;
  line-height: 1;
  text-align: center;
}

.mini-button:hover {
  text-decoration: none;
  border-color: #b9ccff;
  color: var(--blue);
}

.mini-button.disabled {
  opacity: .48;
  pointer-events: none;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 0 0 8px;
  color: #536079;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  overflow-x: auto;
  white-space: nowrap;
  width: 100%;
  max-width: 100%;
}

.pagination-inline,
.pagination-size-form,
.pagination-jump-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.pagination-inline {
  max-width: 100%;
  min-height: 28px;
}

.pagination-size-form,
.pagination-jump-form {
  margin: 0;
}

.pagination-bar select,
.pagination-bar input,
.pagination-bar button,
.pagination-bar .mini-button {
  box-sizing: border-box;
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1;
}

.pagination-bar select {
  width: 52px !important;
  min-width: 52px !important;
  max-width: 52px !important;
  height: 26px;
  padding: 2px 4px;
}

.pagination-jump-form input[type="number"] {
  width: 48px !important;
  min-width: 48px !important;
  max-width: 48px !important;
  height: 26px;
  padding: 2px 4px;
}

.pagination-bar .mini-button {
  min-height: 26px;
  padding: 6px 8px;
}

.pagination-footer {
  margin: 8px 0 0;
}

.pagination-source {
  display: none !important;
}

.mini-button.primary-link {
  background: var(--blue-soft);
  border-color: #bfd0ff;
  color: var(--blue-dark);
}

.mini-button.danger-link {
  background: #fff3ef;
  border-color: #ffc8ba;
  color: var(--red);
}

.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
}

.metric span { display: block; color: var(--muted); margin-bottom: 8px; }
.metric strong { font-size: 30px; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.table-card {
  background: #fff;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: 0 10px 26px rgba(37,72,128,.05);
}

.table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

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

.table tbody tr:hover {
  background: #fafcff;
}

.table th {
  color: #536079;
  font-size: 13px;
  background: #f6f9fd;
  white-space: nowrap;
}

.table.compact th, .table.compact td {
  padding: 10px 12px;
}

.stock-alert-page .stock-alert-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.stock-alert-page .list-meta {
  margin: 0 0 14px;
}

.stock-alert-page .filterbar {
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0 0 14px;
}

.stock-alert-page .stock-alert-main-filter {
  align-items: center;
}

.stock-alert-page .filterbar input,
.stock-alert-page .filterbar select {
  width: 140px;
  min-width: 140px;
}

.stock-alert-page .stock-alert-main-filter input[name="q"],
.stock-alert-page .stock-alert-main-filter input[name="supplier"] {
  width: 170px;
  min-width: 170px;
}

.stock-alert-page .stock-alert-main-filter select[name="level"],
.stock-alert-page .stock-alert-main-filter select[name="alert"] {
  width: 118px;
  min-width: 118px;
}

.stock-alert-page .stock-alert-filter-button {
  border-color: #d9e2f0;
  color: #536079;
  min-width: 118px;
}

.stock-alert-page .stock-alert-filter-button.active {
  border-color: #2f6fed;
  background: #eef4ff;
  color: #1c55d9;
}

.stock-alert-page .filterbar button,
.stock-alert-page .filterbar .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.stock-alert-page .stock-alert-stats-filter {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid #e1e7f0;
  min-height: 58px;
  padding: 12px;
}

.stock-alert-page .stock-alert-stats-filter label {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  flex-direction: row;
  gap: 8px;
  margin: 0;
  white-space: nowrap;
}

.stock-alert-page .stock-alert-stats-filter input {
  width: 150px;
  min-width: 150px;
}

.stock-alert-page .stock-alert-stats-filter select {
  width: 86px;
  min-width: 86px;
}

.stock-alert-page .stock-alert-stats-range {
  color: #69758c;
  font-weight: 700;
  margin-left: 16px;
  white-space: nowrap;
}

.stock-alert-page .stock-alert-stats-table {
  min-width: 2200px;
}

.stock-alert-page .stock-alert-stats-table th,
.stock-alert-page .stock-alert-stats-table td {
  text-align: center;
  white-space: nowrap;
}

.stock-alert-page .stock-alert-stats-table th:first-child,
.stock-alert-page .stock-alert-stats-table td:first-child {
  left: 0;
  min-width: 160px;
  position: sticky;
  text-align: left;
  z-index: 2;
}

.stock-alert-page .stock-alert-stats-table th:first-child {
  z-index: 4;
}

.stock-alert-page .stock-alert-stats-table th:nth-child(2),
.stock-alert-page .stock-alert-stats-table td:nth-child(2) {
  left: 160px;
  min-width: 120px;
  position: sticky;
  z-index: 2;
}

.stock-alert-page .stock-alert-stats-table th:nth-child(2) {
  z-index: 4;
}

.stock-alert-page .stock-alert-stats-table td:first-child,
.stock-alert-page .stock-alert-stats-table td:nth-child(2) {
  background: #fff;
}

.stock-alert-page .stock-alert-stats-table th:nth-child(n+3):nth-child(-n+6),
.stock-alert-page .stock-alert-stats-avg {
  background: #fff9ed;
}

.stock-alert-page .stock-alert-stats-zero {
  color: #c7d3e5;
}

.stock-alert-page .stock-alert-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
  color: #536079;
  font-weight: 700;
}

.stock-alert-page .stock-alert-tab.active {
  border-color: #2f6fed;
  background: #eef4ff;
  color: #2258c7;
}

.stock-alert-page .stock-alert-table {
  min-width: 3000px;
}

.stock-alert-page .stock-alert-table th,
.stock-alert-page .stock-alert-table td {
  white-space: nowrap;
}

.stock-alert-page .stock-alert-shortage-danger-row td {
  background: #fff1f2;
  color: #b42318;
}

.stock-alert-page .stock-alert-shortage-danger-row td strong {
  color: #b42318;
}

.stock-alert-page .stock-alert-hover-qty {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 0;
  position: relative;
  color: inherit;
  cursor: help;
  font-size: inherit !important;
  font-weight: inherit;
  line-height: inherit;
  text-decoration: underline dotted #8ea0bd;
  text-underline-offset: 3px;
}

.stock-alert-page .stock-alert-hover-qty::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 30;
  display: none;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid #c9d5e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(28, 42, 68, 0.18);
  color: #26334d;
  content: attr(data-tooltip);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.6;
  text-align: left;
  transform: translateX(-50%);
  white-space: pre-line;
}

.stock-alert-page .stock-alert-hover-qty:hover::after {
  display: none;
}

.stock-alert-floating-tooltip {
  position: fixed;
  z-index: 9999;
  display: none;
  min-width: 190px;
  max-width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid #c9d5e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(28, 42, 68, 0.22);
  color: #26334d;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.65;
  pointer-events: none;
  text-align: left;
  white-space: pre-line;
}

.stock-alert-page .stock-alert-column-settings {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
}

.stock-alert-settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 10px;
}

.stock-alert-modal-trigger {
  min-height: 34px;
}

.modal-open {
  overflow: hidden;
}

.stock-alert-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
}

.stock-alert-modal.is-open {
  display: block;
}

.stock-alert-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 33, 55, 0.42);
}

.stock-alert-modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 40px));
  max-height: calc(100vh - 64px);
  margin: 32px auto;
  padding: 18px;
  overflow: auto;
  border: 1px solid #d2dceb;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(28, 42, 68, 0.28);
}

.stock-alert-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stock-alert-modal-head h2 {
  margin: 0;
  color: #17223a;
  font-size: 20px;
}

.modal-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

.stock-alert-page .stock-alert-column-settings summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.stock-alert-page .stock-alert-column-settings form {
  margin-top: 8px;
}

.stock-alert-page .stock-alert-column-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 8px;
  max-height: 220px;
  overflow: auto;
}

.stock-alert-page .stock-alert-column-row {
  display: grid;
  grid-template-columns: 16px 52px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 3px 6px;
  border: 1px solid #e6edf7;
  border-radius: 6px;
  background: #f8fbff;
  color: #26334d;
  font-size: 13px;
  font-weight: 600;
}

.stock-alert-page .stock-alert-column-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0;
}

.stock-alert-page .stock-alert-column-row input[type="number"] {
  width: 52px;
  height: 24px;
  min-height: 24px;
  padding: 1px 4px;
  font-size: 13px;
}

.stock-alert-page .stock-alert-column-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-alert-page .stock-alert-column-settings .inline-actions {
  gap: 8px;
  margin-top: 8px;
}

.stock-alert-page .stock-alert-column-settings .checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.stock-alert-page .stock-alert-column-settings .checkbox-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
}

.stock-alert-modal .inline-actions .checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-width: 0;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #26334d;
  font-size: 13px;
  font-weight: 600;
}

.stock-alert-modal .inline-actions .checkbox-line input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  flex: 0 0 16px;
  margin: 0;
  padding: 0;
  transform: none;
}

.stock-alert-page .stock-alert-editable {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  margin-top: 0;
  color: #e23b2e;
  cursor: text;
  font-size: inherit !important;
  font-weight: 700;
  line-height: inherit;
}

.stock-alert-page .stock-alert-editable:hover {
  background: #fff1ef;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #f2aca5;
}

.stock-alert-page .stock-alert-editable.is-saving {
  background: #fff7e6;
  color: #b26b00;
}

.stock-alert-page .stock-alert-alert-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  margin-top: 0;
  cursor: pointer;
  font-size: inherit !important;
  font-weight: 700;
  line-height: inherit;
}

.stock-alert-page .stock-alert-alert-toggle.is-alert {
  color: #e23b2e;
}

.stock-alert-page .stock-alert-alert-toggle:hover {
  background: #fff1ef;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px #f2aca5;
}

.stock-alert-page .stock-alert-alert-toggle.is-saving {
  background: #fff7e6;
  color: #b26b00;
}

.stock-alert-page .stock-alert-inline-input {
  width: 82px;
  height: 28px;
  padding: 2px 6px;
  border: 1px solid #e23b2e;
  border-radius: 4px;
  color: #e23b2e;
  font: inherit;
  font-weight: 700;
  text-align: center;
}

.stock-alert-page .stock-alert-inline-text-input {
  width: 180px;
  text-align: left;
}

.demand-table {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
}

.demand-table th,
.demand-table td {
  white-space: nowrap;
}

.demand-table .actions-head,
.demand-table .actions-cell {
  width: 220px;
}

.demand-table .check-col {
  width: 42px;
}

.favorite-head,
.favorite-cell {
  width: 48px;
  text-align: center;
  padding-left: 8px;
  padding-right: 4px;
}

.favorite-cell {
  white-space: nowrap;
}

.demand-table .quantity-col {
  width: 90px;
}

.demand-table .date-col {
  width: 118px;
}

.demand-table .demand-no-col {
  width: 210px;
}

.demand-table .product-col {
  width: 150px;
}

.demand-table .warehouse-col {
  width: 78px;
}

.demand-table .supplier-col {
  width: 120px;
}

.demand-table .arrival-col {
  width: 120px;
}

.demand-table .sales-col {
  width: 78px;
}

.demand-table .status-col {
  width: 110px;
}

.demand-table .demand-no-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.demand-attachment-badge {
  display: inline;
  margin-left: 3px;
  padding: 0;
  color: #16a34a !important;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  vertical-align: baseline;
}

.favorite-toggle,
.favorite-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9aa4b6;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
  text-decoration: none;
}

.favorite-toggle.active,
.favorite-button.active {
  color: #c69200;
}

.favorite-toggle:hover,
.favorite-button:hover {
  text-decoration: none;
  color: #4c6fd3;
}

.demand-actions {
  gap: 10px;
}

.filter-field.field-channel {
  width: auto;
}

.filter-field.field-order-state {
  width: auto;
}

.demand-table .product-col,
.demand-table .supplier-col {
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}

.demand-table th {
  position: relative;
}

.demand-table .col-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
}

.demand-table .col-resize-handle::after {
  content: "";
  position: absolute;
  top: 18%;
  left: 50%;
  width: 1px;
  height: 64%;
  background: rgba(47,106,234,.25);
  transform: translateX(-50%);
}

body.is-resizing-cols, body.is-resizing-cols * {
  cursor: col-resize !important;
  user-select: none !important;
}

.demand-table .product-col,
.demand-table .supplier-col,
.demand-table .arrival-col,
.demand-table .sales-col {
  white-space: normal;
  line-height: 1.3;
  word-break: break-word;
}

.demand-table .warehouse-col,
.demand-table .sales-col {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.table td span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.customer-table {
  table-layout: fixed;
}

.customer-wide-table {
  min-width: 1580px;
}

.customer-table .customer-code-col {
  width: 220px;
}

.customer-table .customer-name-col {
  width: 340px;
}

.customer-table .customer-source-col {
  width: 220px;
}

.customer-table .customer-contact-col {
  width: 140px;
}

.customer-table .customer-mobile-col {
  width: 150px;
}

.customer-table .customer-phone-col {
  width: 150px;
}

.customer-table .customer-owner-col {
  width: 120px;
}

.customer-table .customer-sync-col {
  width: 170px;
}

.customer-table .customer-status-col {
  width: 90px;
}

.customer-table td,
.customer-table th {
  overflow: hidden;
}

.customer-table td.customer-contact-col,
.customer-table td.customer-mobile-col,
.customer-table td.customer-phone-col,
.customer-table td.customer-owner-col,
.customer-table td.customer-sync-col,
.customer-table td.customer-code-col,
.customer-table td.customer-source-col,
.customer-table td.customer-status-col {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-table td.customer-name-col strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex !important;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px !important;
  font-weight: 800;
}

.badge.warn { background: #fff4d6; color: var(--amber); }
.badge.info { background: var(--blue-soft); color: var(--blue-dark); }
.badge.ok { background: #daf8ea; color: var(--green); }
.badge.muted { background: #edf1f7; color: #59657a; }

.panel, .card {
  background: #fff;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  padding: 18px;
}

.form {
  display: grid;
  gap: 16px;
}

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

.grid.two > .system-setting-wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 700;
}

.field-block {
  display: grid;
  gap: 7px;
  color: #334155;
  font-weight: 700;
  position: relative;
  min-width: 0;
}

.search-picker {
  position: relative;
  min-width: 0;
}

.field-block > label,
.filter-field > label {
  display: block;
  gap: 0;
  color: inherit;
  font-weight: inherit;
}

input, textarea, select {
  width: 100%;
  border: 1px solid #ccd6e6;
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  color: #22304a;
  background: #fff;
  min-height: 42px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #8fb0ff;
  box-shadow: 0 0 0 3px rgba(47,107,234,.12);
}

[data-invalid="1"] {
  border-color: #e38a8a !important;
  box-shadow: 0 0 0 3px rgba(207,46,46,.12);
  background: #fff7f7;
}

[data-invalid="1"]:focus {
  border-color: #cf2e2e !important;
  box-shadow: 0 0 0 3px rgba(207,46,46,.18);
}

.quote-warehouse-field {
  position: relative;
}

.quote-warehouse-field.is-changed {
  color: var(--red);
}

.quote-warehouse-field.is-changed select {
  border-color: #ff6b6b;
  color: var(--red);
  background-color: #fff7f7;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.quote-warehouse-field.is-drop-ship {
  color: var(--red);
  font-weight: 800;
}

.quote-warehouse-field.is-drop-ship select {
  border-color: #ff6b6b;
  color: var(--red);
  font-weight: 800;
  background-color: #fff4f4;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.search-results {
  display: grid;
  gap: 6px;
  position: relative;
  z-index: 2;
}

.floating-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(37,72,128,.14);
  pointer-events: none;
}

.search-item, .search-empty {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
}

.search-item {
  pointer-events: auto;
}

.search-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.search-empty {
  color: var(--muted);
  font-weight: 400;
}

textarea { resize: vertical; }

.login-panel {
  min-height: calc(100vh - 80px);
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 48px;
  align-items: center;
}

.login-panel h1 { font-size: 54px; }
.hint { font-size: 13px; margin: 0; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.detail-page {
  display: grid;
  gap: 12px;
}

.detail-page .toolbar {
  margin-bottom: 8px;
}

.detail-page .actions .button,
.detail-page .actions button {
  min-height: 36px;
  padding: 0 14px;
}

.compact-panel > h2,
.detail-card > h2 {
  margin-bottom: 12px;
}

.detail-card {
  padding: 16px 18px;
}

.detail-card h2 {
  font-size: 17px;
}

.detail-card dl {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.detail-card dl div {
  min-width: 0;
  padding-bottom: 8px;
}

.detail-card dt {
  font-size: 12px;
  margin-bottom: 4px;
}

.detail-card dd {
  font-size: 14px;
  line-height: 1.45;
}

.warehouse-name {
  white-space: nowrap;
}

.warehouse-drop-highlight {
  color: #cf2e2e;
  font-weight: 800;
}

.late-arrival-text {
  color: #cf2e2e;
  font-weight: 800;
}

.late-arrival-field {
  color: #cf2e2e;
}

.late-arrival-field input {
  color: #cf2e2e;
  font-weight: 800;
  border-color: #f1a2a2;
  background: #fff6f6;
}

.order-sheet {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px 18px;
}

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

.sheet-header h2 {
  margin: 0;
}

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

.order-attachment-list {
  display: grid;
  gap: 12px;
}

.order-attachment-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #f8fbff;
}

.order-attachment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.order-attachment-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.order-attachment-head strong {
  color: #344158;
  font-size: 13px;
}

.order-attachment-demand {
  font-weight: 900;
}

.readonly-form-grid {
  display: grid;
  gap: 10px 12px;
}

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

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

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

.readonly-form-grid.columns-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.readonly-form-grid.columns-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.readonly-field {
  display: grid;
  gap: 5px;
}

.readonly-field span {
  color: #536079;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.readonly-value {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #f8fbff;
  color: #22304a;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.order-items-table {
  overflow-x: auto;
}

.order-items-table .table th,
.order-items-table .table td {
  padding: 8px 10px;
  font-size: 13px;
}

.image-preview-panel {
  padding: 20px;
  overflow: auto;
}

.preview-page {
  width: min(1120px, 100%);
  max-width: 100%;
  margin: 0 auto;
}

.preview-toolbar {
  position: sticky;
  top: 76px;
  z-index: 8;
  margin-bottom: 14px;
  padding-top: 2px;
  background: linear-gradient(180deg, rgba(245,247,251,.96) 0%, rgba(245,247,251,.92) 72%, rgba(245,247,251,0) 100%);
  backdrop-filter: blur(6px);
}

.preview-toolbar .toolbar {
  margin-bottom: 0;
  padding: 14px 16px;
  border: 1px solid #d9e2f0;
  border-radius: 10px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 10px 24px rgba(37,72,128,.08);
}

.preview-toolbar .actions {
  flex-shrink: 0;
}

.file-preview-panel {
  padding: 12px;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
}

.preview-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #f8fbff;
  color: #5a6781;
  font-size: 13px;
  font-weight: 700;
}

.preview-status {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f8fbff;
  border: 1px solid #d9e2f0;
  color: #40506c;
  font-weight: 700;
}

.preview-status.ok {
  background: #edf9f2;
  border-color: #bfe8cc;
  color: #16603d;
}

.preview-status.warn {
  background: #fff8ea;
  border-color: #f2ddb0;
  color: #9b6a05;
}

.preview-status.error {
  background: #fff3f1;
  border-color: #f0c6c1;
  color: #b63b2b;
}

.file-preview-frame {
  width: 100%;
  min-height: calc(100vh - 220px);
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
}

.doc-preview-content {
  min-height: 420px;
  overflow: auto;
}

.doc-preview-shell {
  display: flex;
  justify-content: center;
  padding: 16px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #eef3fb;
  overflow: auto;
}

.doc-preview-paper {
  min-height: 420px;
  width: min(860px, 100%);
  border: 1px solid #dfe5f0;
  border-radius: 8px;
  background: #fff;
  padding: 44px 52px;
  color: #22304a;
  line-height: 1.75;
  box-shadow: 0 14px 28px rgba(32,47,73,.08);
}

.doc-preview-paper h1,
.doc-preview-paper h2,
.doc-preview-paper h3,
.doc-preview-paper h4,
.doc-preview-paper h5,
.doc-preview-paper h6 {
  margin-top: 1.2em;
  margin-bottom: .5em;
}

.doc-preview-paper p,
.doc-preview-paper li,
.doc-preview-paper table {
  margin-top: 0;
  margin-bottom: .8em;
}

.doc-preview-paper table {
  width: 100%;
  border-collapse: collapse;
}

.doc-preview-paper th,
.doc-preview-paper td {
  border: 1px solid #d9e2f0;
  padding: 8px 10px;
  vertical-align: top;
}

.sheet-preview-content {
  display: grid;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.sheet-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.sheet-tab-button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #d4dded;
  border-radius: 8px;
  background: #f7faff;
  color: #42506a;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.sheet-tab-button.active {
  border-color: #8fb0ff;
  background: #eaf1ff;
  color: #1f57c9;
}

.sheet-preview-block {
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(37,72,128,.05);
}

.sheet-preview-block h3 {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid #d9e2f0;
  background: #f8fbff;
  font-size: 15px;
}

.sheet-preview-table {
  overflow: auto;
  padding: 12px;
  max-height: calc(100vh - 320px);
}

.sheet-preview-table table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: max-content;
  background: #fff;
}

.sheet-preview-table th,
.sheet-preview-table td {
  border: 1px solid #d9e2f0;
  padding: 6px 8px;
  white-space: nowrap;
  vertical-align: top;
}

.sheet-preview-table th {
  background: #edf4ff;
  color: #274064;
  font-weight: 800;
}

.image-preview-stage {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: auto;
  padding: 4px;
  max-width: 100%;
}

.image-preview {
  display: block;
  width: auto;
  max-width: min(100%, 1100px);
  max-height: calc(100vh - 220px);
  height: auto;
  margin: 0 auto;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(37,72,128,.08);
  object-fit: contain;
}

.attachment-list {
  display: grid;
  gap: 8px;
}

.attachment-uploader {
  display: grid;
  gap: 14px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.attachment-help {
  color: #5f6c85;
  font-size: 13px;
  font-weight: 700;
}

.attachment-picker-row {
  display: flex;
  align-items: stretch;
  border: 1px solid #8fb0ff;
  border-radius: 14px;
  overflow: hidden;
  min-height: 44px;
  background: #f8fbff;
}

.attachment-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 0 24px;
  background: #fff;
  border-right: 1px solid #8fb0ff;
  color: #22304a;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.attachment-picker-count {
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  color: #2f3950;
  font-size: 14px;
  font-weight: 700;
}

.attachment-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.attachment-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.attachment-card {
  position: relative;
  width: 156px;
  min-height: 136px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 20px 14px 16px;
  border: 1px solid #d9e2f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(37,72,128,.04);
}

.attachment-card-remove {
  position: absolute;
  right: -1px;
  top: -1px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 0 12px 0 12px;
  background: #e23a46;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.attachment-card-icon {
  width: 52px;
  height: 52px;
  border: 2px solid #2f3950;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2f3950;
  font-weight: 900;
  font-size: 20px;
  background: #fff;
}

.attachment-card-name,
.attachment-card-size {
  width: 100%;
  text-align: center;
}

.attachment-card-name {
  color: #202c43;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card-size {
  color: #75809a;
  font-size: 12px;
  font-weight: 700;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.attachment-meta {
  min-width: 0;
}

.attachment-item strong {
  display: block;
  font-size: 14px;
  color: #22304a;
  word-break: break-all;
}

.attachment-item span {
  color: #6b7690;
  font-size: 13px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.log-list {
  display: grid;
  gap: 8px;
}

.log-panel {
  display: grid;
  gap: 8px;
}

.log-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-weight: 800;
  color: #22304a;
  list-style: none;
  user-select: none;
}

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

.log-summary::after {
  content: "展开";
  color: #6b7690;
  font-size: 12px;
  font-weight: 700;
}

.log-panel[open] .log-summary::after {
  content: "收起";
}

.log-summary-meta {
  color: #6b7690;
  font-size: 12px;
  font-weight: 700;
  margin-left: auto;
  padding-right: 10px;
}

.log-item {
  border: 1px solid #d9e2f0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfdff;
}

.log-item-detail {
  padding: 0;
  overflow: hidden;
}

.log-item-summary {
  display: block;
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  user-select: none;
}

.log-item-summary::-webkit-details-marker {
  display: none;
}

.log-item-summary .log-head {
  margin-bottom: 0;
}

.log-item-summary::after {
  content: "展开详情";
  display: block;
  margin-top: 6px;
  color: #6b7690;
  font-size: 12px;
  font-weight: 700;
}

.log-item-detail[open] .log-item-summary::after {
  content: "收起详情";
}

.log-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.log-action {
  color: #22304a;
  font-size: 14px;
}

.log-meta {
  color: #6b7690;
  font-size: 12px;
  font-weight: 700;
}

.log-detail {
  color: #4d5a73;
  line-height: 1.65;
  font-size: 13px;
  overflow-wrap: anywhere;
  padding: 0 12px 12px;
  border-top: 1px dashed #d9e2f0;
  background: #ffffff;
}

.empty-log {
  padding: 18px 0 6px;
  color: #7b8599;
}

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

dl { margin: 0; display: grid; gap: 12px; }
dl div { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
dl div:last-child { border-bottom: 0; padding-bottom: 0; }
dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
dd { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }

.summary-line, .confirm-copy {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
}

.alert {
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.alert.danger { background: #fff7ed; border: 1px solid #fdba74; color: var(--red); }
.form-error-block strong {
  display: block;
  margin-bottom: 6px;
}

.form-error-block ul {
  margin: 0;
  padding-left: 20px;
}

.form-error-block li + li {
  margin-top: 4px;
}

.empty { text-align: center !important; color: var(--muted); padding: 44px !important; }

@media (max-width: 1500px) {
  .filter-fields {
    grid-template-columns: 250px 250px 160px 160px 135px 135px;
  }
  .detail-card dl {
    grid-template-columns: 1fr;
  }
  .readonly-form-grid.columns-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .portal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portal-config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filter-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .filter-actions {
    order: 1;
  }
  .filter-footer .quick-filters {
    order: 2;
  }
  .quick-filters {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .supplier-logistics-layout {
    grid-template-columns: 1fr;
  }
  .supplier-logistics-title {
    display: block;
  }
  .supplier-logistics-title p {
    white-space: normal;
  }
}

@media (max-width: 820px) {
  .portal-shell {
    width: min(100% - 24px, 980px);
    margin: 14px auto 24px;
  }
  .portal-grid {
    grid-template-columns: 1fr;
  }
  .portal-head h1 {
    font-size: 24px;
  }
  .portal-tile {
    min-height: 108px;
    padding: 15px 16px 14px;
  }
  .portal-tile-main h2 {
    font-size: 18px;
  }
  .portal-tile-main p {
    font-size: 12px;
  }
  .portal-tile-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 15px;
  }
  .portal-config-grid {
    grid-template-columns: 1fr;
  }
  .portal-config-span-2 {
    grid-column: span 1;
  }
  .sidebar { position: static; width: 100%; height: auto; }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-content { margin-left: 0; }
  .toolbar, .topbar { align-items: flex-start; flex-direction: column; height: auto; padding: 16px; }
  .container { width: min(100% - 32px, 1280px); }
  .preview-page { width: 100%; }
  .preview-toolbar { top: 0; }
  .preview-toolbar .toolbar { padding: 12px; }
  .doc-preview-paper { padding: 24px 18px; }
  .master-layout { grid-template-columns: 1fr; }
  .metrics, .detail-grid, .grid.two, .login-panel, .report-grid { grid-template-columns: 1fr; }
  .detail-card dl { grid-template-columns: 1fr; }
  .readonly-form-grid.columns-2,
  .readonly-form-grid.columns-3,
  .readonly-form-grid.columns-4,
  .readonly-form-grid.columns-5 { grid-template-columns: 1fr; }
  .filter-fields { grid-template-columns: 1fr; }
  .filter-actions { margin-left: 0; flex-wrap: wrap; }
  .table { display: block; overflow-x: auto; }
  .batchbar-dual { grid-template-columns: 1fr; }
  .batch-action-item { align-items: flex-start; flex-direction: column; gap: 10px; }
}
