/* ============================================================
   青雀进销存 · 新手使用说明（HTML 版）
   ============================================================ */
:root{
  --brand:#2E6E73; --brand-d:#1F4F53; --brand-l:#3E8A8F;
  --ink:#12211F; --ink-2:#3C5654; --ink-3:#63797A;
  --bg:#FBF6F0; --card:#FFFFFF; --line:#E3D8CC;
  --accent:#D6703A; --ok:#2E8B57; --warn:#C98910; --err:#C0392B;
  --code-bg:#EEF4F3; --radius:14px;
  --sidebar-w:250px;
}
*{margin:0;padding:0;box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB",
              "Microsoft YaHei",sans-serif;
  color:var(--ink);background:var(--bg);line-height:1.85;
  font-size:15.5px;-webkit-font-smoothing:antialiased;
}
a{color:var(--brand);text-decoration:none}
a:hover{text-decoration:underline}
code{
  background:var(--code-bg);color:var(--brand-d);
  padding:1px 6px;border-radius:4px;font-size:.9em;
  font-family:ui-monospace,Menlo,Consolas,monospace;
}
pre{
  background:var(--code-bg);border-left:4px solid var(--brand);
  padding:16px 18px;border-radius:8px;overflow-x:auto;
  font-size:13.5px;line-height:1.75;margin:14px 0;
  font-family:ui-monospace,Menlo,Consolas,monospace;
}
pre code{background:none;padding:0;color:var(--ink-2);font-size:inherit}

/* ── 顶部 ───────────────────────────────── */
/* ═══════════════════════════════════════════════════════════════
   顶部栏（S75 重写）
   ═══════════════════════════════════════════════════════════════
   ⚠️ 为什么要用 position:absolute 而不是纯 flex：

   微信内置浏览器（安卓 X5 内核）对 flex 有一堆坑：
     · flex-shrink:0 / flex:0 0 auto 在某些版本失效
     · min-width:0 让子项收缩的行为不一致
     · gap 属性老内核完全不支持（间距全变 0）
     · 结果：标题占满宽度，右边按钮被挤出可视区 → 空白

   换成这个方案后，按钮用「绝对定位钉在右边」，
   不再参与 flex 的空间分配，任何内核都不会被挤掉：
     · 按钮：position:absolute; right:0，永远贴着右边
     · 标题：margin-right 预留按钮宽度，超出用省略号
   这个写法 IE9+ 都支持，微信内核 100% 兼容。
   ═══════════════════════════════════════════════════════════════ */
