/* 依赖：shared/base.css（变量、reset、公共组件） */

.page-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-head {
  margin-bottom: 18px;
}

.login-head h1 {
  font-size: 28px;
  font-weight: 800;
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 20px auto 36px;
}

/* admin 特有：.card / .hero / .nav 卡片样式 */
.card,
.hero,
.nav {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.nav-brand {
  font-weight: 800;
  font-size: 18px;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
}

.nav-link.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.hero {
  margin-top: 18px;
  padding: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.subtext {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

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

.card {
  grid-column: span 6;
  padding: 24px;
}

.card-full {
  grid-column: span 12;
}

.page-split {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 18px;
  margin-top: 18px;
}

.card-top {
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.panel-card {
  padding: 24px;
}

.panel-card-match {
  justify-self: end;
  width: 100%;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.card-head h2 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.inline,
.toolbar,
.actions,
.summary-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.check-field {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.check-field input {
  width: 18px;
  min-height: auto;
  height: 18px;
  padding: 0;
  margin: 0;
}

.warehouse-filter-select {
  width: 104px;
  min-width: 0;
  flex: 0 0 104px;
}

.warehouse-toolbar {
  flex: 1 1 auto;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.warehouse-filter-row,
.warehouse-selects,
.warehouse-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.warehouse-filter-row {
  flex: 1 1 480px;
}

.warehouse-filter-row input {
  flex: 1 1 260px;
  min-width: 180px;
}

.warehouse-filter-row #warehouseShelfFilter {
  flex: 0 1 220px;
}

.warehouse-selects {
  flex: 0 0 auto;
}

.warehouse-actions {
  justify-content: flex-end;
  margin-left: auto;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.warehouse-toolbar .btn {
  white-space: nowrap;
}

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

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 18px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-bottom: 8px;
}

/* admin 特有：未匹配表列宽 */
.unmatched-head {
  padding: 12px 14px;
}

.unmatched-table-wrap {
  overflow-x: hidden;
}

.unmatched-table {
  min-width: 0;
}

.unmatched-table th:nth-child(1),
.unmatched-table td:nth-child(1) {
  width: 28%;
}

.unmatched-table th:nth-child(2),
.unmatched-table td:nth-child(2) {
  width: 24%;
}

.unmatched-table th:nth-child(3),
.unmatched-table td:nth-child(3) {
  width: 20%;
  padding-left: 10px;
}

.unmatched-table th:nth-child(4),
.unmatched-table td:nth-child(4),
.unmatched-table th:nth-child(5),
.unmatched-table td:nth-child(5) {
  width: 14%;
}

.print-sheet-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

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

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

.print-sheet-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.print-sheet-option input {
  width: 16px;
  height: 16px;
  min-height: auto;
  padding: 0;
}

.print-sheet-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.print-sheet-option small {
  color: var(--muted);
  white-space: nowrap;
}

.match-print-area {
  display: none;
}

.search-panel,
.result-panel {
  min-height: 140px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
}

.search-result {
  min-height: 156px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  background: var(--surface);
}

.search-result.empty {
  color: var(--muted);
}

.search-result-list {
  display: grid;
  gap: 10px;
}

.search-result-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  max-width: 100%;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-hover);
  box-sizing: border-box;
}

.search-result-row > div {
  min-width: 0;
  overflow: hidden;
}

.search-result-row span {
  display: block;
  white-space: nowrap;
}

.search-result-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--muted);
}

.stock-deleted-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

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

.stock-deleted-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--danger-bg, #fef2f2);
  color: var(--danger, #dc2626);
  font-size: 12px;
  font-weight: 700;
}

.stock-deleted-list {
  display: grid;
  gap: 6px;
}

.stock-deleted-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
}

.stock-deleted-item span {
  font-weight: 700;
  color: var(--text);
}

.search-list {
  display: grid;
  gap: 10px;
}

.search-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-hover);
}

.search-head {
  font-weight: 700;
  color: var(--muted);
}

.summary-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
}

/* admin 特有：表格 */
table {
  min-width: 1240px;
}

