/* =====================================================================
   快询十五分 · 网站端 UI 统一层 V3（2026-11-23）
   依据《UI诊断与统一规范_网站端_V1.0》阶段 1-3 收敛：
   1) 唯一设计令牌（色板 / 字号 / 间距 / 圆角 / 阴影 / 层级）
   2) 组件归一：按钮 / 卡片 / 页面头 / 空态 / Toast / 表单 / 标签 / 弹层
   3) 响应式：720 / 1080 两档断点 + 移动底部导航 + 安全区 + 可达性

   说明：
   - 本文件在 index.html 中最后加载，用于覆盖历史样式，不修改旧文件；
   - 职场锦囊独立页（body.fortune-standalone-body / .fortune-*）保持独立风格，
     本文件除安全区与焦点环外不对其生效。
   ===================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root{
  /* 品牌 */
  --brand:#00B4AD;
  --brand-2:#00A6A7;
  --brand-deep:#0E6A60;
  --brand-soft:#E3F5F2;
  --brand-mist:#F0FAF8;
  --accent:#00B4AD;          /* 主色=品牌青，统一旧层橙/青冲突 */
  --accent-soft:#E3F5F2;
  --accent2:#FC6C38;         /* 暖橙仅用于营销/价格强调 */
  --accent2-soft:#FFEDE5;
  --gold:#F2B33D;

  /* 文字与底色 */
  --ink:#0F2623;
  --ink-2:#33504A;
  --muted:#5F6B64;
  --bg:#F4F7F5;
  --surface:#FFFFFF;
  --line:#E6ECE9;
  --line-strong:#D6E0DC;

  /* 状态色（全站唯一） */
  --success:#12A572;
  --warn:#B45309;
  --danger:#E5484D;

  /* 字号阶梯 */
  --fs-12:12px;
  --fs-13:13px;
  --fs-14:14px;
  --fs-15:15px;
  --fs-17:17px;
  --fs-20:20px;
  --fs-23:23px;
  --fs-28:28px;

  /* 间距（4 的倍数） */
  --sp-1:4px;
  --sp-2:8px;
  --sp-3:12px;
  --sp-4:16px;
  --sp-5:20px;
  --sp-6:24px;
  --sp-8:32px;

  /* 圆角阶梯 */
  --radius-sm:8px;
  --radius:12px;
  --radius-lg:16px;
  --radius-xl:20px;
  --radius-pill:999px;

  /* 阴影 */
  --shadow-sm:0 1px 2px rgba(15,38,35,.06);
  --shadow:0 8px 24px rgba(15,38,35,.08);
  --shadow-lg:0 20px 48px rgba(15,38,35,.12);

  /* 层级标尺（全站 ≤700） */
  --z-sticky:100;
  --z-side:200;
  --z-drop:300;
  --z-overlay:400;
  --z-modal:500;
  --z-fab:580;
  --z-toast:600;
  --z-urgent:700;

  /* 兼容旧变量名（ui-shell / feedback-fab） */
  --ui-overlay:rgba(15,23,32,.48);
  --ui-modal-r:20px;
  --z-modal-base:500;
  --z-feedback-overlay:400;

  /* 字体：中文系统栈，不依赖外链字体 */
  --font:"PingFang SC","Microsoft YaHei","Noto Sans SC","Hiragino Sans GB",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

/* ---------- 2. 基础与排版 ---------- */
body:not(.fortune-standalone-body){
  font-family:var(--font);
  color:var(--ink);
  background:var(--bg);
  -webkit-font-smoothing:antialiased;
}
#root{min-height:100vh;min-height:100dvh}
.kx-content,.content{
  animation:none;
}
/* 统一标题阶梯 */
.kx-content h1,.content h1{font-size:var(--fs-23);line-height:1.32;font-weight:800;letter-spacing:-.02em}
.kx-content h2,.content h2{font-size:var(--fs-17);line-height:1.4;font-weight:700}
.kx-content h3,.content h3{font-size:var(--fs-15);line-height:1.45;font-weight:700}
.kx-content p,.content p{line-height:1.6}
.kx-content a{color:var(--brand-deep)}

