/* 客户门户八页共用样式（/portal/、/portal/orders/、/portal/plans/、/portal/quotes/、/portal/contracts/、/portal/changes/、/portal/progress/、/portal/complaints/）
   从旧单页 portal/index.html 的内联 <style> 原样迁出。
   M226 起门户接入精修 Apple 样式（theme-apple / nav-icons / theme-apple-overlay /
   apple-font-preferences / apple-list-filter / apple-mobile-nav 六份共享层由各页 index.html
   引入），本文件新增四段：纯 Apple 蓝作用域、内容字号接倍率、筛选面板字段排版、
   手机底栏「我的」面板；加载顺序约定：本文件在 Apple 皮肤层之后（同特异性时靠后赢）。 */

/* ═══ M226 ① 纯 Apple 蓝作用域：解决 body.theme-portal 的变量层叠 ═══
   lims2.css:35 的 body.theme-portal (0,1,1) 比共享层 html[data-theme="apple"] (0,1,0)
   离内容更近，会把 Apple 蓝变量改回门户绿——只挂主题属性会绿/蓝混色。这里按
   theme-apple.css 的 Apple 档同值整体改写，specificity (0,2,2) 严格压过它：
   Apple 主题下 --blue-* 是纯 Apple 蓝、侧栏走石墨深档（与 theme-apple.css 同值，
   nav-icons.css 加载时侧栏再转浅色结构层）。
   不挂 data-theme="apple"（手机底栏「切换」到 LIMS 原样式）时本段逐条不命中，
   门户回到原绿色系——两种形态各自纯色，不存在混色中间态。 */
html[data-theme="apple"] body.theme-portal{
  --blue-700:#0064c8; --blue-600:#0071e3; --blue-500:#0071e3; --blue-100:#d6e9fb; --blue-50:#f0f6fe;
  --side-bg:#1d1d1f;
  --side-grad-a:#1d1d1f; --side-grad-b:#1d1d1f; --side-grad-c:#2c2c2e;
  --side-text:#e8e8ed; --side-soft:#b0b0b8; --side-muted:#8e8e93;
  --side-badge-text:#e8e8ed;
  --side-active-dot:#0a84ff;
}

/* ═══ M226 ② 内容字号接倍率（8 档共享字体字号，口径同 business.css M190 段）═══
   值与 lims2.css 基座字面量一一相同，只是换成 calc(Npx*var(--font-size-scale,1))；
   html[data-font] 前缀未挂偏好层时逐条零命中。侧栏 / 顶栏 / 面包屑 / 演示入口等
   导航框架字号保持字面量不参与倍率（口径同 apple-preview）。
   body:not(.commission-printing) 把打印委托单排除：纸质单排版由 commission-print.css
   全权负责（打印在 @media print 下，body 带 .commission-printing），不随字号档缩放。 */
