/* ============ 基础层：变量 / 重置 / 通用控件 ============
   设计语言参考 zibll（子比）主题：
   1) 边框极淡（rgba 5~6%），层次靠「无方向柔光阴影」而不是硬边线；
   2) 输入框是「填充式」——无边框、页面底色打底，聚焦时才亮起主题色描边 + 4px 光晕；
   3) 按钮 4px 小圆角、悬停只降透明度（opacity .8）不换色，按下给内阴影；
   4) 主色只做点缀：focus / 选中 / 主 CTA，大面积仍是白与灰。
   ──────────────────────────────────────────────────────────── */
:root {
  /* 品牌色：改这一处，下面所有衍生色（光晕/浅底/选中）跟着变 */
  --brand: #ff3200;
  --brand-dark: #cc2800;
  --brand-soft: #fff0ec;

  --focus-color: var(--brand);
  --focus-05: color-mix(in srgb, var(--focus-color) 5%, transparent);
  --focus-10: color-mix(in srgb, var(--focus-color) 10%, transparent);
  --focus-30: color-mix(in srgb, var(--focus-color) 30%, transparent);
  --focus-shadow: color-mix(in srgb, var(--focus-color) 42%, transparent);

  /* 文字层级：key / main / muted / muted-2 四级足够，不用纯黑 */
  --ink: #23262b;
  --ink-2: #4e5358;
  --muted: #7b828c;
  --muted-2: #9aa1ab;

  /* 底色：body 灰、卡片白、弱底再深一档 */
  --bg: #f5f6f7;
  --card: #ffffff;
  --fill: #f0f1f3;
  --line: rgba(50, 50, 50, .07);
  --line-2: rgba(50, 50, 50, .04);

  --danger: #d93b3b;
  --danger-soft: #fdecec;
  --ok: #15925c;
  --warn: #b7791f;

  /* 圆角：卡片 8、小件 6、按钮 4（子比的比例） */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-btn: 4px;

  /* 阴影：无方向柔光。子比卡片是 0 0 10px，没有向下偏移 */
  --shadow-sm: 0 0 10px rgba(116, 116, 116, .08);
  --shadow: 0 0 16px rgba(116, 116, 116, .12);
  --shadow-lg: 0 0 30px rgba(116, 116, 116, .16);
  --shadow-inset: inset 0 2px 3px rgba(0, 0, 0, .08);

  --blur-bg: rgba(255, 255, 255, .8);

  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding-left: 0; list-style: none; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #ced2d8; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b6bbc4; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 启动占位 ---------------- */
.boot-splash {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
}
.boot-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #fff));
  animation: bootPulse 1.1s ease-in-out infinite;
}
@keyframes bootPulse { 0%, 100% { transform: scale(1); opacity: .55; } 50% { transform: scale(1.12); opacity: 1; } }

/* ---------------- 通用容器 ---------------- */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }

/* ---------------- 按钮 ----------------
   子比手感：默认浅灰填充、无可见边框；悬停只降透明度；按下内凹 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px;
  border: 1px solid transparent; border-radius: var(--radius-btn);
  background: var(--fill); color: var(--ink-2);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  text-shadow: 0 0 0;
  transition: opacity .15s, background .15s, border-color .15s, box-shadow .15s, color .15s;
}
.btn:hover { opacity: .8; background: var(--fill); text-decoration: none; color: var(--ink); }
.btn:active { box-shadow: var(--shadow-inset); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; opacity: .86; }
.btn-primary:disabled { opacity: .45; }

.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); opacity: .8; }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--fill); color: var(--ink-2); opacity: 1; }

/* 描边按钮（子比的 .hollow） */
.btn-line { background: transparent; border-color: color-mix(in srgb, var(--ink) 14%, transparent); color: var(--ink-2); }
.btn-line:hover { border-color: var(--focus-color); color: var(--focus-color); background: transparent; opacity: 1; }

.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: var(--radius-btn); }
.btn-lg { height: 44px; padding: 0 24px; font-size: 15px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
/* 胶囊按钮（子比的 .radius）：一页里最多用一次，用在唯一主 CTA 上 */

/* ---------------- 表单控件 ----------------
   填充式：无边框 + 页面底色；聚焦才亮主题色 + 4px 光晕 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; padding: 9px 12px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font-size: 14px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { resize: vertical; line-height: 1.7; min-height: 84px; }
.input:hover, .textarea:hover, .select:hover { border-color: var(--focus-30); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--focus-color); background: var(--card);
  box-shadow: 0 0 2px 3px var(--focus-shadow);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input.err, .textarea.err { border-color: var(--danger); }
.field-err { font-size: 12px; color: var(--danger); }

.checkline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.checkline input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------------- 卡片 / 徽标 ----------------
   无边框，靠柔光分层 —— 子比的 .zib-widget */
.card {
  background: var(--card);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; background: var(--fill); color: var(--ink-2);
}
.badge-blue { background: var(--focus-10); color: var(--brand-dark); }
.badge-green { background: #e8f7ef; color: var(--ok); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-gray { background: var(--fill); color: var(--muted); }

.empty {
  padding: 46px 20px; text-align: center; color: var(--muted); border-radius: var(--radius);
  border: 1px dashed var(--line); background: rgba(255, 255, 255, .6);
}
.empty strong { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 6px; }

/* ---------------- 提示条 / Toast ---------------- */
.alert {
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.6;
  border: 1px solid transparent;
}
.alert-err { background: var(--danger-soft); border-color: transparent; color: #a32525; }
.alert-warn { background: #fdf6e6; border-color: transparent; color: var(--warn); }

.toasts {
  position: fixed; z-index: 3000; left: 50%; transform: translateX(-50%);
  top: 18px; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  padding: 9px 16px; border-radius: 999px; font-size: 13px; color: #fff;
  background: rgba(24, 30, 42, .93); box-shadow: var(--shadow);
  animation: toastIn .22s ease;
}
/* 白字 13px 压在 .95 的 #15925c 上合成只有 3.70:1；加深到 rgba(15,122,74,.97) → 实测 5.38:1。
   只改这条实心底，--ok 变量与其它用 --ok 的组件不动 */
.toast-ok { background: rgba(15, 122, 74, .97); }
.toast-err { background: rgba(217, 59, 59, .95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(30, 32, 36, .38); display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn .16s ease;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.modal {
  width: 100%; max-width: 460px; background: #fff; border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden; animation: modalIn .18s ease;
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-wide { max-width: 620px; }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--line-2); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98) } to { opacity: 1; transform: none } }

/* ---------------- 图标按钮 ---------------- */
.icobtn {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: var(--fill); border-radius: var(--radius-btn); color: var(--ink-2);
  font-size: 14px; line-height: 1; padding: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.icobtn:hover { opacity: .8; background: var(--fill); color: var(--ink); }
.icobtn:disabled { opacity: .35; cursor: not-allowed; }
.icobtn.danger:hover { background: var(--danger-soft); color: var(--danger); opacity: 1; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.nowrap { white-space: nowrap; }

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
}

/* 开关（个人信息里的布尔项） */
.switch-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.switch { position: relative; width: 40px; height: 22px; flex: none; margin-top: 1px; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: #cfd2d8; border-radius: 999px; transition: background .18s; display: block; }
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(16,24,40,.25);
  transition: transform .18s;
}
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: 0 0 2px 3px var(--focus-shadow); }