/* ---------- 3. 布局壳 ---------- */
.kx-shell{background:var(--bg);min-height:100vh;min-height:100dvh}
.kx-side{
  width:auto;padding:0 14px;background:var(--surface);
  border-right:1px solid var(--line);
}
.kx-main{min-width:0}
.kx-top{
  position:sticky;top:0;z-index:var(--z-sticky);
  background:rgba(244,247,245,.92);
  backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line);
}
.kx-top .crumb b,.topbar .crumb b{font-size:var(--fs-15);font-weight:800}
.kx-content,.content{padding:26px 32px 56px;max-width:1280px;margin:0 auto}
/* 移动底栏：默认隐藏 */
.kx-tabbar{display:none}

/* ---------- 4. 按钮 ---------- */
.btn{
  min-height:40px;
  padding:9px 16px;
  border-radius:var(--radius);
  font-size:var(--fs-14);
  font-weight:600;
  line-height:1.2;
  border:1px solid transparent;
  box-shadow:none;
}
.btn-primary{
  background:var(--brand);
  background-image:none;
  color:#fff;
  box-shadow:0 6px 16px rgba(0,180,173,.22);
}
.btn-primary:hover{background:#00A6A0;box-shadow:0 8px 20px rgba(0,180,173,.28)}
.btn-secondary,.btn-ghost{
  background:var(--surface);
  border-color:var(--line-strong);
  color:var(--ink-2);
}
.btn-secondary:hover,.btn-ghost:hover{border-color:var(--brand);color:var(--brand-deep);background:var(--surface)}
.btn-soft{background:var(--brand-soft);color:var(--brand-deep);border-color:transparent}
.btn-accent{
  background:var(--accent2);
  background-image:none;
  color:#fff;
  box-shadow:0 6px 16px rgba(252,108,56,.22);
}
.btn-danger{border-color:transparent}
.btn-link{background:none;border:0;box-shadow:none;color:var(--brand-deep);padding-left:0;padding-right:0;min-height:auto}
.btn-block{width:100%}
/* 尺寸只有 sm / md / lg 三档 */
.btn.btn-sm{
  min-height:32px;
  padding:6px 12px !important;
  font-size:var(--fs-12) !important;
  border-radius:var(--radius-sm) !important;
}
.btn.btn-xs{
  min-height:26px;
  padding:3px 8px !important;
  font-size:11px !important;
  border-radius:6px !important;
}
.btn.btn-lg{
  min-height:48px;
  padding:12px 22px;
  font-size:var(--fs-15);
  border-radius:var(--radius-lg);
}
.btn .nav-ic svg,.btn svg{width:16px;height:16px}

/* ---------- 5. 卡片 ---------- */
.card,
.section-block,
.ast-home-section{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow-sm);
  padding:20px 22px;
  margin-bottom:var(--sp-4);
}
.card h2,.section-block h2,.ast-home-section h2{font-size:var(--fs-17);color:var(--ink)}
.card .desc,.section-block .desc{font-size:var(--fs-13);color:var(--muted)}
/* 卡片内嵌卡片：不重复描边 */
.card .card{box-shadow:none;border-color:var(--line);border-radius:var(--radius-lg)}
.ib-home-entry,.home-brand-foot{border-radius:var(--radius-xl)}

/* ---------- 6. 页面头（四套别名归一） ---------- */
.page-head,
.lib-page-head,
.subpage-head,
.review-page-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:var(--sp-4);
  flex-wrap:wrap;
  margin-bottom:var(--sp-5);
}
.page-head h1,.lib-page-head h1,.lib-page-head h2,.lib-page-title,
.subpage-head h2{
  margin:0;
  font-size:var(--fs-23);
  line-height:1.32;
  font-weight:800;
  letter-spacing:-.02em;
  color:var(--ink);
}
.review-page-head{margin-bottom:var(--sp-4)}
.review-page-head h2{font-size:var(--fs-20);line-height:1.35;font-weight:800;margin:0;color:var(--ink)}
.page-head .ph-sub,.lib-page-head .lib-page-sub,.subpage-head .desc,
.review-page-head .desc,.page-head .desc{
  margin:var(--sp-1) 0 0;
  font-size:var(--fs-13);
  line-height:1.55;
  color:var(--muted);
}
.page-head .ph-actions{display:flex;gap:var(--sp-2);align-items:center;flex-wrap:wrap}

