* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f6f7;
  color: #1f2328;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d8dce2;
  border-radius: 8px;
  padding: 10px 12px;
  color: #1f2328;
  font-size: 14px;
  outline: none;
  background: #ffffff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #111111;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.06);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #edf0f3;
  padding: 12px 10px;
  text-align: left;
  font-size: 14px;
}

th {
  color: #666d76;
  background: #fafafa;
  font-weight: 700;
}

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

.sidebar {
  width: 226px;
  padding: 22px 16px;
  background: #111111;
  color: #ffffff;
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 10px 12px 24px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: 0;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.sidebar nav a {
  padding: 12px 13px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.78);
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: #ffffff;
  color: #111111;
}

.sidebar nav a:active {
  transform: translateY(1px);
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 12px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.8;
}

.main {
  min-width: 0;
  flex: 1;
  padding: 28px;
}

.topbar {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 650;
}

.api-link {
  color: #996b13;
  font-weight: 700;
}

.panel {
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid #e8ebef;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(23, 25, 29, 0.035);
  overflow-x: auto;
}

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

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

.product-form {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: 18px;
  border: 1px solid #edf0f3;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #fbfbfb);
}

.form-section-title {
  margin-bottom: 16px;
  padding-left: 10px;
  border-left: 3px solid #111111;
  color: #111111;
  font-size: 16px;
  font-weight: 650;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.form-grid label,
.inline-form label {
  display: grid;
  gap: 7px;
  color: #59606a;
  font-size: 13px;
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

.settings-hint {
  padding: 12px 14px;
  border-radius: 10px;
  background: #f7f8fa;
  color: #6d747d;
  font-size: 13px;
  line-height: 1.6;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 120px 120px auto;
  gap: 12px;
  align-items: end;
}

.upload-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px dashed #dfe3e8;
  border-radius: 10px;
  background: #ffffff;
}

.upload-row input {
  flex: 1;
}

.check {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  color: #1f2328 !important;
}

.check input {
  width: auto;
}

.switch-list {
  display: grid;
  gap: 14px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #edf0f3;
  font-weight: 700;
}

.switch-row input {
  width: 22px;
  height: 22px;
}

.btn {
  min-height: 38px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  padding: 0 16px;
  background: #ffffff;
  color: #1f2328;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.btn:hover {
  opacity: 0.9;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  border-color: #111111;
  background: #111111;
  color: #ffffff;
}

.btn.danger {
  border-color: #f1c7c7;
  background: #fff4f4;
  color: #b92626;
}

.btn.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-row form {
  margin: 0;
}

.order-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bulk-order-form {
  margin: 0 0 14px;
}

.bulk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-row input {
  min-height: 32px;
  width: 150px;
}

.order-check {
  width: 18px;
  height: 18px;
}

.orders-panel {
  overflow-x: auto;
}

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

.summary-card {
  min-height: 118px;
  padding: 18px;
  border: 1px solid #e8ebef;
  border-radius: 12px;
  background: #ffffff;
  color: #1f2328;
  display: grid;
  align-content: center;
  gap: 8px;
  box-shadow: 0 10px 24px rgba(23, 25, 29, 0.035);
}

.summary-card.highlight {
  border-color: #111111;
}

.summary-card span {
  color: #68707a;
  font-size: 13px;
  font-weight: 700;
}

.summary-card strong {
  color: #111111;
  font-size: 34px;
  font-weight: 650;
  line-height: 1;
}

.summary-card em {
  color: #8a929c;
  font-size: 12px;
  font-style: normal;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background:
    linear-gradient(135deg, #111111 0%, #262626 100%);
  color: #ffffff;
}

.dashboard-kicker {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-hero h2 {
  margin: 8px 0 6px;
  font-size: 28px;
  line-height: 1.2;
}

.dashboard-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

.dashboard-hero .btn.primary {
  border-color: #ffffff;
  background: #ffffff;
  color: #111111;
}

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

.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.dashboard-action {
  min-height: 112px;
  padding: 18px;
  border: 1px solid #edf0f3;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #fbfbfb);
  display: grid;
  align-content: center;
  gap: 8px;
}

.dashboard-action strong {
  color: #111111;
  font-size: 16px;
}

.dashboard-action span {
  color: #6d747d;
  font-size: 13px;
  line-height: 1.5;
}

.order-table th,
.order-table td {
  vertical-align: top;
}

.filter-pill {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #dfe3e8;
  border-radius: 18px;
  background: #ffffff;
  color: #1f2328;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 650;
}

.filter-pill.active {
  border-color: #111111;
  background: #111111;
  color: #ffffff;
}

.table-note {
  margin-bottom: 12px;
  color: #6d747d;
  font-size: 13px;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.status-pending {
  background: #fff5d6;
  color: #8a5a00;
}

.status-approved {
  background: #e7f7ed;
  color: #1c7c3d;
}

.status-rejected {
  background: #fff0f0;
  color: #bb2e2e;
}

.status-new {
  background: #fff5d6;
  color: #8a5a00;
}

.status-contacted {
  background: #eef3ff;
  color: #2f55a4;
}

.status-done {
  background: #e7f7ed;
  color: #1c7c3d;
}

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

.alert.success {
  background: #e7f7ed;
  color: #1c7c3d;
}

.alert.error {
  background: #fff0f0;
  color: #bb2e2e;
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 18% 12%, rgba(17, 17, 17, 0.05), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f7f8fa 100%);
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 32px;
  border: 1px solid #e8ebef;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.08);
  display: grid;
  gap: 14px;
}

.login-card h1 {
  margin: 0;
  color: #111111;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: 0;
}

.login-card p {
  margin: 0 0 12px;
  color: #6d747d;
  line-height: 1.6;
}

@media (max-width: 900px) {
  body {
    overflow-x: hidden;
  }

  .shell {
    display: flex;
    align-items: stretch;
  }

  .sidebar {
    width: 164px;
    flex: 0 0 164px;
    min-height: 100vh;
    max-height: 100vh;
    padding: 14px 10px;
    position: sticky;
    top: 0;
    z-index: 20;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .brand {
    padding: 4px 6px 14px;
    font-size: 17px;
    line-height: 1.25;
  }

  .sidebar nav {
    display: grid;
    gap: 6px;
  }

  .sidebar nav a {
    min-height: 38px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    white-space: normal;
    line-height: 1.25;
  }

  .sidebar-foot {
    margin-top: 10px;
    padding: 10px 6px 0;
    display: grid;
    gap: 6px;
    font-size: 13px;
  }

  .main {
    min-width: 0;
    max-width: calc(100vw - 164px);
    padding: 14px 12px 24px;
    overflow-x: hidden;
  }

  .form-grid,
  .form-grid.compact,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 14px;
    gap: 8px;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.25;
  }
}

@media (max-width: 640px) {
  .sidebar {
    width: 126px;
    flex-basis: 126px;
    padding: 12px 7px;
  }

  .brand {
    padding: 2px 5px 12px;
    font-size: 15px;
  }

  .sidebar nav a {
    min-height: 42px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 13px;
    word-break: break-word;
  }

  .sidebar-foot {
    padding-left: 5px;
    padding-right: 5px;
    font-size: 12px;
  }

  .main {
    max-width: calc(100vw - 126px);
  }

  input,
  select,
  textarea {
    min-height: 42px;
    padding: 10px;
    font-size: 15px;
  }

  textarea {
    min-height: 130px;
  }

  .panel {
    margin-bottom: 14px;
    padding: 14px 12px;
    border-radius: 10px;
    overflow-x: hidden;
  }

  .product-form {
    gap: 14px;
  }

  .form-section {
    padding: 14px 12px;
    border-radius: 10px;
  }

  .form-section-title {
    margin-bottom: 12px;
    font-size: 15px;
  }

  .summary-grid {
    margin-bottom: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

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

  .dashboard-hero h2 {
    font-size: 24px;
  }

  .dashboard-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dashboard-action {
    min-height: 96px;
    padding: 14px;
  }

  .summary-card {
    min-height: 104px;
    padding: 14px 12px;
    border-radius: 10px;
  }

  .summary-card strong {
    font-size: 28px;
  }

  .form-grid {
    gap: 12px;
  }

  .form-grid label,
  .inline-form label {
    font-size: 13px;
  }

  .upload-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px;
  }

  .upload-row .btn {
    min-width: 86px;
    padding: 0 10px;
  }

  .btn {
    min-height: 42px;
    padding: 0 14px;
    font-size: 14px;
    line-height: 1.2;
    text-align: center;
  }

  .btn.small {
    min-height: 36px;
    padding: 0 10px;
  }

  .order-filter {
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }

  .filter-pill {
    flex: 0 0 auto;
  }

  .bulk-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 8px;
  }

  .bulk-row input,
  .bulk-row select,
  .bulk-row button {
    width: 100%;
  }

  .bulk-row button {
    min-width: 0;
  }

  .action-row {
    gap: 6px;
    align-items: stretch;
  }

  .action-row form {
    display: inline-flex;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  .panel table {
    min-width: 680px;
  }

  .orders-panel {
    padding: 12px;
    overflow-x: visible;
  }

  .order-table {
    min-width: 0 !important;
    border-collapse: separate;
    border-spacing: 0 12px;
  }

  .order-table thead {
    display: none;
  }

  .order-table tbody,
  .order-table tr,
  .order-table td {
    display: block;
    width: 100%;
  }

  .order-table tr {
    padding: 12px;
    border: 1px solid #edf0f3;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(23, 25, 29, 0.04);
  }

  .order-table td {
    min-height: 36px;
    padding: 8px 0;
    border-bottom: 1px dashed #edf0f3;
    white-space: normal;
    word-break: break-word;
  }

  .order-table td:last-child {
    border-bottom: 0;
  }

  .order-table td::before {
    display: block;
    margin-bottom: 4px;
    color: #6d747d;
    font-size: 12px;
    font-weight: 700;
  }

  .order-table td:nth-child(1)::before {
    content: "选择";
  }

  .order-table td:nth-child(2)::before {
    content: "订单号";
  }

  .order-table td:nth-child(3)::before {
    content: "商品";
  }

  .order-table td:nth-child(4)::before {
    content: "金额";
  }

  .order-table td:nth-child(5)::before {
    content: "收货信息";
  }

  .order-table td:nth-child(6)::before {
    content: "备注";
  }

  .order-table td:nth-child(7)::before {
    content: "物流信息";
  }

  .order-table td:nth-child(8)::before {
    content: "状态";
  }

  .order-table td:nth-child(9)::before {
    content: "时间";
  }

  .order-table td:nth-child(10)::before {
    content: "操作";
  }

  .order-table td[style] {
    max-width: none !important;
    white-space: normal !important;
  }

  .order-table td form {
    min-width: 0 !important;
  }

  .order-table .action-row,
  .order-table td form {
    width: 100%;
  }

  .order-table td .btn,
  .order-table td button,
  .order-table td select,
  .order-table td input {
    width: 100%;
  }

  .order-table td form[style] {
    display: grid !important;
    gap: 8px !important;
  }

  .switch-row {
    gap: 12px;
    align-items: flex-start;
  }

  .login-card {
    padding: 24px 18px;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .sidebar {
    width: 112px;
    flex-basis: 112px;
  }

  .brand {
    font-size: 14px;
  }

  .sidebar nav a {
    font-size: 12px;
    padding: 0 7px;
  }

  .main {
    max-width: calc(100vw - 112px);
    padding-left: 8px;
    padding-right: 8px;
  }

  .panel {
    padding-left: 10px;
    padding-right: 10px;
  }

  .upload-row {
    grid-template-columns: 1fr;
  }

  .upload-row .btn {
    width: 100%;
  }

  .bulk-row {
    grid-template-columns: 1fr;
  }
}