.topbar{
  position:sticky;position:-webkit-sticky;
  top:0;z-index:80;
  background:rgba(251,246,240,.95);
  -webkit-backdrop-filter:blur(10px);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
  height:56px;
  /* 不用 flex，用 block + 绝对定位 */
  display:block;
  padding:0 16px;
  /* 为按钮预留右侧空间：按钮约 96px + 边距 */
  box-sizing:border-box;
}
/* 左侧区：菜单 + logo + 标题，用 padding-right 避开右侧按钮 */
.topbar-inner{
  display:flex;
  align-items:center;
  height:56px;
  /* ⭐ 关键：右侧留出按钮的位置 */
  padding-right:108px;
  box-sizing:border-box;
}
.topbar .logo{
  width:26px;height:26px;border-radius:7px;
  margin-right:9px;
  flex-shrink:0;
  /* 老内核 fallback */
  -webkit-flex-shrink:0;
  display:block;
}
.topbar .tt{
  font-weight:700;font-size:14px;
  line-height:1.25;
  /* 允许收缩 + 省略号（三重写法防内核差异） */
  flex:1 1 auto;
  -webkit-flex:1 1 auto;
  min-width:0;
  width:0;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.topbar .tt .tt-main{
  display:block;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.topbar .tt small{
  display:block;
  font-size:10.5px;
  font-weight:400;
  color:var(--ink-3);
  line-height:1.2;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

/* ⭐⭐⭐ 核心：按钮绝对定位钉在右边 ⭐⭐⭐
   不参与 flex 分配 → 无论如何都不会被挤出屏幕 */
.topbar .back{
  position:absolute;
  top:50%;
  right:16px;
  -webkit-transform:translateY(-50%);
  transform:translateY(-50%);

  font-size:12.5px;
  line-height:1;
  color:var(--ink-2);
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  white-space:nowrap;
  text-decoration:none;
  /* 防止被任何父级 flex 影响 */
  flex:none;
  width:auto;
  -webkit-tap-highlight-color:transparent;
}
.topbar .back:active{background:#F2EDE5}

.menu-btn{
  display:none;
  background:none;
  border:1px solid var(--line);
  border-radius:8px;
  padding:7px 9px;
  font-size:15px;
  line-height:1;
  cursor:pointer;
  margin-right:9px;
  flex-shrink:0;
  -webkit-flex-shrink:0;
}

@media(max-width:900px){
  .menu-btn{display:block}
  .topbar{padding:0 12px}
  .topbar-inner{padding-right:102px}
  .topbar .back{right:12px;font-size:12px;padding:7px 10px}
}

@media(max-width:400px){
  /* 极窄屏：缩字号、缩边距、隐藏副标题，保证一定放得下 */
  .topbar{padding:0 9px}
  .topbar-inner{padding-right:94px}
  .topbar .logo{width:23px;height:23px;margin-right:7px}
  .topbar .tt{font-size:13px}
  .topbar .tt small{display:none}
  .menu-btn{padding:6px 8px;margin-right:7px;font-size:14px}
  .topbar .back{right:9px;font-size:11.5px;padding:6px 9px}
}

/* ── 布局 ───────────────────────────────── */
.layout{display:flex;align-items:flex-start}
.sidebar{
  width:var(--sidebar-w);flex:0 0 var(--sidebar-w);
  position:sticky;top:56px;height:calc(100vh - 56px);
  overflow-y:auto;padding:22px 14px 40px;
  border-right:1px solid var(--line);background:#FEFCF9;
}
.sidebar::-webkit-scrollbar{width:6px}
.sidebar::-webkit-scrollbar-thumb{background:#D9CFC2;border-radius:3px}
.sb-title{
  font-size:11px;font-weight:700;color:var(--ink-3);
  letter-spacing:1px;margin:16px 0 8px;padding-left:12px;
}
.sb-title:first-child{margin-top:0}
.sidebar a{
  display:block;padding:7px 12px;border-radius:8px;
  font-size:13.5px;color:var(--ink-2);line-height:1.5;
  border-left:2px solid transparent;
}
.sidebar a:hover{background:#F2EDE5;text-decoration:none;color:var(--brand)}
.sidebar a.on{
  background:rgba(46,110,115,.1);color:var(--brand);
  font-weight:600;border-left-color:var(--brand);
}
.sidebar a.sub{padding-left:24px;font-size:13px;color:var(--ink-3)}
@media(max-width:900px){
  .sidebar{
    position:fixed;left:0;top:56px;bottom:0;z-index:70;
    transform:translateX(-100%);transition:.25s;
    box-shadow:8px 0 30px rgba(0,0,0,.12);
  }
  .sidebar.open{transform:none}
  .mask{
    display:none;position:fixed;left:0;top:56px;right:0;bottom:0;
    background:rgba(18,33,31,.4);z-index:65;
  }
  .mask.on{display:block}
}
.main{
  flex:1;min-width:0;max-width:900px;
  padding:34px 40px 90px;margin:0 auto;
}
@media(max-width:900px){.main{padding:22px 18px 80px}}

/* ── 正文排版 ───────────────────────────── */
.main h1{
  font-size:30px;font-weight:800;letter-spacing:-.5px;
  margin:0 0 8px;line-height:1.35;
}
.main h1 .ver{
  font-size:13px;font-weight:500;color:var(--ink-3);
  vertical-align:middle;margin-left:8px;
}
.main .lead{
  font-size:15px;color:var(--ink-3);margin-bottom:30px;
  padding-bottom:24px;border-bottom:1px solid var(--line);
}
.main h2{
  font-size:23px;font-weight:800;margin:56px 0 8px;
  padding-top:24px;border-top:2px solid var(--line);
  letter-spacing:-.3px;scroll-margin-top:70px;
}
.main h2:first-of-type{border-top:none;padding-top:0;margin-top:34px}
.main h2 small{
  display:block;font-size:13px;font-weight:400;color:var(--ink-3);
  margin-top:6px;letter-spacing:0;
}
.main h3{
  font-size:17.5px;font-weight:700;margin:32px 0 10px;
  color:var(--brand-d);scroll-margin-top:70px;
}
.main h3::before{
  content:"";display:inline-block;width:4px;height:16px;
  background:var(--brand);border-radius:2px;
  margin-right:9px;vertical-align:-2px;
}
.main h4{
  font-size:15px;font-weight:700;margin:22px 0 8px;
  color:var(--ink);scroll-margin-top:70px;
}
.main p{margin:11px 0;color:var(--ink-2)}
.main ul,.main ol{margin:11px 0 11px 22px;color:var(--ink-2)}
.main li{margin:5px 0}
.main li > ul,.main li > ol{margin-top:5px}
.main strong{color:var(--ink);font-weight:700}
.main hr{
  border:none;border-top:1px solid var(--line);margin:36px 0;
}

/* ── 图片 ───────────────────────────────── */
figure{margin:22px 0;text-align:center}
figure img{
  max-width:100%;border-radius:var(--radius);
  border:1px solid var(--line);box-shadow:0 4px 20px rgba(46,110,115,.1);
  background:#fff;
}
figcaption{
  font-size:12.5px;color:var(--ink-3);margin-top:9px;
}
/* 用纯 CSS 画的示意图 */
.diagram{
  background:linear-gradient(150deg,#EAF2F2,#DFECEB);
  border:1px solid #CFE0E0;border-radius:var(--radius);
  padding:22px;margin:20px 0;text-align:center;
}
.diagram .flow{
  display:flex;align-items:center;justify-content:center;
  gap:10px;flex-wrap:wrap;
}
.diagram .node{
  background:#fff;border-radius:10px;padding:10px 16px;
  font-size:13.5px;font-weight:600;color:var(--brand-d);
  box-shadow:0 2px 8px rgba(46,110,115,.1);white-space:nowrap;
}
.diagram .node.on{background:var(--brand);color:#fff}
.diagram .node.bad{background:#FDF0EC;color:var(--err)}
.diagram .arrow{color:var(--brand-l);font-size:18px;font-weight:700}
.diagram .note{
  font-size:12.5px;color:var(--ink-3);margin-top:14px;
}
/* 卡片式示意（模拟系统界面） */
.ui-mock{
  background:#fff;border:1px solid var(--line);border-radius:12px;
  overflow:hidden;margin:20px 0;box-shadow:0 4px 18px rgba(46,110,115,.08);
}
.ui-mock .bar{
  background:#F2F7F6;padding:9px 14px;font-size:12px;color:var(--ink-3);
  border-bottom:1px solid var(--line);display:flex;gap:6px;align-items:center;
}
.ui-mock .bar i{
  width:9px;height:9px;border-radius:50%;background:#D8E3E2;
  display:inline-block;
}
.ui-mock .bar i:nth-child(1){background:#E8A598}
.ui-mock .bar i:nth-child(2){background:#E8CD98}
.ui-mock .bar i:nth-child(3){background:#A8CEB0}
.ui-mock .bar span{margin-left:8px}
.ui-body{padding:18px}
.ui-row{
  display:flex;align-items:center;gap:12px;padding:9px 0;
  border-bottom:1px dashed #EDE5DB;font-size:13.5px;
}
.ui-row:last-child{border-bottom:none}
.ui-row .lbl{flex:0 0 96px;color:var(--ink-3);font-size:13px}
.ui-row .val{flex:1;color:var(--ink-2)}
.ui-row .val b{color:var(--ink)}

/* ── 提示块 ─────────────────────────────── */
.box{
  border-radius:10px;padding:14px 18px;margin:16px 0;
  font-size:14px;line-height:1.8;
}
.box.tip{background:#EDF5F4;border-left:4px solid var(--brand);color:var(--brand-d)}
.box.warn{background:#FDF6E7;border-left:4px solid var(--warn);color:#8A5E06}
.box.err{background:#FDF0EC;border-left:4px solid var(--err);color:#9C2E22}
.box.ok{background:#EDF7F1;border-left:4px solid var(--ok);color:#1E6B3F}
.box b{font-weight:700}

/* ── 步骤 ───────────────────────────────── */
.steps-n{counter-reset:st;margin:18px 0}
.step-n-item{
  position:relative;padding:0 0 18px 46px;
  border-left:2px solid var(--line);margin-left:15px;
}
.step-n-item:last-child{border-left-color:transparent;padding-bottom:0}
.step-n-item::before{
  counter-increment:st;content:counter(st);
  position:absolute;left:-16px;top:0;
  width:30px;height:30px;border-radius:50%;
  background:var(--brand);color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:14px;
}
.step-n-item .st{font-weight:700;color:var(--ink);margin-bottom:4px}
.step-n-item .sd{font-size:14px;color:var(--ink-2)}

/* ── 表格 ───────────────────────────────── */
.tbl-wrap{overflow-x:auto;margin:18px 0}
table.t{
  width:100%;border-collapse:collapse;font-size:14px;
  background:#fff;border-radius:10px;overflow:hidden;
  box-shadow:0 2px 12px rgba(46,110,115,.07);min-width:520px;
}
table.t th{
  background:var(--brand);color:#fff;padding:11px 14px;
  text-align:left;font-weight:600;font-size:13.5px;white-space:nowrap;
}
table.t td{
  padding:10px 14px;border-bottom:1px solid var(--line);
  color:var(--ink-2);vertical-align:top;
}
table.t tr:last-child td{border-bottom:none}
table.t tr:nth-child(even) td{background:#FDFBF8}
table.t td:first-child{font-weight:600;color:var(--ink);white-space:nowrap}

/* ── 目录 ───────────────────────────────── */
.toc{
  background:#fff;border:1px solid var(--line);border-radius:var(--radius);
  padding:22px 26px;margin:26px 0 36px;
}
.toc h3{margin:0 0 14px;font-size:15px;color:var(--ink);font-weight:700}
.toc h3::before{display:none}
.toc ol{margin:0 0 0 20px;font-size:14px}
.toc li{margin:6px 0}
.toc a{color:var(--ink-2)}
.toc a:hover{color:var(--brand)}

/* ── 回到顶部 ───────────────────────────── */
.totop{
  position:fixed;right:22px;bottom:26px;z-index:60;
  width:44px;height:44px;border-radius:50%;
  background:var(--brand);color:#fff;border:none;cursor:pointer;
  font-size:19px;box-shadow:0 6px 20px rgba(46,110,115,.35);
  opacity:0;pointer-events:none;transition:.25s;
}
.totop.show{opacity:1;pointer-events:auto}
@media(max-width:600px){.totop{right:14px;bottom:16px;width:42px;height:42px}}

/* ── 打印 ───────────────────────────────── */
@media print{
  .topbar,.sidebar,.totop,.mask{display:none !important}
  .main{max-width:none;padding:0}
  body{background:#fff;font-size:11pt}
  .main h2{page-break-after:avoid}
  figure,.diagram,.ui-mock,.box{page-break-inside:avoid}
}

/* ═══════════════════════════════════════════════════════════
   移动端横向溢出修复（关键）
   ═══════════════════════════════════════════════════════════
   ⚠️ 原来手机上右边被裁掉 2-3 个字，原因是：
      · .diagram .node 有 white-space:nowrap，长中文撑宽容器
      · 表格 min-width:520px 超出手机宽度，且没有一个 overflow 容器包住整页
   修法：
      · body / html 加 overflow-x:hidden 兜底
      · 所有容器加 max-width:100%
      · node 允许换行
   ═══════════════════════════════════════════════════════════ */
html, body { max-width: 100%; overflow-x: hidden; }
.layout, .main, .sidebar { max-width: 100%; }
.main > * { max-width: 100%; }
.diagram, .ui-mock, .box, pre, figure, .toc, .steps-n { max-width: 100%; }

/* 示意图色块允许换行，不再 nowrap 撑宽 */
.diagram .node {
  white-space: normal;
  word-break: break-word;
  text-align: center;
  max-width: 100%;
}
.diagram .flow { max-width: 100%; min-width: 0; }
/* 竖排流程图（手机上自动切） */
@media (max-width: 640px) {
  .diagram { padding: 16px 14px; }
  .diagram .flow {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  .diagram .arrow {
    transform: rotate(90deg);
    display: block;
    line-height: 1;
    margin: 2px 0;
  }
  .diagram .node { padding: 9px 12px; font-size: 13px; }
  .diagram .note { font-size: 12px; }
}

/* 表格：手机端保持横向滚动，不要撑破页面 */
.tbl-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.t { min-width: 0; width: max(100%, 480px); }

/* 长串英文/路径不撑宽 */
code, pre { word-break: break-word; }

@media (max-width: 640px) {
  .main { padding: 18px 14px 80px; }
  .main h1 { font-size: 24px; }
  .main h2 { font-size: 19px; margin-top: 42px; }
  .main h3 { font-size: 16px; }
  body { font-size: 15px; }
  .toc { padding: 16px 18px; }
  .toc ol { margin-left: 18px; font-size: 13.5px; }
  .step-n-item { padding-left: 40px; }
  .ui-row .lbl { flex-basis: 78px; font-size: 12.5px; }
  .ui-body { padding: 14px; }
}