.warehouse-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.warehouse-table th,
.warehouse-table td {
  padding: 10px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warehouse-table thead th {
  height: 42px;
  padding: 0 8px;
  vertical-align: middle;
  line-height: 1.2;
}

.warehouse-table th:nth-child(1),
.warehouse-table td:nth-child(1) {
  width: 24px;
  text-align: center;
}

.warehouse-table input[type="checkbox"] {
  width: 12px;
  height: 12px;
  min-height: auto;
  padding: 0;
  margin: 0;
}

.warehouse-table .table-sort {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.warehouse-table .table-sort-center {
  justify-content: center;
  text-align: center;
}

.warehouse-table .table-sort.is-active {
  color: var(--accent, #2563eb);
}

.warehouse-table th:nth-child(2),
.warehouse-table td:nth-child(2) {
  width: 12%;
}

.warehouse-table th:nth-child(3),
.warehouse-table td:nth-child(3) {
  width: 12%;
}

.warehouse-table th:nth-child(4),
.warehouse-table td:nth-child(4) {
  width: 8%;
}

.warehouse-table th:nth-child(5),
.warehouse-table td:nth-child(5) {
  width: 7%;
}

.warehouse-table th:nth-child(6),
.warehouse-table td:nth-child(6) {
  width: 6%;
}

.warehouse-table th:nth-child(7),
.warehouse-table td:nth-child(7) {
  width: 18%;
}

.warehouse-table th:nth-child(8),
.warehouse-table td:nth-child(8) {
  width: 12%;
}

.warehouse-table th:nth-child(9),
.warehouse-table td:nth-child(9) {
  width: 54px;
  text-align: center;
}

.warehouse-table th:nth-child(10),
.warehouse-table td:nth-child(10) {
  width: 138px;
  text-align: right;
}

.warehouse-table .pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warehouse-table .actions {
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.warehouse-table .actions .btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.warehouse-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.warehouse-pagination-actions {
  display: flex;
  gap: 8px;
}


th,
td {
  padding: 14px 16px;
}

.empty,
.empty-tip,
.search-note {
  color: var(--muted);
}

.pda-query-title {
  display: none;
}

body.pda-mode .suite-nav,
body.pda-mode .panel-card-match,
body.pda-mode .card-record,
body.pda-mode .card-warehouse {
  display: none !important;
}

body.pda-mode .desktop-query-title {
  display: none;
}

body.pda-mode .pda-query-title {
  display: inline;
}

body.pda-mode .page {
  margin-top: 10px;
}

body.pda-mode .page-split {
  grid-template-columns: 1fr;
}

body.pda-mode .card-top {
  padding: 10px;
}

@media (max-width: 1024px) {
  .card,
  .card-full,
  .page-split,
  .page-split > * {
    grid-column: span 12;
  }

  .page-split {
    grid-template-columns: 1fr;
  }

  .fields,
  .stats,
  .search-row {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 980px;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100% - 18px, 1000px);
    margin: 12px auto 24px;
  }

  .page-login {
    width: min(100% - 18px, 1000px);
    padding: 12px 0 24px;
    align-items: flex-start;
  }

  .login-card,
  .nav,
  .hero,
  .card,
  .panel-card {
    border-radius: 14px;
    padding: 14px;
  }

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

  .inline,
  .toolbar,
  .actions {
    flex-direction: column;
  }

  .fields {
    display: flex;
    flex-direction: column;
  }

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

  .page-split {
    gap: 14px;
    margin-top: 12px;
  }

  .search-result,
  .search-panel,
  .result-panel {
    min-height: auto;
  }


  .search-result,
  .search-result p,
  .search-result span {
    font-size: 11px;
    line-height: 1.5;
    word-break: break-word;
  }

  .search-result-row strong {
    font-size: 11px;
  }

  .stat strong {
    font-size: 24px;
  }

  table {
    min-width: 560px;
    font-size: 12px;
  }

  th,
  td {
    padding: 10px 8px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .suite-links {
    display: none !important;
  }

  .panel-card-match,
  .card-warehouse {
    display: none;
  }

  .card-top {
    padding: 10px;
  }

  .panel-card {
    padding: 12px;
  }

  .panel-card > .card-head {
    flex-direction: row;
    align-items: center;
  }

  #logoutButton {
    width: auto;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .search-result-list {
    gap: 10px;
  }

  .search-result-row {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 12px;
  }

  .search-result-row > div {
    padding: 9px 0;
    border-bottom: 1px solid #f3f4f6;
  }

  .search-result-row > div:last-child {
    border-bottom: 0;
  }

  #searchKeyword {
    min-height: 48px;
    font-size: 16px;
  }

}

@media (max-width: 480px) {
  #logoutButton {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html,
  body {
    margin: 0;
    padding: 0;
    background: #fff;
  }

  body > :not(.match-print-area) {
    display: none !important;
  }

  .match-print-area {
    display: block !important;
  }

  .match-print-page {
    height: 230mm;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  .match-print-page table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    flex: 0 0 auto;
  }

  .match-print-page thead {
    display: table-header-group;
  }

  .match-print-page tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .match-print-page th,
  .match-print-page td {
    border: 1px solid #333 !important;
    padding: 0.45mm 0.25mm;
    font-size: 14px;
    line-height: 1.05;
    height: 26px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
  }

  .match-print-page th {
    background: #e8eaed !important;
    font-weight: 700;
  }

  .match-print-page .match-print-total-row td {
    border-top: 2px solid #333 !important;
    background: #f3f4f6 !important;
    font-weight: 700;
  }

  .match-print-page-footer {
    margin-top: auto;
    padding-top: 1mm;
    text-align: center;
    color: #555;
    font-size: 14px;
    line-height: 1.05;
  }

  @page {
    size: B5 portrait;
    margin: 10mm;
  }
}
