/* ==========================================================================
   楼盘资源管理系统 —— 公共样式（前台 H5 与后台共用）
   主色调：珊瑚橙 #FF6B3D
   ========================================================================== */
:root {
  --primary: #ff6b3d;
  --primary-dark: #f0512a;
  --primary-soft: #fff2ec;
  --primary-grad: linear-gradient(180deg, #ff7a45 0%, #ff9d72 60%, #ffb392 100%);

  --bg: #f4f6f9;
  --bg-2: #eef1f6;
  --card: #ffffff;

  --text: #1f2733;
  --text-2: #6b7684;
  --text-3: #a5aebc;
  --border: #eaeef4;
  --input-bg: #edf1f7;

  --success: #21b573;
  --warning: #f5a623;
  --danger: #f5484b;
  --info: #3d8bff;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 6px 24px rgba(31, 39, 51, 0.08);
  --shadow-sm: 0 2px 10px rgba(31, 39, 51, 0.06);
  --shadow-btn: 0 8px 18px rgba(255, 107, 61, 0.32);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
input, button, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, h5, p { margin: 0; }

/* ------------------------------ 布局容器 ------------------------------ */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 480px; margin: 0 auto; }
.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ------------------------------ 卡片 ------------------------------ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title::before {
  content: "";
  width: 4px;
  height: 15px;
  border-radius: 3px;
  background: var(--primary);
  display: inline-block;
}

/* ------------------------------ 表单 ------------------------------ */
.field {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 50px;
  transition: box-shadow 0.2s, background 0.2s;
}
.field + .field { margin-top: 14px; }
.field:focus-within {
  background: #e8eef7;
  box-shadow: 0 0 0 2px rgba(255, 107, 61, 0.25);
}
.field input, .field select, .field textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  height: 100%;
  font-size: 15px;
  min-width: 0;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field .suffix { color: var(--text-3); display: flex; align-items: center; padding-left: 8px; }
.field .prefix { color: var(--text-3); padding-right: 10px; font-size: 14px; white-space: nowrap; }
.field.area { height: auto; padding: 12px 14px; align-items: flex-start; }
.field.area textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.field.lg { height: 54px; }

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin: 16px 0 6px;
}
.form-label:first-child { margin-top: 0; }
.form-label .req { color: var(--danger); margin-left: 2px; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.12s, opacity 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-btn); }
.btn-primary:hover:not([disabled]) { background: var(--primary-dark); }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-plain { background: #f0f3f8; color: var(--text-2); }
.btn-danger { background: #feecec; color: var(--danger); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 999px; font-weight: 500; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; font-weight: 500; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text-2); }

/* ------------------------------ 复选框 ------------------------------ */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox i {
  width: 19px;
  height: 19px;
  border-radius: 5px;
  border: 1.5px solid #cfd6e0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex: none;
  background: #fff;
}
.checkbox input:checked + i {
  background: var(--primary);
  border-color: var(--primary);
}
.checkbox input:checked + i::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* ------------------------------ 标签 / 徽章 ------------------------------ */
.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-2);
  color: var(--text-2);
}
.tag-primary { background: var(--primary-soft); color: var(--primary); }
.tag-success { background: #e8f8f0; color: var(--success); }
.tag-warning { background: #fef5e6; color: var(--warning); }
.tag-danger { background: #feecec; color: var(--danger); }
.tag-info { background: #eaf2ff; color: var(--info); }

/* ------------------------------ 表格 ------------------------------ */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  font-size: 13px;
  padding: 10px 12px;
  background: #f7f9fc;
  white-space: nowrap;
}
table.tbl th:first-child { border-radius: 8px 0 0 8px; }
table.tbl th:last-child { border-radius: 0 8px 8px 0; }

table.tbl td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tbody tr:hover { background: #fafbfd; }
table.tbl tbody tr:last-child td { border-bottom: none; }
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* 上移 / 下移 小箭头 */
.row-actions .btn.mv {
  padding: 0; width: 26px; min-width: 26px; font-size: 10px; line-height: 1;
  color: var(--text-3); flex: none;
}
.row-actions .btn.mv:hover:not(:disabled) { background: var(--primary-soft); color: var(--primary); }
.row-actions .btn.mv:disabled { opacity: .3; cursor: not-allowed; }

/* ------------------------------ 空状态 / 加载 ------------------------------ */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}
.empty .icon { font-size: 34px; margin-bottom: 8px; opacity: 0.6; }
.loading { padding: 40px; text-align: center; color: var(--text-3); font-size: 14px; }
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255, 107, 61, 0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------ 提示条 ------------------------------ */
.toast-host {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  width: max-content;
  max-width: 84vw;
}
.toast {
  background: rgba(31, 39, 51, 0.9);
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  animation: toastIn 0.22s ease-out;
  backdrop-filter: blur(4px);
  word-break: break-word;
}
.toast.success { background: rgba(33, 181, 115, 0.94); }
.toast.error { background: rgba(245, 72, 75, 0.94); }
.toast.warning { background: rgba(245, 166, 35, 0.95); }
@keyframes toastIn {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------ 弹窗 ------------------------------ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 30, 0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.16s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.modal.wide { max-width: 620px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  padding: 18px 20px 12px;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 0 20px 4px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 14px 20px 18px;
  display: flex;
  gap: 10px;
}
.modal-foot .btn { flex: 1; }

/* ------------------------------ 工具类 ------------------------------ */
.flex { display: flex; }
.flex-1 { flex: 1; min-width: 0; }
.between { display: flex; align-items: center; justify-content: space-between; }
.items-center { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.text-2 { color: var(--text-2); } .text-3 { color: var(--text-3); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-14 { font-size: 14px; }
.fs-18 { font-size: 18px; } .fs-22 { font-size: 22px; } .fs-26 { font-size: 26px; }
.bold { font-weight: 600; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ------------------------------ 开关 ------------------------------ */
.switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #d8dee8;
  transition: background 0.2s;
  flex: none;
  border: none;
  padding: 0;
}
.switch.on { background: var(--primary); }
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch.on::after { transform: translateX(20px); }

/* ------------------------------ 进度条 ------------------------------ */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-2);
  overflow: hidden;
  display: flex;
}
.progress span { display: block; height: 100%; }
.progress .p-sold { background: var(--primary); }
.progress .p-reserved { background: var(--warning); }
