/* 外观标准查阅助手 —— 移动端优先样式 */
:root {
  --bg: #f2f5f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;
  --text: #16202e;
  --text-2: #5a687a;
  --text-3: #8b98a9;
  --line: #e3e9f0;
  --brand: #0f4c81;
  --brand-2: #1b6bb0;
  --brand-soft: #e8f1fa;
  --accent: #f59e0b;
  --accent-soft: #fff5e2;
  --ok: #15803d;
  --ok-soft: #e9f7ed;
  --ng: #c62828;
  --ng-soft: #fdecec;
  --shadow: 0 2px 12px rgba(16, 38, 66, .07);
  --shadow-lg: 0 12px 40px rgba(12, 30, 55, .18);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg: #0e141c;
  --surface: #17202c;
  --surface-2: #1d2836;
  --surface-3: #243141;
  --text: #e8eef6;
  --text-2: #a3b1c2;
  --text-3: #76869a;
  --line: #2a3849;
  --brand: #5aa9ee;
  --brand-2: #7fc0f7;
  --brand-soft: #17324b;
  --accent: #fbbf24;
  --accent-soft: #3a2c11;
  --ok: #4ade80;
  --ok-soft: #14301f;
  --ng: #f87171;
  --ng-soft: #371b1b;
  --shadow: 0 2px 12px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: #dfe6ee;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: var(--brand-2); text-decoration: none; }
svg { display: block; }

.phone {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}
/* 桌面宽屏下的"手机框"适配见文件末尾 */

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
}
[data-theme="dark"] .topbar { background: linear-gradient(135deg, #17324b 0%, #1f4b73 100%); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  flex: none; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.16); color: #fff;
}
.brand-text { min-width: 0; }
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11px; opacity: .8; letter-spacing: .4px; white-space: nowrap; }
.topbar-actions { display: flex; gap: 4px; flex: none; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  color: inherit; opacity: .92;
}
.icon-btn:active { background: rgba(255,255,255,.16); }
body.in-feishu .topbar { padding-top: 10px; }

/* ---------- 演示数据提示 ---------- */
.demo-banner {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 14px;
  background: var(--accent-soft);
  color: #8a5a06;
  font-size: 12px; line-height: 1.5;
  border-bottom: 1px solid rgba(245,158,11,.22);
}
.demo-banner[hidden] { display: none; }
[data-theme="dark"] .demo-banner { color: #fbbf24; }
.demo-banner svg { flex: none; margin-top: 2px; }
.demo-banner span { flex: 1; }
.demo-more { flex: none; font-size: 12px; font-weight: 600; text-decoration: underline; padding: 0; color: inherit; }

/* ---------- 主体 ---------- */
.main { padding: 14px 14px calc(78px + var(--safe-bottom)); min-height: 60dvh; }
.section { margin-bottom: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 10px; }
.section-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.section-title::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--brand-2); }
.section-more { font-size: 12px; color: var(--text-3); }

