/* ==========================================================================
   misweb 主题引擎  v1.0
   参考 vue-vben-admin 主题配置方案，适配 Razor + jQuery 技术栈
   核心思想：用 CSS 自定义变量驱动全局配色，运行时切换无需整包替换 CSS
   ========================================================================== */

:root {
  /* ---- 品牌主色（默认：餐餐安绿，可被主题配置覆盖） ---- */
  --brand-primary: #04AA5B;
  --brand-primary-hover: #06ab5d;
  --brand-primary-active: #039150;
  --brand-primary-light: #23b56f;
  --brand-primary-lighter: #28C97C;

  /* 主色衍生的浅色背景 / 描边 / 文字底色（由 JS 依据主色自动计算，此处为默认） */
  --brand-primary-bg: #eaf8f4;        /* 主色 8% 透明度铺底 */
  --brand-primary-bg-hover: #d9f2e8;  /* 主色 14% */
  --brand-primary-border: #b7e6d2;    /* 主色 30% */
  --brand-primary-shadow: rgba(4, 170, 91, 0.25);

  /* 旧壳主按钮色（与顶栏主色解耦；JS 运行时按角色/自定义色覆盖，此处为默认餐安绿） */
  --brand-action: #04AA5B;
  --brand-action-hover: #039150;
  --brand-action-active: #039150;
  --brand-ink: #027a44;        /* 实心面/按钮深品牌色：白字对比 ~5.4 达 WCAG AA（D6） */

  /* ---- 中性色阶（亮色系） ---- */
  --text-primary: #1f2733;    /* 主文案 */
  --text-regular: #4c4c4c;    /* 常规文案 */
  --text-secondary: #6b7280;  /* 次要文案：上调一档，白底对比 ~4.6 达 AA（D6） */
  --text-placeholder: #9ca3af;/* 占位：上调一档（D6） */
  --text-disabled: #c8cdd4;

  --bg-page: #f5f7fa;         /* 页面底色 */
  --bg-card: #ffffff;         /* 卡片 */
  --bg-hover: #f5f5f5;
  --bg-mask: rgba(0, 0, 0, 0.45);

  --border-base: #e5e5e5;
  --border-light: #eeeeee;
  --border-lighter: #f2f2f2;

  /* ---- 功能色 ---- */
  --color-success: #22c55e;
  --color-warning: #ff8d1a;
  --color-danger: #eb4b4b;
  --color-info: #64acf4;
  --color-success-bg: rgba(34, 197, 94, 0.12);
  --color-warning-bg: rgba(255, 141, 26, 0.12);
  --color-danger-bg: rgba(235, 75, 75, 0.12);
  --color-info-bg: rgba(100, 172, 244, 0.12);
  --link: #409eff;
  --link-hover: #1976d2;

  /* ---- 布局专属（顶栏 / 侧边栏 独立配色，vben 特性） ---- */
  --header-bg: var(--brand-primary);
  --header-text: #ffffff;
  /* 门户外壳 S+（REQ202611260013）：--header-logo / --header-item-active-bg /
     --header-item-active-text / --header-item-hover-bg 由 theme-engine.js 的 apply() 按档显式写入，
     **故意不在这里给默认值**：本文件走 max-age=3600 缓存，可能与 CSS 分片版本错配。
     故意留空 ⇒ 旧版引擎（不写这些 token）时 CSS 侧的回退链
     `var(--header-logo, var(--header-text))` / `var(--header-item-active-bg, var(--header-overlay-22))`
     才会生效（降级成旧口径，而不是解析失败变透明）。 */
  /* 侧栏底色：门户外壳 S+（REQ202611260013）改为品牌 tint（主色 10% + 白 90%），
     治「整体太白」（原 #f7f9fd 与页底 #f5f7fa 仅 1.02:1）。首行为老浏览器兜底。 */
  --sidebar-bg: #f7f9fd;
  --sidebar-bg: color-mix(in srgb, var(--brand-primary) 10%, #ffffff);
  --sidebar-text: var(--text-regular);
  --sidebar-active-bg: var(--brand-primary-bg);
  --sidebar-active-text: var(--brand-primary);

  /* ---- 圆角 / 阴影 / 动效 ---- */
  --radius-sm: 6px;
  --radius-base: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-card: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-pop: 0 12px 32px -8px rgba(16, 24, 40, 0.18);
  --shadow-float: 0 24px 64px -16px rgba(16, 24, 40, 0.28);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 0.18s;
  --duration-base: 0.32s;

  /* ---- 字体 ---- */
  --font-family: "Outfit", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", system-ui, -apple-system, sans-serif;

  /* ---- 字阶（type scale；D4 新增族） ---- */
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --lh-tight: 1.25;
  --lh-snug: 1.4;
  --lh-base: 1.6;
  --lh-relaxed: 1.8;

  /* ---- 间距（4px 栅格；D4 新增族） ---- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* ---- 层级 z-index（D4 新增族） ---- */
  --z-base: 1;
  --z-sticky: 100;
  --z-dropdown: 1000;
  --z-overlay: 1100;
  --z-modal: 1200;
  --z-toast: 1300;
  --z-tooltip: 1400;

  /* ---- 断点（D4 新增族；媒体查询不能引用 CSS 变量，此值供 JS / 容器查询 / 文档参考） ---- */
  --bp-xs: 480px;
  --bp-sm: 768px;
  --bp-md: 1024px;
  --bp-lg: 1280px;
  --bp-xl: 1536px;

  /* ---- 动效（扩展族） ---- */
  --duration-slow: 0.5s;
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: all var(--duration-base) var(--ease-out);
}

/* ==========================================================================
   深色模式（vben: dark mode）—— 通过 [data-theme="dark"] 切换
   ========================================================================== */
[data-theme="dark"] {
  --text-primary: #e8eaed;
  --text-regular: #c0c4cc;
  --text-secondary: #909399;
  --text-placeholder: #6b7280;
  --text-disabled: #4b5563;

  --bg-page: #0f1419;
  --bg-card: #1a2129;
  --bg-hover: #232c36;
  --bg-mask: rgba(0, 0, 0, 0.65);

  --border-base: #2d3742;
  --border-light: #242e38;
  --border-lighter: #1f2830;

  --header-bg: #1a2129;
  --header-text: #e8eaed;
  --sidebar-bg: #151b22;
  --sidebar-text: #c0c4cc;
  --sidebar-active-bg: rgba(4, 170, 91, 0.16);
  --sidebar-active-text: var(--brand-primary-lighter);

  --color-success: #4ade80;
  --color-warning: #fb923c;
  --color-danger: #f87171;
  --color-info: #60a5fa;
  --color-success-bg: rgba(74, 222, 128, 0.16);
  --color-warning-bg: rgba(251, 146, 60, 0.16);
  --color-danger-bg: rgba(248, 113, 113, 0.16);
  --color-info-bg: rgba(96, 165, 250, 0.16);
  --link: #60a5fa;
  --link-hover: #93c5fd;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 12px 32px -8px rgba(0, 0, 0, 0.6);
  --shadow-float: 0 24px 64px -16px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   无障碍模式（vben: gray mode / color weak mode）
   通过根元素挂 class 触发整页滤镜
   ========================================================================== */
.mode-contrast { filter: contrast(1.25) saturate(1.08); }
.mode-gray     { filter: grayscale(1); }
/* T7：色弱改为 SVG feColorMatrix（见 theme-engine.js 注入的 filter #misweb-deuteranopia），
   不再使用 invert——反色不是色弱模拟。 */
.mode-weak     { filter: url(#misweb-deuteranopia); }

/* ==========================================================================
   原生单选 / 复选框跟随主题色
   旧壳页面大量用未做外观定制的 <input type="radio"> / <input type="checkbox">
   （如 添加自查内容配置 的「模板类型」「生效方式」），浏览器按系统强调色画成蓝色，
   与品牌色割裂。accent-color 只影响原生控件，已被旧壳自定义外观（.custom-checkbox 等）的控件不受影响。
   ========================================================================== */
input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--brand-primary);
}

/* ==========================================================================
   旧壳按钮跟随门户主题色（覆盖旧壳 theme_*.css 硬编码品牌色）
   theme-engine.css 会在 iframe load 后被注入到 <head> 末尾（theme-inject.ts），同级选择器后加载者胜；
   关键状态用 !important 兜底（旧壳部分 :hover/:active 自带 !important）。
   覆盖范围：查询/打印/导出/添加（实心主按钮）、取消/重置（描边次按钮）、表格操作栏文字按钮；
   .btn-deletes（删除）保留危险红，不跟随主题。
   ========================================================================== */

/* 查询 / 打印 / 导出 / 添加（实心主按钮）—— 底色用 --brand-action（对齐旧壳按钮底色，非顶栏色） */
.query-btn,
.table-tool-box .btn-export {
  background: var(--brand-primary) !important;
  color: #fff !important;
}

/* hover/active：旧壳约定「加深」→ 用 --brand-action-hover（对齐旧壳按钮悬停色） */
.query-btn:hover,
.query-btn:active,
.table-tool-box .btn-export:hover {
  background: var(--brand-primary-hover) !important;
  color: #fff !important;
}

/* 取消（.btn-export.cancel 描边变体） + 重置（.btn-reset 描边次按钮） */
.table-tool-box .btn-export.cancel,
.btn-reset {
  background: var(--brand-primary-bg) !important;
  border-color: var(--brand-primary) !important;
  color: var(--brand-primary) !important;
}

/* 表格操作栏文字按钮（修改/编辑/查看等；.btn-deletes 不在此列，保留危险色） */
.table-box-wrap .btn-operate {
  color: var(--brand-primary) !important;
}

/* ===== 补充覆盖：旧壳其余主色按钮（详情页/弹窗/分组），确保换肤后不再残留硬编码色 ===== */

/* 实心主按钮（补充）：添加/确认/保存/上报/同意等 */
.bj-btn,
.btn3,
.btnO,
.codediv .btn-agree,
.q-wrap .q-btn,
.q-wrap-row .date-quick-lbl.active,
.week-wrap .active,
.imSe {
  background: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
  color: #fff !important;
}

/* 搜索按钮：背景图 + 主题底色（保留原有放大镜图标，仅换底色；hover 用 action-hover 加深） */
.searBtn {
  background-color: var(--brand-primary) !important;
}
.searBtn:hover {
  background-color: var(--brand-primary-hover) !important;
}

/* 下拉/切换激活态（Bootstrap btn-default.active / dropdown-toggle 自带 !important 硬编码） */
.btn-default.active,
.btn-default:active,
.open .dropdown-toggle.btn-default {
  background-color: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
  color: #fff !important;
}

/* 页面内联的筛选标签激活态（如 PSOrderIndex 的 .btn-group .active #28C97C !important） */
.btn-group .active {
  color: var(--brand-primary) !important;
  border-bottom-color: var(--brand-primary) !important;
}
/* 但「填充式」筛选标签（bootstrap button-group，底色为品牌色的 .btn-default 变体）文字必须白色，
   否则品牌字压在品牌底上等于看不见。只认 .btn-default 变体——没有底色的切换按钮（.btn.active）
   仍用上一条的品牌字色，不能被误刷成白字。 */
.btn-group > label.btn-default.active,
.btn-group > label.btn-default.active:hover,
.btn-group > label.btn-default.active:focus,
.btn-group > .btn.btn-default.active,
.btn-group > .btn.btn-default.active:hover {
  color: #fff !important;
}

/* 旧页位图资产原是品牌绿，CSS 令牌换不了色：
   ① EasyUI 日期框的日历图标 → 用 mask 取当前文字色（中性，任何主题都不突兀）
   ② 空态插图（homenewpage/pic-null*）→ 降饱和为中性灰，避免非绿主题下残留绿色 */
.icon-th {
  background-image: none !important;
  background-color: currentColor;
  -webkit-mask: url("/images/icon_calendar.png") center / contain no-repeat;
  mask: url("/images/icon_calendar.png") center / contain no-repeat;
}
/* 固定绿 PNG 位图资产：引擎按品牌色相算出 --asset-hue-rotate（见 theme-engine.js），
   这里把位图色相旋到当前主题；变量缺失时退化为 0 度（原色）。filter 对元素整体生效，
   <img src> 与 background-image 都能覆盖。
   ① 空态插图 homenewpage/ · pic-null*（含内联 background: url(/images/pic-null*.png) 商品卡）
   ② 品牌绿购物车 ShoppingCart.png（绿圆底白购物车）
   ③ 采购"立即下单"两个小图标：分类选中对勾 .ckButton（背景 OrderChecked.png）
      + 列表/图片切换 changeListBoxSmall.png（<img>）
   ④ data-misweb-ph：引擎运行时探测出的后端兜底图（/default/wimage/index 返回 pic-null.png，
      URL 与真商品图同形，只能按 225×165 固有尺寸打标；见 theme-engine.js markPlaceholderAssets） */
img[src*="/images/homenewpage/"],
img[src*="pic-null"],
img[src*="/images/ShoppingCart.png"],
img[src*="changeListBoxSmall"],
.ckButton,
[style*="url(/images/pic-null"],
[data-misweb-ph] {
  filter: hue-rotate(var(--asset-hue-rotate, 0deg));
}

/* btn-group 分组切换（旧壳 .btn-group .btnCk.active 硬编码绿，未跟随主题） */
.btn-group .btnCk.active {
  background-color: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
  color: #fff !important;
}

/* 描边次按钮（补充）：关联（同 .btn-reset 语义：浅底 + 主色描边/文字） */
.table-tool-box .btn-relation {
  background: var(--brand-primary-bg) !important;
  border-color: var(--brand-primary) !important;
  color: var(--brand-primary) !important;
}

/* 文字按钮/强调数字（补充）：.btnS 子操作文字按钮、.total-org 强调数字 */
.btnS,
.total-org {
  color: var(--brand-primary) !important;
}

/* 弹窗主按钮（zeroModal）：.zeromodal-btn-primary 硬编码 #2196f3 蓝 → 跟随主题按钮底色；
   .l-btn-primary / .l-btn-ok 为 zeroModal 弹窗确认按钮同源类名，一并覆盖 */
.zeromodal-btn-primary,
.l-btn-primary,
.l-btn-ok {
  background-color: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
  color: #fff !important;
}

/* ===== T2：旧页高频主按钮补齐（扫描 wwwroot/css 品牌色按钮类名后确定） =====
   选取依据：类名频次 + 块内存在品牌色 background。仅覆盖颜色，不改尺寸/圆角。 */
.pre_buttton,
.btn-custom-blue,
.btn-submit,
.btnApply,
.btn1,
.btn-search,
.layui-layer-btn0 {
  background: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
  color: #fff !important;
}
.pre_buttton:hover,
.btn-custom-blue:hover,
.btn-submit:hover,
.btnApply:hover,
.btn1:hover,
.btn-search:hover,
.layui-layer-btn0:hover {
  background: var(--brand-action-hover) !important;
  border-color: var(--brand-action-hover) !important;
  color: #fff !important;
}
/* T2：供应商档案页的分组标题与小竖条（.block_title / .line_，#06ab5d） */
.block_title { color: var(--brand-primary) !important; }
.line_ { background: var(--brand-primary) !important; }

/* T2：旧页通用品牌色（链接 / 筛选条 / 周切换 / 开关 / 标签竖条）
   a 不带 !important：只在没有更具体规则时生效，避免破坏白字链接等特例 */
a { color: var(--brand-primary); }
.theme-color { color: var(--brand-primary) !important; }
.week-wrap, .weekMenu { color: var(--brand-primary) !important; }
.icon-double-angle-down { color: var(--brand-primary) !important; }
.isxuan.activ, .isxuan.activ1 { background-color: var(--brand-action) !important; }
.switchery-small.active { background-color: var(--brand-primary) !important; border-color: var(--brand-primary) !important; }
.common-operate-tag .line { background: var(--brand-primary) !important; }
#superPlat { color: var(--brand-primary) !important; }

.buttomStyle { border-color: var(--brand-primary) !important; }
#totalNumber { color: var(--brand-primary) !important; }

/* T2：采购下单 / 库存 / 消毒等页面（place_order.css 等写死 #18B49C/#32B58B） */
.btn-import { border-color: var(--brand-primary) !important; color: var(--brand-primary) !important; }
.selectChecked, .serachPranet, .theme-border { border-color: var(--brand-primary) !important; }
.addcls, .historyxd, .ShowName { color: var(--brand-primary) !important; }

/* T2：个人中心 / 个性化配置：激活标签、按钮、品牌文字（cshtml 内联 / 角色主题写死） */
.bgwhite { background: var(--brand-primary) !important; }
.changeImg, .savebtn { background: var(--brand-action) !important; color: #fff !important; }
.changeImg:hover, .savebtn:hover { background: var(--brand-action-hover) !important; }
.imghover { color: var(--brand-primary) !important; }
.val[style*="#32B58B"] { color: var(--brand-primary) !important; border-bottom-color: var(--brand-primary) !important; }
#myTab .active .labeltitle, #myTab .active .labelfooter { color: var(--brand-primary) !important; }

/* T2：首页看板供餐设置弹窗与品牌装饰（BaseHomeNewPage.css 硬编码 #32B58B / #00B589） */
.xian { background-color: var(--brand-primary) !important; }
.activ, .activ1 { background-color: var(--brand-action) !important; }
.confbtn { background-color: var(--brand-action) !important; }
.custom-checkbox::after { background-color: var(--brand-action) !important; }
.crcle { background: var(--brand-primary) !important; }
.keyschool { color: var(--brand-primary) !important; }
/* 看板标题（cshtml 内联 .homeTitle { color:#00B589 }） */
.homeTitle { color: var(--brand-primary) !important; }

/* 看板内联品牌绿（今日登录标题 / 底部条边框），内联样式非 !important，可被这里覆盖 */
p[style*="#00B589"] { color: var(--brand-primary) !important; }
.daybottomItem[style*="#00B589"] { border-color: var(--brand-primary) !important; }

/* T2：表头浅色底跟随主题色（旧 theme_*.css 把 .datagrid-header 写死为角色绿/蓝） */
.datagrid-header {
  background: var(--table-head-bg, #f4f6f8) !important;
}
.r-table-wrap thead {
  background: var(--table-head-bg, #f4f6f8) !important;
}
/* 同一套表头浅色结构：行首标签列 / footer 标签列（旧主题 4 处写死同一色） */
.r-table-wrap tbody tr td:first-child {
  background: var(--table-head-bg, #f4f6f8) !important;
}
#footerTable tr td:nth-child(odd) {
  background: var(--table-head-bg, #f4f6f8) !important;
}

/* T2：页面标题（31 个视图使用 .title_ 下划线；.supplier_title 为供应商页标题文字） */
.title_ { border-bottom-color: var(--brand-primary) !important; }
.supplier_title { color: var(--brand-primary) !important; }

/* T2：输入焦点（规范 §7.2：旧壳 #1AB394 焦点色 → 主色） */
.normal-input:focus,
.query-item:focus,
.inputStyle:focus {
  border-color: var(--brand-primary) !important;
}

/* T2：角色徽标（规范 §7.2：.profile-header .role） */
.profile-header .info-wrap .role {
  background: var(--brand-primary) !important;
}

/* 描边次按钮：浅底 + 主色描边/文字（对应 .btn-reset 语义） */
.btn-batch {
  background: var(--brand-primary-bg) !important;
  border-color: var(--brand-primary) !important;
  color: var(--brand-primary) !important;
}

/* portal iframe 嵌入老路由兼容：OrderAudit 等老页面 .filter-content-wrap 嵌套一层 inline flex row，
   导致内部 .input-w 被 flex 容器压缩到 200-300px（不足以容纳 label + 180px select 横向排开），
   浮动的 select 溢出到下一行，被 .input-w 自带的 overflow:hidden 裁掉。
   强制 flex-shrink:0 + width:max-content + min-height + nowrap + visible，让 .input-w 宽度自适应内容、label 与 select 同行。
   （仅针对有 inline flex 的嵌套结构，不影响其他页面） */
.filter-content-wrap > div[style*="flex"][style*="row"] > .input-w {
    flex-shrink: 0;
    width: max-content;
    min-width: 50px;
    min-height: 50px;
    overflow: visible;
    white-space: nowrap;
}