html[data-font] body:not(.commission-printing){font-size:calc(14px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .page-head h1{font-size:calc(22px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .page-head .kicker{font-size:calc(10px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .page-head p{font-size:calc(13px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .panel-heading h3{font-size:calc(15px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .panel-heading .muted{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .count-badge{font-size:calc(10px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .button{font-size:calc(13px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .text-button{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .small-button{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) th{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) td{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) td strong{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) td small{font-size:calc(10px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .status{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .task-type{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .task-content strong{font-size:calc(13px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .task-content small,
html[data-font] body:not(.commission-printing) .task-meta small{font-size:calc(10px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .task-meta b{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .timeline-item{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .timeline-item .t-time{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .timeline-item .t-body strong{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .timeline-item .t-body small{font-size:calc(10px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .inline-note{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .inline-note .n-icon{font-size:calc(10px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .modal-header h2{font-size:calc(18px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .modal-header .kicker{font-size:calc(10px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .close-button{font-size:calc(22px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .form-grid label{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .form-grid input,
html[data-font] body:not(.commission-printing) .form-grid select,
html[data-font] body:not(.commission-printing) .form-grid textarea{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .field-error{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .choice-row label{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .fk-field .hint,
html[data-font] body:not(.commission-printing) .fk-legend,
html[data-font] body:not(.commission-printing) .form-grid .fk-group{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .toast span{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .toast p{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .empty-hint{font-size:calc(12px*var(--font-size-scale,1))}
/* 柔和 KV（overlay ⑥ 已拍板定稿 11/14px）自带 --font-size-scale 倍率，这里不另写——
   portal.css 的 body:not(.commission-printing) 前缀会把特异性抬到 (0,4,2) 反压定稿的
   :root[data-theme="apple"] (0,4,1)，报价页口径就漂了（M221 R1 P2-2 的教训）。 */
/* 登录视图（门户八页首屏共用）：卡片内容随档，登录本身不是导航框架 */
html[data-font] body:not(.commission-printing) .login-card h1{font-size:calc(20px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .login-card>p{font-size:calc(12px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .login-note{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .customer-select-item strong{font-size:calc(13px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .customer-select-item small{font-size:calc(10px*var(--font-size-scale,1))}
/* 回款卡口与报告门禁（合同 / 进度页正文） */
html[data-font] body:not(.commission-printing) .pay-line{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .pay-gate{font-size:calc(11px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .pay-gate small{font-size:calc(10px*var(--font-size-scale,1))}
html[data-font] body:not(.commission-printing) .report-entry{font-size:calc(11px*var(--font-size-scale,1))}
/* 委托详情三 Tab（orders 正文） */
html[data-font] body:not(.commission-printing) .commission-tabs button{font-size:calc(12px*var(--font-size-scale,1))}

/* ═══ M226 ③ 打印钉回基座字体 ═══
   commission-print.css 的口径是「文档自身不依赖门户 / 商务主题变量」；8 档字体档
   （html[data-font="18"/"19"] body，0,1,2）与 Apple 主题栈（overlay 的
   [data-theme="apple"] body，0,1,1）都会改写 body 字体族并传进打印树。这里用
   (0,2,2) 前缀压过两者，与共享层的加载顺序无关。 */
@media print{
  html[data-theme="apple"] body.commission-printing,
  html[data-font] body.commission-printing,
  html body.commission-printing{font-family:"Noto Sans SC","Microsoft YaHei","PingFang SC",system-ui,-apple-system,sans-serif}
}

/* ═══ M226 ④ 列表筛选面板字段排版（标记契约见 apple-list-filter.css）═══
   各列表页的 .alf-pop 里放 .portal-filter-field（label>span 标签 + 控件），
   日期区间用 .portal-filter-range 双列（从 / 至各有 label，§3.2 日期行口径）。 */
.alf-pop .portal-filter-field{display:grid;gap:5px;margin:0 0 12px;font-size:calc(11px*var(--font-size-scale,1));color:var(--text)}
.alf-pop .portal-filter-field>span{color:var(--muted)}
.alf-pop .portal-filter-field select,
.alf-pop .portal-filter-field input{width:100%;height:34px;border:1px solid var(--border);border-radius:8px;background:#fff;padding:0 8px;font-size:calc(12px*var(--font-size-scale,1));color:var(--text)}
.alf-pop .portal-filter-field select:focus,
.alf-pop .portal-filter-field input:focus{outline:none;border-color:var(--blue-500);box-shadow:var(--focus)}
.alf-pop .portal-filter-field input[type="date"]{padding:0 6px}
.alf-pop .portal-filter-range{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.alf-pop .portal-filter-range>span{display:block;font-size:calc(10px*var(--font-size-scale,1));color:var(--muted)}
.alf-pop .portal-filter-range .portal-filter-field{margin:0}

/* ═══ M226 ⑤ 手机底栏「我的」面板（portal 形态：客户身份 + 退出登录）═══
   挂在 LimsAppleMobileNav 的 identitySlot 里；复用 .identity-dropdown/.identity-menu
   类名取得 apple-mobile-nav.css 的「底栏上方弹出」定位，退出登录走 portal-common
   现有 logout（登录态、token 语义不新增第二条路径）。 */
.portal-me-head{padding:8px 10px 10px;border-bottom:1px solid var(--line);margin-bottom:6px}
.portal-me-head strong{display:block;font-size:13px;color:var(--ink)}
.portal-me-head small{display:block;margin-top:2px;color:var(--muted)}
.portal-me-note{padding:4px 10px 10px;font-size:11px;color:var(--muted)}
.portal-me-logout{width:100%;margin:2px 0 4px}

/* 引导演示入口（八个页面各自有独立 adapter，锚点 id 由本页提供） */
.guided-demo-entry{position:fixed;top:12px;right:16px;z-index:90;display:flex;align-items:center;gap:8px}
.guided-demo-entry[hidden]{display:none}
.guided-demo-entry button[data-guide-state="error"]{border-color:var(--danger);color:var(--danger)}
.guided-demo-entry-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
#app-view .top-actions{padding-right:150px}
@media(max-width:720px){.guided-demo-entry{top:8px;right:8px}.guided-demo-entry .button{padding:6px 8px;font-size:11px}#app-view .top-actions{padding-right:126px}}

/* 登录视图（每页复制一份，演示接管需要在任意门户页面点选客户） */
.login-note{margin-top:16px;color:var(--muted);font-size:11px;text-align:center}
.customer-select-panel{margin-top:14px;text-align:left}
.customer-select-item{display:block;width:100%;text-align:left;padding:10px 12px;margin-top:6px;border:1px solid var(--line);border-radius:8px;background:var(--surface);cursor:pointer}
.customer-select-item:hover{border-color:var(--blue-500);background:#f5f9ff}
.customer-select-item strong{display:block;font-size:13px;color:var(--ink)}
.customer-select-item small{display:block;margin-top:2px;color:var(--muted)}
#btn-toggle-login-form{margin-top:12px}
#login-form-wrap[hidden]{display:none}
.empty-hint{padding:26px 0;text-align:center;color:var(--muted);font-size:12px}

/* 必填红星：门户各页弹窗是 innerHTML + type=button，原生 required 校验不触发，
   按字段的 required 属性打星。label 默认 grid 布局会让星号独占一行，
   这里把必填 label 改成块级并给控件补 5px 间距，使星号与标签文字同行。 */
label:has(> :required){display:block}
label:has(> :required)>input,label:has(> :required)>textarea,label:has(> :required)>select{margin-top:5px}
label:has(> :required)::before{content:'*';color:#c0392b;margin-right:2px}
/* A1 条件字段（第三方送检 / 报告类型说明等）自绘块内的 label，行内样式不参与上面的规则 */
.a1-field-label{display:grid;gap:5px;color:var(--text);font-size:11px}
.a1-field-label:has(> :required){display:block}
/* 勾选型字段（renderField 的 checkbox）：lims2.css 的 .form-grid label 是 grid、
   .form-grid input 又是 width:100%/height:36px，复选框会被拉满整行，红星因此挤到独占一行。
   这里把整组改回横向一行，复选框恢复原始尺寸。 */
.checkbox-field,.form-grid .checkbox-field{display:flex;align-items:center;gap:8px;cursor:pointer}
.form-grid .checkbox-field:has(> :required){display:flex;padding-left:0}
.checkbox-field>input[type=checkbox],.form-grid .checkbox-field>input[type=checkbox]{width:auto;height:auto;flex:none;margin:0}

/* 委托详情：返回 + 三 Tab（基本信息 / 检验项目 / 附件） */
.detail-back{margin-bottom:14px}
.commission-tabs{display:flex;gap:6px;border-bottom:1px solid var(--line);margin-bottom:14px;overflow-x:auto}
.commission-tabs button{border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);padding:9px 12px;font-size:12px;cursor:pointer;white-space:nowrap}
.commission-tabs button.active{border-bottom-color:var(--blue-500);color:var(--ink);font-weight:600}
.commission-tab{display:none}
.commission-tab.active{display:block}
.commission-editor .panel{margin-top:12px}
.commission-editor .table-wrap{margin-top:8px}
.review-actions .button{min-width:140px}

/* 顶栏客户演示身份下拉（引导演示内出现，真实登录时隐藏） */
.portal-demo-identity{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:11px;white-space:nowrap}
.portal-demo-identity[hidden]{display:none}
.portal-demo-identity select{min-width:180px;padding:6px 28px 6px 8px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--text);font-size:11px}
#portal-demo-precheck{margin-bottom:14px}

/* 回款（已付 / 应付 / 下一卡口应付）与报告门禁 */
.pay-panel{margin-top:10px;border:1px solid var(--line);border-radius:6px;padding:10px 12px;background:#f7f9fb}
.pay-track{position:relative;height:10px;background:#edf0f4;border-radius:8px;overflow:hidden;margin:8px 0 6px}
.pay-track span{display:block;height:100%;background:var(--blue-500);border-radius:8px}
.pay-track span.missed{background:#e5a23b}
.pay-line{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;font-size:11px;color:var(--muted)}
.pay-line b{color:var(--ink);font-variant-numeric:tabular-nums}
.pay-gates{display:flex;gap:7px;flex-wrap:wrap;margin-top:9px}
.pay-gate{display:grid;gap:2px;border:1px solid var(--line);border-radius:6px;padding:7px 9px;background:#fff;font-size:11px;min-width:150px}
.pay-gate.reached{border-color:#b9dfc1;background:#f3fbf5}
.pay-gate.missed{border-color:#ecd9ae;background:var(--warning-bg)}
.pay-gate strong{color:var(--ink)}
.pay-gate small{color:var(--muted);font-size:10px}
.report-entry{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-top:10px;border-top:1px dashed var(--line);padding-top:10px;font-size:11px;color:var(--muted)}
.report-entry .button{text-decoration:none;display:inline-flex;align-items:center}