/* 搜索 */
.search-wrap { position: relative; margin-bottom: 16px; }
.search-box {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px; padding: 0 12px; height: 46px;
  box-shadow: var(--shadow);
}
.search-box:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-box svg { color: var(--text-3); flex: none; }
.search-box input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 15px;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input::-webkit-search-cancel-button,
.search-box input::-webkit-search-decoration,
.search-box input::-webkit-search-results-button { -webkit-appearance: none; appearance: none; display: none; }
.search-clear { width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; color: var(--text-3); background: var(--surface-3); font-size: 17px; line-height: 1; }
.search-clear.show { display: grid; }
.search-hint { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.hint-chip { font-size: 12px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 4px 10px; }
.hint-chip:active { background: var(--brand-soft); }

/* 分类网格 */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cat-card {
  text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px; min-height: 96px;
  transition: transform .12s ease;
}
.cat-card:active { transform: scale(.975); }
.cat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.cat-name { font-size: 14px; font-weight: 650; line-height: 1.25; }
.cat-desc { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.cat-count { font-size: 11px; color: var(--text-3); margin-top: auto; }

/* 条目列表 */
.item-list { display: flex; flex-direction: column; gap: 9px; }
.item-card {
  display: flex; align-items: flex-start; gap: 11px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); transition: transform .12s ease;
}
.item-card:active { transform: scale(.985); }
.item-code {
  flex: none; font-size: 10px; font-weight: 700; letter-spacing: .3px;
  color: var(--brand-2); background: var(--brand-soft);
  border-radius: 6px; padding: 3px 6px; margin-top: 2px; min-width: 62px; text-align: center;
}
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.item-summary { font-size: 12px; color: var(--text-2); margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.item-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.chip { font-size: 10.5px; padding: 2px 7px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); }
.chip.sev-main { background: #fff1e6; color: #b45309; }
.chip.sev-minor { background: #eef2f7; color: #64748b; }
.chip.sev-safety { background: var(--ng-soft); color: var(--ng); }
[data-theme="dark"] .chip.sev-main { background: #3a2a12; color: #fbbf24; }
[data-theme="dark"] .chip.sev-minor { background: var(--surface-3); color: var(--text-2); }
.item-arrow { flex: none; color: var(--text-3); align-self: center; }
mark { background: #ffe89a; color: #4a3400; border-radius: 3px; padding: 0 1px; }
[data-theme="dark"] mark { background: #6b5410; color: #ffe9a8; }

/* 通用卡片 / 空态 */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.empty { text-align: center; padding: 44px 20px; color: var(--text-3); }
.empty svg { margin: 0 auto 12px; color: var(--text-3); opacity: .6; }
.empty-title { font-size: 14px; color: var(--text-2); margin-bottom: 4px; }
.empty-desc { font-size: 12px; line-height: 1.6; }

/* 流程步骤 */
.flow { display: flex; flex-direction: column; gap: 0; }
.flow-step { display: flex; gap: 11px; position: relative; padding-bottom: 14px; }
.flow-step:last-child { padding-bottom: 0; }
.flow-step::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1.5px; background: var(--line); }
.flow-step:last-child::before { display: none; }
.flow-num { flex: none; width: 27px; height: 27px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.flow-title { font-size: 13.5px; font-weight: 650; }
.flow-text { font-size: 12px; color: var(--text-2); line-height: 1.55; }

/* 分类页 */
.cat-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 9px; box-shadow: var(--shadow); }
.cat-row .cat-icon { flex: none; }
.cat-row-info { flex: 1; min-width: 0; }
.cat-row-name { font-size: 14.5px; font-weight: 650; }
.cat-row-desc { font-size: 11.5px; color: var(--text-3); }
.cat-row-count { font-size: 12px; color: var(--text-3); }

/* 关于页 */
.about-hero { text-align: center; padding: 18px 12px 20px; }
.about-logo { width: 62px; height: 62px; border-radius: 18px; margin: 0 auto 12px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; color: #fff; box-shadow: var(--shadow); }
.about-name { font-size: 17px; font-weight: 700; }
.about-ver { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv-k { color: var(--text-3); flex: none; }
.kv-v { color: var(--text); text-align: right; word-break: break-all; }
.link-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; width: 100%; text-align: left; }
.link-row:last-child { border-bottom: 0; }
.link-row svg { color: var(--brand-2); flex: none; }
.link-row span { flex: 1; }
.link-row .go { color: var(--text-3); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 35;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -3px 16px rgba(16,38,66,.06);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 8px; color: var(--text-3); font-size: 10.5px; }
.tab.active { color: var(--brand-2); font-weight: 650; }
.tab.active svg { stroke-width: 2.1; }

/* ---------- 详情层 ---------- */
.detail-layer {
  position: fixed; top: 0; left: 50%; z-index: 60;
  width: 100%; max-width: 520px; height: 100dvh;
  background: var(--bg);
  transform: translate(-50%, 100%);
  transition: transform .26s cubic-bezier(.32,.72,0,1);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.detail-layer.open { transform: translate(-50%, 0); }
.detail-head {
  flex: none; display: flex; align-items: center; gap: 6px;
  padding: calc(10px + var(--safe-top)) 10px 10px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.detail-head-title { flex: 1; font-size: 15px; font-weight: 650; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.back-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: var(--text); }
.back-btn:active { background: var(--surface-3); }
.detail-head .icon-btn { color: var(--text); }
.detail-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(30px + var(--safe-bottom)); }

.d-header { margin-bottom: 14px; }
.d-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.d-code { font-size: 11px; font-weight: 700; color: var(--brand-2); background: var(--brand-soft); padding: 3px 8px; border-radius: 6px; }
.d-title { font-size: 22px; font-weight: 750; line-height: 1.3; letter-spacing: .2px; }
.d-summary { font-size: 13.5px; color: var(--text-2); margin-top: 6px; line-height: 1.6; }
.d-block { margin-bottom: 12px; }
.d-label { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: .5px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.d-label::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--brand-2); }
.d-text { font-size: 13.5px; line-height: 1.75; color: var(--text); }
.d-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.d-mini { background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 11px; }
.d-mini-k { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.d-mini-v { font-size: 13px; font-weight: 600; line-height: 1.5; }

.verdict { border-radius: 11px; padding: 12px; }
.verdict.ok { background: var(--ok-soft); border: 1px solid rgba(21,128,61,.18); }
.verdict.ng { background: var(--ng-soft); border: 1px solid rgba(198,40,40,.18); }
.verdict-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.verdict.ok .verdict-title { color: var(--ok); }
.verdict.ng .verdict-title { color: var(--ng); }
.verdict ul { margin: 0; padding-left: 17px; }
.verdict li { font-size: 12.5px; line-height: 1.65; margin-bottom: 5px; }
.verdict li:last-child { margin-bottom: 0; }

.limit-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.limit-table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 11px; padding: 7px 8px; background: var(--surface-2); }
.limit-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
.limit-table tr:last-child td { border-bottom: 0; }
.limit-val { font-weight: 700; color: var(--brand-2); }
.limit-val.pending { color: var(--accent); font-weight: 600; font-size: 11.5px; }
.limit-unit { color: var(--text-3); font-size: 11px; }

.img-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.img-cell { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.img-cell img { width: 100%; height: 110px; object-fit: cover; display: block; }
.img-cell .cap { font-size: 11px; color: var(--text-2); padding: 6px 8px; display: flex; gap: 5px; align-items: center; }
.img-placeholder { border: 1.5px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; color: var(--text-3); font-size: 12px; line-height: 1.6; background: var(--surface-2); }

.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.55; }
.check-item:last-child { border-bottom: 0; }
.check-box { flex: none; width: 19px; height: 19px; border: 1.6px solid var(--text-3); border-radius: 5px; margin-top: 1px; display: grid; place-items: center; color: transparent; }
.check-item.done .check-box { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.check-item.done .check-text { color: var(--text-3); text-decoration: line-through; }
.check-text { flex: 1; }
.check-progress { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; }

.action-row { display: flex; gap: 9px; margin-top: 14px; }
.btn { flex: 1; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13.5px; font-weight: 650; }
.btn-primary { background: var(--brand); color: #fff; }
[data-theme="dark"] .btn-primary { background: var(--brand-2); color: #0e141c; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.btn:active { opacity: .85; }

.note-box { font-size: 12px; line-height: 1.65; color: var(--text-2); background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
[data-theme="dark"] .note-box { color: #f8dca6; background: #33260f; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(6,12,20,.92); display: none; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 76dvh; object-fit: contain; border-radius: 8px; }
.lightbox-cap { color: #cbd5e1; font-size: 13px; margin-top: 12px; text-align: center; }
.lightbox-close { position: absolute; top: calc(16px + var(--safe-top)); right: 18px; color: #fff; font-size: 32px; line-height: 1; width: 40px; height: 40px; }

/* toast */
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(84px + var(--safe-bottom)); transform: translateX(-50%) translateY(12px); background: rgba(20,30,42,.94); color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 86%; text-align: center; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 桌面宽屏：手机外框适配（放在末尾以覆盖上方默认值） ---------- */
@media (min-width: 700px) {
  body { padding: 24px 0; }
  .phone {
    height: calc(100dvh - 48px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-radius: 26px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0, 0, 0, .08);
  }
  .main { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .tabbar { bottom: 24px; border-radius: 0 0 26px 26px; }
  .detail-layer {
    top: 24px;
    height: calc(100dvh - 48px);
    border-radius: 26px;
    overflow: hidden;
  }
  .toast { bottom: calc(104px + var(--safe-bottom)); }
}

