html,
body {
  min-height: 100%;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#app > .wrap {
  /* 覆盖旧 .wrap 的四向 auto 外边距，避免它作为 flex 子项时被压缩、垂直居中。 */
  flex: 1 0 auto;
  width: 100%;
  margin: 0 auto;
}

#app > .footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* 账户、订单等动态页面使用的顶部导航与静态首页保持同一套稳定布局。 */
#app > .top {
  display: flex;
  flex: 0 0 auto;
  width: 100%;
}

#app > .top > .brand {
  display: block;
  flex: 0 0 auto;
}

#app > .top > nav {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

#app > .top > form {
  flex: 0 0 150px;
}

#app > .top > .account-actions {
  flex: 0 0 auto;
}

/* 旧静态导航的账户链接由 mall.js 统一接管，避免登录后和“我的”入口重复。 */
.account-actions > a[href="#/account"]:not([data-login-link]) {
  display: none;
}

.mall-auth,
.mall-content {
  max-width: 680px;
  margin: 0 auto;
}

.mall-auth h1,
.mall-content h1 {
  margin-bottom: 8px;
}

.mall-auth .small,
.mall-content .small {
  margin-bottom: 18px;
}

.mall-form {
  display: grid;
  gap: 14px;
}

.mall-form label {
  display: grid;
  gap: 6px;
}

.mall-form .form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mall-form button {
  justify-self: start;
}

.mall-help {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.mall-help a {
  color: #917842;
}

.mall-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5ecd7;
  color: #806124;
  font-size: 12px;
}

.mall-status.verified {
  background: #e5f4ee;
  color: var(--green);
}

.mall-status.pending {
  background: #fff2d8;
  color: #a46c15;
}

.mall-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.mall-empty {
  padding: 46px 20px;
  text-align: center;
}

.mall-cart-table td,
.mall-cart-table th {
  vertical-align: middle;
}

.mall-cart-table input {
  max-width: 84px;
}

.mall-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 16px;
}

.mall-order {
  margin-bottom: 16px;
}

.mall-order-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.mall-order-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
}

.mall-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: #23201b;
  box-shadow: 0 8px 30px #0004;
}

.mall-toast.error {
  background: #9c4945;
}

.mall-product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.mall-product-actions button {
  border: 0;
}

.mall-top-user {
  color: #d8bb78;
}

.chart.mall-live-chart-note {
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: linear-gradient(135deg, #fffdf8, #f2ece1);
}

.quote-grid.market-three-items {
  grid-template-columns: repeat(3, 1fr);
}

/* 筛选标签占两行，提交按钮仅与输入框这一行对齐。 */
.filters {
  align-items: end;
}

.filters > label {
  display: grid;
  gap: 4px;
}

.filters > button {
  align-self: end;
  min-height: 37px;
  padding: 8px 18px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .mall-form .form-row {
    grid-template-columns: 1fr;
  }

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

  .mall-cart-table thead {
    display: none;
  }

  .mall-cart-table tr {
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
  }

  .mall-cart-table td {
    border: 0;
    padding: 4px 0;
    text-align: left;
  }

  .mall-cart-table td:last-child {
    text-align: right;
  }

  .mall-summary {
    align-items: flex-end;
    flex-direction: column;
  }

  .mall-product-actions {
    width: 100%;
    margin-left: 0;
  }

  .mall-product-actions button {
    flex: 1;
  }
}