/* ---------- 7. 空态 / Toast / 标签 / 表单 ---------- */
.empty-state,
.cf-empty-state,
.ib-empty,
.lib-empty{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:var(--sp-2);
  text-align:center;
  padding:var(--sp-8) var(--sp-5);
  color:var(--muted);
  background:var(--surface);
  border:1px dashed var(--line-strong);
  border-radius:var(--radius-lg);
}
.empty-state__icon{width:56px;height:56px;border-radius:50%;background:var(--brand-mist);display:grid;place-items:center;color:var(--brand)}
.empty-state__title{font-size:var(--fs-15);font-weight:700;color:var(--ink);margin:0}
.empty-state__desc{font-size:var(--fs-13);line-height:1.6;margin:0;color:var(--muted)}
.empty-state__actions{margin-top:var(--sp-3);display:flex;gap:var(--sp-2);justify-content:center;flex-wrap:wrap}
.empty-state--illustrated{border-style:solid;border-color:var(--line)}

.kx-toast{
  bottom:calc(28px + env(safe-area-inset-bottom,0px));
  padding:10px 16px;
  border-radius:var(--radius-pill);
  font-size:var(--fs-13);
  z-index:var(--z-toast) !important;
  box-shadow:var(--shadow-lg);
}
.toast{
  bottom:calc(28px + env(safe-area-inset-bottom,0px));
  border-radius:var(--radius-pill);
  font-size:var(--fs-13);
  z-index:var(--z-toast);
}

.pill{
  display:inline-flex;
  align-items:center;
  min-height:24px;
  padding:2px 10px;
  border-radius:var(--radius-pill);
  font-size:var(--fs-12);
  font-weight:600;
}

.field{margin-bottom:var(--sp-3)}
.field>label,.field label{font-size:var(--fs-13);font-weight:600;color:var(--ink-2);margin-bottom:6px}
.field input,.field textarea,.field select{
  min-height:40px;
  border-radius:var(--radius);
  border:1px solid var(--line-strong);
  font-size:var(--fs-14);
}
.field input:focus,.field textarea:focus,.field select:focus{
  border-color:var(--brand);
  box-shadow:0 0 0 3px rgba(0,180,173,.14);
  outline:none;
}
.field .field-error{color:var(--danger);font-size:var(--fs-12);margin-top:4px}

/* ---------- 8. 弹层统一（遮罩 400 / 弹窗 500 / Toast 600） ---------- */
.modal-overlay,
.consult-flow-overlay,
.chat-modal-overlay,
.inq-layer,
.cshop-ask-layer,
.cf-cshop-layer,
.mem-pay-overlay,
.pay-overlay,
.kx-ob-mask.modal-overlay,
.sv-overlay,
.ai-center-overlay{
  z-index:var(--z-overlay);
}
.modal-overlay .modal-card,
.modal-overlay .modal-panel,
.kx-dialog-overlay .kx-dialog-card{
  border-radius:var(--radius-xl);
  box-shadow:var(--shadow-lg);
}
.kx-dialog-overlay{z-index:var(--z-modal)}
.kx-dlg-overlay{z-index:var(--z-modal)}
.cal-composer-layer,.cal-v2-modal{z-index:var(--z-overlay) !important}
.ai-modal-overlay{z-index:var(--z-overlay)}
.ai-notify{z-index:var(--z-toast)}
.cf-toast{z-index:var(--z-toast)}
.nc-panel{z-index:var(--z-drop)}
.kx-fill-toolbar{z-index:var(--z-drop)}
.kx-fill-menu-wrap{z-index:calc(var(--z-drop) + 10)}
.kx-search-drop{z-index:var(--z-drop)}

