*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --red: #e60012;
  --red-dark: #c90010;
  --text: #1a1a1a;
  --text-muted: #999;
  --border: #eee;
  --bg: #f5f5f5;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
}

/* ===== 子页顶栏 ===== */
.sub-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 12px 8px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: linear-gradient(180deg, #e60012 0%, #d40011 100%);
}

.sub-header h1 {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  letter-spacing: 0.5px;
}

.sub-back {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sub-back svg {
  width: 22px;
  height: 22px;
}

/* ===== 工具栏 ===== */
.sub-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
  background: #fff;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 18px;
  border: none;
  border-radius: 20px;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-pill:active {
  opacity: 0.85;
}

/* ===== Tab 切换 ===== */
.sub-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.sub-tab {
  flex: 1;
  padding: 14px 0;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.sub-tab.active {
  color: var(--red);
  font-weight: 600;
}

.sub-tab.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 28px;
  height: 2px;
  background: var(--red);
  border-radius: 1px;
}

/* ===== 空状态 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 40px;
  min-height: 360px;
}

.empty-illustration {
  width: 160px;
  height: 120px;
  margin-bottom: 20px;
  color: #c8d6e0;
}

.empty-text {
  font-size: 14px;
  color: var(--text-muted);
}

/* ===== 表单卡片 ===== */
.form-card {
  margin: 12px;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
}

.form-row {
  display: flex;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #f5f5f5;
  min-height: 52px;
}

.form-row:last-child {
  border-bottom: none;
}

.form-row.stack {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.form-label {
  flex-shrink: 0;
  width: 100px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.form-row.stack .form-label {
  width: auto;
}

.form-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  text-align: right;
  min-width: 0;
}

.form-row.stack .form-input {
  text-align: left;
}

.form-input::placeholder {
  color: #ccc;
}

.form-textarea {
  width: 100%;
  min-height: 80px;
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  line-height: 1.6;
}

.form-textarea::placeholder {
  color: #ccc;
}

.form-select {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 15px;
  color: #ccc;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.form-select.has-value {
  color: var(--text);
}

.form-select svg {
  width: 16px;
  height: 16px;
  color: #ccc;
  flex-shrink: 0;
}

/* ===== 单选组 ===== */
.radio-group {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 20px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.radio-item input {
  display: none;
}

.radio-dot {
  width: 18px;
  height: 18px;
  border: 2px solid #ddd;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}

.radio-item input:checked + .radio-dot {
  border-color: var(--red);
}

.radio-item input:checked + .radio-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: var(--red);
  border-radius: 50%;
}

/* ===== 底部按钮 ===== */
.btn-fixed {
  display: block;
  width: calc(100% - 32px);
  margin: 24px auto;
  padding: 14px;
  border: none;
  border-radius: 24px;
  background: var(--red);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-fixed:active {
  opacity: 0.9;
}

.page-has-fixed-btn {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

/* ===== 地址列表 ===== */
.address-list {
  padding: 12px;
}

.address-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 10px;
}

.address-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.address-name {
  font-size: 16px;
  font-weight: 600;
}

.address-phone {
  font-size: 14px;
  color: var(--text-muted);
}

.address-tag {
  font-size: 11px;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 3px;
  padding: 1px 5px;
}

.address-tag.default {
  background: var(--red);
  color: #fff;
}

.address-detail {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}
