/* ==========================================================================
   base.css —— 零依赖 UI 基础库
   原 wx-client 通过 CDN 引入 Vant 2.8（100KB CSS + 250KB JS）。
   这里按 Vant 2.8 的真实样式值 1:1 复刻项目实际用到的组件，替换整个组件库。
   ========================================================================== */

/* ------------------------------ reset ------------------------------ */
html {
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100%;
  background-color: #f7f8fa;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
button, input, textarea { color: inherit; font: inherit; }
button { margin: 0; padding: 0; background: none; border: 0; }
:focus { outline: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
img { border: 0; }

/* 桌面端按手机宽度居中展示（与原 wx-client 行为一致） */
@media screen and (min-width: 960px) {
  body { width: 400px; margin: auto auto; }
}

/* ------------------------------ icon ------------------------------ */
.ui-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ------------------------------ button ------------------------------ */
.ui-btn {
  position: relative;
  display: inline-block;
  box-sizing: border-box;
  height: 44px;
  margin: 0;
  padding: 0;
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity .2s;
  -webkit-appearance: none;
  appearance: none;
  color: #323233;
  background-color: #fff;
  border: 1px solid #ebedf0;
}
.ui-btn::before {
  content: ' ';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background-color: #000;
  border: inherit;
  border-color: #000;
  border-radius: inherit;
  transform: translate(-50%, -50%);
  opacity: 0;
}
.ui-btn:active::before { opacity: .1; }
.ui-btn--primary { color: #fff; background-color: #07c160; border-color: #07c160; }
.ui-btn--info { color: #fff; background-color: #1989fa; border-color: #1989fa; }
.ui-btn--danger { color: #fff; background-color: #ee0a24; border-color: #ee0a24; }
.ui-btn--warning { color: #fff; background-color: #ff976a; border-color: #ff976a; }
.ui-btn--small { min-width: 60px; height: 30px; padding: 0 8px; font-size: 12px; }
.ui-btn--block { display: block; width: 100%; }
.ui-btn--round { border-radius: 999px; }
.ui-btn--disabled { cursor: not-allowed; opacity: .5; }
.ui-btn--loading { cursor: default; }
.ui-btn--loading::before { display: none; }
.ui-btn__content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.ui-btn__loading { color: inherit; font-size: inherit; }
.ui-btn__icon + .ui-btn__text,
.ui-btn__loading + .ui-btn__text { margin-left: 5px; }

/* ------------------------------ loading ------------------------------ */
.ui-loading {
  position: relative;
  color: #c8c9cc;
  font-size: 0;
  vertical-align: middle;
}
.ui-loading__spinner {
  position: relative;
  display: inline-block;
  width: 30px;
  max-width: 100%;
  height: 30px;
  max-height: 100%;
  vertical-align: middle;
  animation: ui-rotate .8s linear infinite;
}
.ui-loading__spinner--spinner { animation-timing-function: steps(12); }
.ui-loading__spinner--spinner i {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.ui-loading__spinner--spinner i::before {
  display: block;
  width: 2px;
  height: 25%;
  margin: 0 auto;
  background-color: currentColor;
  border-radius: 40%;
  content: ' ';
}
.ui-loading__spinner--spinner i:nth-of-type(1) { transform: rotate(30deg); opacity: 1; }
.ui-loading__spinner--spinner i:nth-of-type(2) { transform: rotate(60deg); opacity: .9375; }
.ui-loading__spinner--spinner i:nth-of-type(3) { transform: rotate(90deg); opacity: .875; }
.ui-loading__spinner--spinner i:nth-of-type(4) { transform: rotate(120deg); opacity: .8125; }
.ui-loading__spinner--spinner i:nth-of-type(5) { transform: rotate(150deg); opacity: .75; }
.ui-loading__spinner--spinner i:nth-of-type(6) { transform: rotate(180deg); opacity: .6875; }
.ui-loading__spinner--spinner i:nth-of-type(7) { transform: rotate(210deg); opacity: .625; }
.ui-loading__spinner--spinner i:nth-of-type(8) { transform: rotate(240deg); opacity: .5625; }
.ui-loading__spinner--spinner i:nth-of-type(9) { transform: rotate(270deg); opacity: .5; }
.ui-loading__spinner--spinner i:nth-of-type(10) { transform: rotate(300deg); opacity: .4375; }
.ui-loading__spinner--spinner i:nth-of-type(11) { transform: rotate(330deg); opacity: .375; }
.ui-loading__spinner--spinner i:nth-of-type(12) { transform: rotate(360deg); opacity: .3125; }
@keyframes ui-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ------------------------------ search ------------------------------ */
.ui-search {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  padding: 10px 12px;
  background-color: #fff;
}
.ui-search__content {
  display: flex;
  align-items: center;
  flex: 1;
  padding-left: 8px;
  background-color: #f7f8fa;
  border-radius: 2px;
}
.ui-search__content--round { border-radius: 999px; }
.ui-search__field {
  display: flex;
  align-items: center;
  flex: 1;
  padding: 5px 8px 5px 0;
  background-color: transparent;
}
.ui-search__left-icon {
  display: flex;
  align-items: center;
  min-width: 1em;
  height: 24px;
  margin-right: 5px;
  color: #969799;
  font-size: 16px;
  line-height: 24px;
}
.ui-search__input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: #323233;
  font-size: 14px;
  line-height: 24px;
  background: transparent;
  border: 0;
  -webkit-appearance: none;
  appearance: none;
}
.ui-search__input::placeholder { color: #c8c9cc; }
.ui-search__input::-webkit-search-cancel-button,
.ui-search__input::-webkit-search-decoration,
.ui-search__input::-webkit-search-results-button,
.ui-search__input::-webkit-search-results-decoration { display: none; }
.ui-search__clear {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: -8px;
  padding: 0 8px;
  color: #c8c9cc;
  font-size: 16px;
  line-height: inherit;
  cursor: pointer;
}
.ui-search__action {
  padding: 0 8px;
  color: #323233;
  font-size: 14px;
  line-height: 34px;
  cursor: pointer;
  user-select: none;
}
.ui-search__action:active { background-color: #f2f3f5; }

/* ------------------------------ cell ------------------------------ */
.ui-cell-group { background-color: #fff; }
.ui-cell {
  position: relative;
  display: flex;
  box-sizing: border-box;
  width: 100%;
  padding: 10px 16px;
  overflow: hidden;
  color: #323233;
  font-size: 14px;
  line-height: 24px;
  background-color: #fff;
}
.ui-cell::after {
  content: ' ';
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
  right: 0;
  bottom: 0;
  left: 16px;
  border-bottom: 1px solid #ebedf0;
  transform: scaleY(.5);
}
.ui-cell:last-child::after { display: none; }
.ui-cell__title { flex: 1; }
.ui-cell__value {
  flex: 1;
  color: #969799;
  text-align: right;
  word-wrap: break-word;
}

/* ------------------------------ empty ------------------------------ */
.ui-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 32px 0;
}
.ui-empty__image {
  width: 160px;
  height: 160px;
  background: url('empty.png') center no-repeat;
  background-size: contain;
}
.ui-empty__description {
  margin-top: 16px;
  padding: 0 60px;
  color: #969799;
  font-size: 14px;
  line-height: 20px;
}

/* ------------------------------ pagination ------------------------------ */
.ui-pager {
  display: flex;
  font-size: 14px;
}
.ui-pager__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  box-sizing: border-box;
  min-width: 36px;
  height: 40px;
  color: #1989fa;
  background-color: #fff;
  cursor: pointer;
  user-select: none;
}
.ui-pager__item:active { color: #fff; background-color: #1989fa; }
.ui-pager__item--active { color: #fff; background-color: #1989fa; }
.ui-pager__item--disabled,
.ui-pager__item--disabled:active {
  color: #646566;
  background-color: #f7f8fa;
  cursor: not-allowed;
  opacity: .5;
}
.ui-pager__prev, .ui-pager__next { padding: 0 4px; cursor: pointer; }

/* 分隔线（等价 Vant 的 hairline 方案：0.5px 细线） */
.ui-pager__item::after {
  content: ' ';
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
  top: -50%;
  right: -50%;
  bottom: -50%;
  left: -50%;
  border: 0 solid #ebedf0;
  border-width: 1px 0 1px 1px;
  transform: scale(.5);
}
.ui-pager__item:last-child::after { border-right-width: 1px; }

/* ------------------------------ radio ------------------------------ */
.ui-radio-group { display: block; }
.ui-radio-group--horizontal {
  display: flex;
  flex-wrap: wrap;
}
.ui-radio {
  display: flex;
  align-items: center;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.ui-radio--horizontal { margin-right: 12px; }
.ui-radio__icon {
  flex: none;
  height: 1em;
  font-size: 20px;
  line-height: 1em;
  cursor: pointer;
}
.ui-radio__icon .ui-icon {
  display: block;
  box-sizing: border-box;
  width: 1.25em;
  height: 1.25em;
  color: transparent;
  font-size: .8em;
  line-height: 1.25;
  text-align: center;
  border: 1px solid #c8c9cc;
  border-radius: 100%;
  transition-duration: .2s;
  transition-property: color, border-color, background-color;
}
.ui-radio__icon--checked .ui-icon {
  color: #fff;
  background-color: var(--radio-checked, #1989fa);
  border-color: var(--radio-checked, #1989fa);
}
.ui-radio__label {
  margin-left: 8px;
  color: #323233;
  line-height: 20px;
}

/* ------------------------------ field ------------------------------ */
.ui-field {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  padding: 10px 16px;
  color: #323233;
  font-size: 14px;
  line-height: 24px;
  background-color: #fff;
}
.ui-field__label {
  flex: none;
  box-sizing: border-box;
  width: 90px;
  text-align: left;
}
.ui-field__body { display: flex; align-items: center; flex: 1; }
.ui-field__control {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  color: #323233;
  line-height: inherit;
  text-align: left;
  background-color: transparent;
  border: 0;
  resize: none;
}
.ui-field__control::placeholder { color: #c8c9cc; }
.ui-field__control:disabled {
  color: #c8c9cc;
  background-color: transparent;
  cursor: not-allowed;
  opacity: 1;
  -webkit-text-fill-color: currentColor;
}
.ui-field__control[readonly] { cursor: pointer; }
.ui-field__error-message {
  color: #ee0a24;
  font-size: 12px;
  text-align: left;
}
.ui-field--error .ui-field__control::placeholder { color: #ee0a24; }
.ui-field--error .ui-field__control { color: #ee0a24; }

/* ------------------------------ action sheet ------------------------------ */
.ui-sheet__overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, .7);
  z-index: 2000;
}
.ui-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 80%;
  overflow-y: auto;
  color: #323233;
  background-color: #fff;
  z-index: 2001;
  transform: translate3d(0, 0, 0);
  transition: transform .3s;
  -webkit-overflow-scrolling: touch;
}
.ui-sheet--hidden { transform: translate3d(0, 100%, 0); }
.ui-sheet__description {
  position: relative;
  padding: 16px;
  color: #646566;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}
.ui-sheet__description::after {
  content: ' ';
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
  right: 16px;
  bottom: 0;
  left: 16px;
  border-bottom: 1px solid #ebedf0;
  transform: scaleY(.5);
}
.ui-sheet__item,
.ui-sheet__cancel {
  display: block;
  width: 100%;
  height: 50px;
  padding: 0;
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  background-color: #fff;
  border: none;
  cursor: pointer;
}
.ui-sheet__item:active,
.ui-sheet__cancel:active { background-color: #f2f3f5; }
.ui-sheet__gap {
  display: block;
  height: 8px;
  background-color: #f7f8fa;
}

/* ------------------------------ toast ------------------------------ */
.ui-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: content-box;
  width: 88px;
  max-width: 70%;
  min-height: 88px;
  padding: 16px;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  white-space: pre-wrap;
  text-align: center;
  word-wrap: break-word;
  background-color: rgba(50, 50, 51, .88);
  border-radius: 8px;
  transform: translate3d(-50%, -50%, 0);
  z-index: 5000;
}
.ui-toast--text {
  width: -webkit-fit-content;
  width: fit-content;
  min-width: 96px;
  min-height: 0;
  padding: 8px 12px;
}
.ui-toast--text .ui-toast__text { margin-top: 0; }
.ui-toast--bottom { top: auto; bottom: 50px; }
.ui-toast__icon { font-size: 40px; }
.ui-toast__text { margin-top: 8px; }

/* ------------------------------ 通用工具 ------------------------------ */
.ui-hide { display: none !important; }
.ui-clearfix::after { display: table; clear: both; content: ''; }