/* ---------- 9. 响应式：720 / 1080 两档 ---------- */
/* 桌面与平板：保留固定侧栏 */
@media (min-width:721px){
  .kx-shell{grid-template-columns:220px 1fr}
  .kx-side{
    position:sticky;
    top:0;left:auto;right:auto;bottom:auto;
    height:100vh;height:100dvh;
    width:auto;z-index:var(--z-side);
    box-shadow:none;transition:none;
  }
  .side-toggle{display:none}
}
/* 平板：栅格保持两列，避免 720–860 之间退化成单列 */
@media (min-width:721px) and (max-width:1080px){
  .grid-3,.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
}
/* 手机 */
@media (max-width:720px){
  .kx-shell{grid-template-columns:1fr;display:block}
  .kx-side{
    position:fixed;top:0;left:-260px;bottom:0;width:248px;
    z-index:calc(var(--z-side) + 50);
    height:100vh;height:100dvh;
    box-shadow:var(--shadow-lg);
    transition:left .22s ease;
  }
  .kx-side.open{left:0}
  .side-toggle{display:inline-flex;width:44px;height:44px;border-radius:var(--radius)}
  .kx-main{padding:0 0 0}
  .kx-top{padding:10px 14px}
  .kx-content,.content{
    padding:14px 14px calc(88px + env(safe-area-inset-bottom,0px));
    max-width:none;
  }
  /* 底部导航 */
  .kx-tabbar{
    position:fixed;left:0;right:0;bottom:0;
    z-index:var(--z-sticky);
    display:flex;align-items:stretch;
    height:calc(56px + env(safe-area-inset-bottom,0px));
    padding-bottom:env(safe-area-inset-bottom,0px);
    background:rgba(255,255,255,.97);
    backdrop-filter:blur(14px);
    border-top:1px solid var(--line);
    box-shadow:0 -4px 16px rgba(15,38,35,.06);
  }
  .kx-tabbar button{
    flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
    gap:2px;margin:0;padding:4px 0;border:0;background:none;
    min-height:44px;color:var(--muted);font-size:11px;font-weight:600;line-height:1.2;
    cursor:pointer;
  }
  .kx-tabbar button .tab-ic{display:inline-flex}
  .kx-tabbar button .tab-ic svg{width:20px;height:20px}
  .kx-tabbar button.active{color:var(--brand-deep)}
  .kx-tabbar button.active .tab-ic{color:var(--brand)}
  /* 触控目标 ≥44 */
  .btn{min-height:44px}
  .btn.btn-sm{min-height:40px}
  .btn.btn-xs{min-height:32px}
  .kx-toast{bottom:calc(76px + env(safe-area-inset-bottom,0px))}
  .toast{bottom:calc(76px + env(safe-area-inset-bottom,0px))}
  /* 页面头在手机上改为纵向 */
  .page-head,.lib-page-head,.subpage-head,.review-page-head{align-items:flex-start;margin-bottom:var(--sp-4)}
  .page-head h1,.lib-page-head h1,.lib-page-head h2,.lib-page-title,.subpage-head h2{font-size:var(--fs-20)}
  .review-page-head h2{font-size:var(--fs-17)}
  .card,.section-block,.ast-home-section{padding:16px;border-radius:var(--radius-lg)}
  /* 弹层在手机上改为底部抽屉形态 */
  .modal-overlay{align-items:flex-end;padding:0}
  .modal-overlay .modal-card,
  .modal-overlay .modal-panel{
    width:100%;
    max-height:90vh;max-height:90dvh;
    border-radius:var(--radius-xl) var(--radius-xl) 0 0;
    padding-bottom:env(safe-area-inset-bottom,0px);
    animation:uiSheetIn .22s ease;
  }
}
@keyframes uiSheetIn{from{opacity:0;transform:translateY(24px)}to{opacity:1;transform:none}}

/* ---------- 10. 可达性 ---------- */
body:not(.fortune-standalone-body) :where(a,button,[role="button"],input,select,textarea,[tabindex]):focus-visible{
  outline:2px solid var(--brand);
  outline-offset:2px;
  border-radius:var(--radius-sm);
}
.kx-side :where(button,a):focus-visible{outline-offset:-2px}
/* 尊重系统降低动效 */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
    scroll-behavior:auto !important;
  }
}
