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

.app-shell {
  /* base.css 提供 width / margin */
}

.topbar {
  margin-bottom: 18px;
  padding: 24px;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 22px;
  line-height: 1.35;
}

.topbar p,
.result-head p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

/* ─── 上传区 ─── */

.upload-panel {
  padding: 24px;
}

form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 260px) auto;
  gap: 14px;
  align-items: stretch;
}

.file-drop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  cursor: pointer;
  gap: 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.file-drop:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(17, 24, 39, 0.06);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-title {
  font-weight: 800;
}

.file-name {
  color: var(--muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.title-field {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.title-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.title-field input {
  width: 100%;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-weight: 700;
}

.title-field input::placeholder {
  color: #9ca3af;
}

button {
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  min-height: 40px;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

/* ─── 结果区 ─── */

.result-panel {
  margin-top: 18px;
  overflow: hidden;
}

.hidden {
  display: none;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

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

/* ─── 未匹配面板 ─── */
/* base.css 提供基础样式，此处覆盖特有值 */

.unmatched-panel {
  margin: 0 24px;
}

.unmatched-table-wrap {
  max-height: 200px;
}

.unmatched-table th,
.unmatched-table td {
  padding: 8px 10px;
}

/* ─── 主表格 ─── */

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

table {
  min-width: 700px;
}

th, td {
  padding: 12px 14px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  font-size: 14px;
}

.total-row td {
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
  text-align: center;
  border-top: 2px solid var(--text);
}

/* ─── 打印 ─── */

.print-area {
  display: none;
}

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

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

  header.suite-nav,
  .topbar,
  .upload-panel,
  .result-head,
  .unmatched-panel,
  .result-actions {
    display: none !important;
  }

  .result-panel {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }

  .table-wrap {
    display: none !important;
  }

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

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

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

  .print-title-cell {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    padding: 1mm 0.5mm;
    line-height: 1.05;
    border: 1px solid #333 !important;
  }

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

  .print-page col.print-col-style {
    width: 13.5%;
  }

  .print-page col.print-col-sku {
    width: 13.5%;
  }

  .print-page col.print-col-color {
    width: 5.5%;
  }

  .print-page col.print-col-shelf {
    width: 57%;
  }

  .print-page col.print-col-size {
    width: 5.5%;
  }

  .print-page col.print-col-quantity {
    width: 5%;
  }

  .print-page col.print-col-subtotal {
    width: 5%;
  }

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

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

  .print-page td {
    text-align: center;
  }

  .print-page .print-col-shelf {
    letter-spacing: 0;
  }

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

  .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 10mm 4mm;
  }
}

/* ─── 移动端 ─── */

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    margin: 12px auto 24px;
  }

  .topbar,
  .upload-panel,
  .result-head {
    border-radius: 14px;
    padding: 14px;
  }

  .topbar,
  form,
  .result-head,
  .file-drop {
    display: block;
  }

  h1 {
    font-size: 22px;
  }

  button {
    width: 100%;
    margin-top: 12px;
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .unmatched-panel {
    margin: 12px 14px 0;
  }

  .file-name {
    display: block;
    text-align: left;
    margin-top: 6px;
  }

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

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