﻿/* 几间dsh工作台 V0.3.0 · 浅色主题 */
/* 客户列表列隐藏（▦ 列设置） */
th[data-col].col-off, td[data-col].col-off { display:none !important; }
/* 首页客户列表：单行工具栏（可横向滑动） + 弹出浮层 */
.clist-tools{display:flex;align-items:center;border-bottom:1px solid var(--line);padding:6px 8px;gap:2px;max-width:100%}
.clist-scroll{display:flex;flex-wrap:nowrap!important;align-items:center;gap:6px;overflow-x:auto;flex:1;scrollbar-width:thin;padding:2px 2px;cursor:grab;-webkit-overflow-scrolling:touch}
.clist-scroll>*{flex:0 0 auto;white-space:nowrap}
.clist-scroll:active{cursor:grabbing}
.clist-scroll::-webkit-scrollbar{height:5px}
.clist-scroll::-webkit-scrollbar-thumb{background:#d3dae2;border-radius:3px}
.clist-scroll::-webkit-scrollbar-track{background:transparent}
.cl-sep{width:1px;height:18px;background:var(--line);flex:none;margin:0 2px}
.cl-scroll-btn{flex:none;width:24px;height:28px;line-height:1;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--text2);cursor:pointer;font-size:17px;visibility:hidden;user-select:none}
.popmenu{position:fixed;z-index:3000;display:flex;flex-direction:column;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:8px;gap:5px;min-width:176px;max-height:340px;overflow:auto;box-shadow:0 10px 30px rgba(0,0,0,.16)}
.popmenu label{display:flex;align-items:center;gap:6px;font-size:12px;cursor:pointer;white-space:nowrap}
*{margin:0;padding:0;box-sizing:border-box}
/* ===== 移动端触摸优化 ===== */
*{
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}
/* 可点击元素触摸反馈 */
.btn, .nav-item, .cat-tab, .seg-btn, .cd-tab, .qe-space-item, .cn-tag-chip, .design-sec-head, .bell-tab, .link, .st, .cal-cell, .cal-item, .row, .tbl tr {
  -webkit-tap-highlight-color: rgba(0,113,227,.15);
  touch-action: manipulation;
}
/* 按钮按下反馈 */
.btn:active, .nav-item:active, .cat-tab:active, .seg-btn:active, .cd-tab:active {
  transform: scale(0.97);
  opacity: 0.85;
  transition: transform 0.1s, opacity 0.1s;
}
/* 触摸滚动优化 */
.overflow-auto, .tbl-scroll, .clist-scroll, .top-nav, .qe-left-list {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* 输入框触摸优化 */
input, select, textarea {
  font-size: 16px; /* 防止iOS自动缩放 */
  -webkit-appearance: none;
  appearance: none;
}
/* 触摸目标最小尺寸（所有设备生效，iPad/平板也适用） */
.btn, .nav-item, .cat-tab, .seg-btn, .cd-tab {
  min-height: 36px;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.top-nav .nav-item {
  min-height: 36px;
  padding: 6px 12px;
}
.tbl th, .tbl td {
  padding: 10px 8px;
}
/* 移动端触摸目标最小尺寸 */
@media (max-width: 768px) {
  .btn, .nav-item, .cat-tab, .seg-btn, .cd-tab {
    min-height: 44px;
    min-width: 44px;
  }
  .top-nav .nav-item {
    min-height: 40px;
    padding: 8px 12px;
  }
  .tbl th, .tbl td {
    padding: 12px 10px;
  }
}
/* iPad/平板特定优化 */
@media (min-width: 768px) and (max-width: 1024px) {
  .btn, .nav-item, .cat-tab, .seg-btn, .cd-tab {
    min-height: 40px;
    min-width: 40px;
  }
  input, select, textarea {
    font-size: 15px;
  }
}
:root{
  --bg:#f5f5f7; --panel:#ffffff; --soft:#f5f5f7; --soft2:#e8e8ed;
  --line:#e5e5ea; --line2:#d1d1d6; --line3:#c7c7cc;
  --ink:#1d1d1f; --text2:#424245; --muted:#86868b;
  --brand:#0071e3; --brand-d:#0077ed; --brand-glow:rgba(0,113,227,.12);
  --green:#34c759; --gold:#ff9500; --red:#ff3b30; --blue:#0071e3;
  --radius:12px; --shadow:0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
  --input-bg:#ffffff; --hover:rgba(0,113,227,.06);
}
html,body{height:100%}
body{font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif;background:var(--bg);color:var(--ink);font-size:14px}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#c1c5ca;border-radius:6px}
::-webkit-scrollbar-thumb:hover{background:#a1a5aa}
::-webkit-scrollbar-track{background:transparent}
.btn{cursor:pointer;border:1px solid var(--line);background:var(--panel);border-radius:10px;padding:8px 16px;font-size:13px;color:var(--ink);transition:.2s;font-weight:500}
.btn:hover{border-color:var(--brand);color:var(--brand);background:var(--hover);transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn-pri{background:var(--brand);border-color:var(--brand);color:#fff;font-weight:600}
.btn-pri:hover{background:var(--brand-d);color:#fff;border-color:var(--brand-d);box-shadow:0 4px 12px rgba(0,113,227,.3)}
.btn-block{width:100%}
.btn-sm{padding:5px 12px;font-size:12px;border-radius:8px}
.btn-ghost{background:transparent;border-color:transparent;color:var(--muted)}
.btn-ghost:hover{color:var(--brand);border-color:transparent;background:var(--hover)}

/* ===== 登录 ===== */
.login-mask{position:fixed;inset:0;background:linear-gradient(135deg,#e8ecf3,#dfe6f5 55%,#d5def0);display:flex;align-items:center;justify-content:center;padding:16px;z-index:100}
.login-card{background:var(--panel);border:1px solid var(--line2);border-radius:16px;padding:36px 40px;width:360px;max-width:100%;box-sizing:border-box;box-shadow:0 20px 60px rgba(0,0,0,.5)}
.login-brand{font-size:22px;font-weight:800;color:var(--brand);text-align:center}
.login-sub{font-size:12px;color:var(--muted);text-align:center;margin:6px 0 22px}
.login-card input{width:100%;background:var(--input-bg);border:1px solid var(--line);border-radius:8px;padding:10px 12px;font-size:14px;margin-bottom:12px;outline:none;color:var(--ink)}
.login-card input:focus{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-glow)}
.login-msg{color:var(--red);font-size:12px;text-align:center;min-height:18px;margin-top:8px}
.login-hint{font-size:11px;color:var(--muted);text-align:center;margin-top:14px;line-height:1.8}

/* ===== 框架 ===== */
.app{display:flex;height:100vh}
.sidebar{width:160px;background:var(--panel);border-right:1px solid var(--line);display:flex;flex-direction:column;flex-shrink:0;position:relative;transition:width .12s}
.sidebar.dragging{transition:none}
.sidebar-resizer{position:absolute;right:-5px;top:0;bottom:0;width:10px;cursor:col-resize;z-index:30;background:transparent}
.sidebar-resizer:hover,.sidebar-resizer.active{background:var(--brand-glow)}
.brand{padding:14px 14px 12px;border-bottom:1px solid var(--line)}
.brand-name{font-size:14.5px;font-weight:800;color:var(--brand);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-ver{font-size:11px;color:var(--muted);margin-top:2px}
.nav{flex:1;padding:10px 10px;overflow-y:auto}
.nav-item{display:flex;align-items:center;gap:10px;width:100%;border:none;background:transparent;border-radius:8px;padding:10px 12px;font-size:13.5px;font-weight:700;color:var(--ink);cursor:pointer;margin-bottom:2px;text-align:left;white-space:nowrap}
.nav-item:hover{background:var(--soft)}
.nav-item.active{background:linear-gradient(135deg,var(--brand-glow),rgba(77,107,254,.05));color:var(--brand);font-weight:800;box-shadow:inset 3px 0 0 var(--brand)}
.nav-item .ico{font-size:15px;line-height:1;display:inline-flex;align-items:center}
.nav-item .nav-arrow{margin-left:6px;width:12px;display:inline-flex;align-items:center;justify-content:center;font-size:10px;line-height:1;color:var(--muted);transition:transform .15s;flex-shrink:0}
.nav-item .nav-arrow:empty{color:transparent}
.nav-badge{margin-left:auto;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--line);color:var(--text2);font-size:10.5px;font-weight:700;line-height:1;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}
.nav-badge.warn{background:rgba(248,81,73,.16);color:var(--red)}
.nav-badge:empty{display:none}
.nav-item.open .nav-arrow{transform:rotate(180deg)}
.sidebar.mini .nav-badge{position:absolute;right:6px;top:6px;min-width:8px;height:8px;padding:0;border-radius:50%;font-size:0}
.sidebar.mini .nav-badge:empty{display:none}
.nav-sub{display:none;padding:2px 10px 10px;margin:0 8px 6px;background:var(--soft);border:1px solid var(--line);border-radius:10px}
.nav-sub.open{display:flex;flex-direction:column}
.nav-sub button{display:flex;align-items:center;gap:8px;width:100%;border:none;background:transparent;border-radius:6px;padding:7px 10px 7px 22px;font-size:12px;color:var(--text2);cursor:pointer;text-align:left;white-space:nowrap;position:relative}
.nav-sub button::before{content:'';position:absolute;left:9px;top:50%;transform:translateY(-50%);width:5px;height:5px;border-radius:50%;background:var(--line3)}
.nav-sub button:hover{background:var(--soft2);color:var(--brand)}
.nav-sub button:hover::before{background:var(--brand)}
.nav-sub button.active{color:var(--brand);font-weight:700;background:var(--soft2)}
.nav-sub button.active::before{background:var(--brand)}
.ref-tree{list-style:none;margin:6px 0 0;padding-left:24px}
.ref-tree li{position:relative;padding:3px 0}
.ref-tree li::before{content:'';position:absolute;left:-16px;top:0;bottom:0;border-left:1px solid var(--line2)}
.ref-tree li::after{content:'';position:absolute;left:-16px;top:20px;width:14px;border-top:1px solid var(--line2)}
.ref-tree>li:first-child::before{top:10px}
.ref-tree>li:last-child::before{height:10px}
.ref-node{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);border-radius:8px;padding:5px 10px;background:var(--panel);font-size:12.5px;cursor:pointer;transition:.12s}
.ref-node:hover{border-color:var(--brand);color:var(--brand)}
.sidebar.mini{width:64px!important}
.sidebar.mini .brand{padding:12px 0;text-align:center}
.sidebar.mini .brand-name,.sidebar.mini .brand-ver{display:none}
.sidebar.mini .nav{padding:10px 6px}
.sidebar.mini .nav-item{justify-content:center;padding:10px 0;gap:0}
.sidebar.mini .nav-txt{display:none}
.sidebar.mini .nav-item .ico{font-size:18px}
.sidebar.mini .sidebar-foot{padding:10px 0;align-items:center}
.sidebar.mini .user-area,.sidebar.mini .sidebar-foot .btn-ghost{display:none}
.sidebar.mini .sidebar-resizer{display:none}
.sidebar.mini .nav-sub{display:none!important}
.sidebar-foot{padding:12px 14px;border-top:1px solid var(--line)}
.user-area{font-size:12.5px;color:var(--text2);margin-bottom:6px}

.main{flex:1;display:flex;flex-direction:column;min-width:0}
.topbar{height:52px;background:var(--panel);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 20px;flex-shrink:0}
.crumb{font-size:13px;color:var(--muted)}
.topbar-search{position:relative;flex:1;max-width:420px;margin:0 16px}
.topbar-search input{width:100%;background:var(--input-bg);border:1px solid var(--line);border-radius:8px;padding:8px 12px;font-size:12.5px;color:var(--ink)}
.topbar-search input:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-glow)}
.global-search-res{position:absolute;top:calc(100% + 4px);left:0;right:0;background:var(--panel);border:1px solid var(--line);border-radius:10px;box-shadow:0 6px 24px rgba(0,0,0,.5);z-index:99;max-height:320px;overflow:auto;display:none}
.gs-item{display:flex;align-items:center;gap:8px;padding:8px 12px;font-size:12.5px;cursor:pointer;border-bottom:1px solid var(--line)}
.gs-item:hover{background:var(--hover)}
.body{flex:1;overflow-y:auto;padding:18px 22px}

.page{display:none}
.page.active{display:block}
.page-title{font-size:17px;font-weight:800;margin-bottom:10px}
.page-sub{font-size:12px;color:var(--muted);font-weight:400;margin-left:8px}

/* ===== 看板 ===== */
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:10px}
.kpi{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:12px 14px;box-shadow:var(--shadow)}
.kpi:hover{border-color:var(--line2)}
.kpi-label{font-size:11.5px;color:var(--muted)}
.kpi-num{font-size:22px;font-weight:800;margin:4px 0 2px}
.kpi-num.green{color:var(--green)} .kpi-num.gold{color:var(--gold)} .kpi-num.blue{color:var(--blue)} .kpi-num.red{color:var(--red)}
.kpi-tip{font-size:10.5px;color:var(--muted)}
.quick-row{display:flex;gap:8px;margin-bottom:10px;flex-wrap:wrap}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:10px}

.panel{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);margin-bottom:10px;overflow:hidden}
.panel-head{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid var(--line);font-size:13.5px;font-weight:600}
.panel-body{padding:10px 14px}
.tag{font-size:11px;background:var(--brand-glow);color:var(--brand);border-radius:6px;padding:2px 8px;font-weight:400}
.row{display:flex;align-items:center;gap:10px;padding:6px 0;border-bottom:1px dashed var(--line);font-size:13px}
.row:last-child{border-bottom:none}
.dot{width:8px;height:8px;border-radius:50%;display:inline-block}
.dot.work{background:var(--blue)} .dot.sign{background:var(--green)} .dot.pay{background:var(--gold)} .dot.inspect{background:#dd8b2a}
.dot-g{width:8px;height:8px;border-radius:50%;background:var(--green);flex-shrink:0}
.dot-b{width:8px;height:8px;border-radius:50%;background:var(--blue);flex-shrink:0}
.dot-y{width:8px;height:8px;border-radius:50%;background:var(--gold);flex-shrink:0}
.dot-o{width:8px;height:8px;border-radius:50%;background:#dd8b2a;flex-shrink:0}

/* ===== 工作日历 ===== */
.cal-wrap{display:flex;gap:16px;align-items:flex-start}
.cal-grid{flex:1;min-width:0}
.cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:4px;flex:1;min-width:0}
.cal-dow{font-size:11px;color:var(--muted);text-align:center;padding:4px 0}
.cal-cell{border:1px solid var(--line);border-radius:8px;min-height:46px;padding:4px 6px;cursor:pointer;background:var(--panel)}
.cal-cell:hover{border-color:var(--brand)}
.cal-cell.sel{background:var(--brand-glow);border-color:var(--brand)}
.cal-cell.today .d{background:var(--brand);color:#fff;border-radius:50%;width:20px;height:20px;line-height:20px;text-align:center}
.cal-cell .d{font-size:12px;font-weight:600}
.cal-cell .dots{display:flex;gap:2px;margin-top:4px;flex-wrap:wrap}
.cal-empty{background:transparent;border-color:transparent;cursor:default}
.cal-daylist{background:var(--soft);border:1px solid var(--line);border-radius:8px;padding:10px 12px;width:260px;min-width:260px}
.cal-title{font-size:12.5px;font-weight:700;margin-bottom:8px}
.cal-item{font-size:12px;padding:5px 0;border-bottom:1px dashed var(--line2);display:flex;justify-content:space-between;gap:8px}
.cal-item:last-child{border-bottom:none}
.cal-chat{display:flex;gap:8px;margin-top:10px}
.cal-chat input{flex:1;background:var(--input-bg);border:1px solid var(--line);border-radius:8px;padding:8px 10px;font-size:12.5px;outline:none;color:var(--ink)}
.cal-chat input:focus{border-color:var(--brand)}
.cal-reply{margin-top:6px;font-size:12px;min-height:16px}

.prog-row{display:flex;align-items:center;gap:12px;padding:7px 0;font-size:12.5px}
.prog-row>span{width:170px;color:var(--text2)}
.prog{flex:1;height:8px;background:var(--line);border-radius:4px;overflow:hidden}
.prog-fill{height:100%;background:var(--brand);border-radius:4px}

/* ===== 占位 ===== */
.placeholder{background:var(--panel);border:1px dashed var(--line2);border-radius:var(--radius);padding:60px 20px;text-align:center;color:var(--muted);font-size:15px;line-height:2.2}
.placeholder .muted{font-size:12.5px}

/* ===== 提示 ===== */
.toast{position:fixed;left:50%;bottom:40px;transform:translateX(-50%);background:#232b3a;color:#fff;border:1px solid var(--line2);border-radius:8px;padding:10px 20px;font-size:13px;z-index:9999;opacity:0;pointer-events:none;transition:.25s;box-shadow:0 4px 16px rgba(0,0,0,.15)}
.toast.show{opacity:1}

/* ===== 表格 / 工具条 ===== */
.ops{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.ops input{background:var(--input-bg);border:1px solid var(--line);border-radius:8px;padding:7px 10px;font-size:12.5px;outline:none;color:var(--ink)}
.ops input:focus{border-color:var(--brand)}
.seg{display:inline-flex;background:var(--soft);border:1px solid var(--line);border-radius:8px;overflow:hidden}
.seg-btn{border:none;background:transparent;padding:7px 14px;font-size:12.5px;cursor:pointer;color:var(--text2)}
.seg-btn:hover{color:var(--brand)}
.seg-btn.active{background:var(--brand);color:#fff}
.tbl{width:100%;border-collapse:collapse}
.tbl th{background:var(--soft);font-size:12px;color:var(--muted);text-align:left;padding:10px 12px;border-bottom:1px solid var(--line);white-space:nowrap}
.tbl td{padding:10px 12px;font-size:13px;border-bottom:1px solid var(--line);white-space:nowrap}
.tbl tr:hover td{background:var(--soft)}
.tbl .link{color:var(--brand);cursor:pointer;font-size:12px;margin-right:10px}
.tbl .link.danger{color:var(--red)}
.tbl-scroll{overflow-x:auto;overflow-y:hidden;scrollbar-width:thin;scrollbar-color:#c1c5ca transparent}
.tbl-scroll::-webkit-scrollbar{height:9px}
.tbl-scroll::-webkit-scrollbar-thumb{background:#c1c5ca;border-radius:5px}
.tbl-scroll::-webkit-scrollbar-thumb:hover{background:#a1a5aa}
.tbl-scroll .tbl{width:max-content;min-width:100%;table-layout:auto}
.st{display:inline-block;font-size:11px;border-radius:6px;padding:2px 8px;background:var(--brand-glow);color:var(--brand)}
.st.green{background:rgba(63,185,80,.14);color:var(--green)} .st.orange{background:rgba(210,153,34,.14);color:var(--gold)} .st.red{background:rgba(248,81,73,.14);color:var(--red)} .st.blue{background:rgba(88,166,255,.14);color:var(--blue)}

/* ===== 客户详情左侧导航 ===== */
.cd-tab{border:none;background:transparent;border-radius:8px;cursor:pointer;color:var(--text2);transition:background .12s;text-align:left;width:100%}
.cd-tab:hover{background:var(--soft)}
.cd-tab.active{background:linear-gradient(135deg,var(--brand-glow),rgba(77,107,254,.05));color:var(--brand);font-weight:700}
.cd-grp{display:flex;flex-direction:column}
.cd-grp-arrow{display:inline-flex;align-items:center}
.cd-layout{display:flex;gap:14px;align-items:flex-start;flex-wrap:wrap}
.cd-nav{width:175px;flex-shrink:0;max-height:calc(100vh - 120px);overflow-y:auto;padding-right:2px}
.cd-body{flex:1;min-width:280px;background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:16px 18px;min-height:320px}

/* ===== 设计板块 ===== */
.quota-cats{display:flex;gap:8px;padding:10px 16px;border-bottom:1px solid var(--line);flex-wrap:wrap}
.design-cats{display:flex;gap:8px;padding:10px 16px;border-bottom:1px solid var(--line);flex-wrap:wrap}
.cat-tab{border:1px solid var(--line);background:var(--panel);border-radius:8px;padding:6px 12px;font-size:12.5px;cursor:pointer;color:var(--text2)}
.cat-tab:hover{border-color:var(--brand);color:var(--brand)}
.cat-tab.active{background:var(--brand);border-color:var(--brand);color:#fff}
.design-ai-msgs{height:220px;overflow-y:auto;background:var(--soft);border:1px solid var(--line);border-radius:8px;padding:10px 12px;margin-bottom:8px}
.design-ai-msgs .ai-msg{margin-bottom:8px}
.design-ai-msgs .bubble{max-width:90%}

/* ===== 弹窗 ===== */
.vmask{position:fixed;inset:0;background:rgba(0,0,0,.4);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center;z-index:5000;animation:fadeIn .2s ease}
.vmask.hidden{display:none}
.vbox{background:var(--panel);border:1px solid var(--line2);border-radius:16px;width:min(480px,92vw);max-height:86vh;display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0,0,0,.3);animation:slideUp .25s ease}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes slideUp{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
.vm-head{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--line);font-size:15px;font-weight:600}
.vm-body{padding:18px 20px;overflow:auto}
.vm-body label{display:block;font-size:12px;color:var(--text2);margin:12px 0 5px;font-weight:500}
.vm-body input,.vm-body select,.vm-body textarea{width:100%;background:var(--input-bg);border:1px solid var(--line);border-radius:10px;padding:9px 12px;font-size:13px;outline:none;box-sizing:border-box;color:var(--ink);transition:.2s}
.vm-body input:focus,.vm-body select:focus,.vm-body textarea:focus{border-color:var(--brand);box-shadow:0 0 0 4px var(--brand-glow)}
.vm-body select option{background:var(--panel);color:var(--ink)}

/* ===== 右侧抽屉 ===== */
.drawer-mask{position:fixed;inset:0;background:rgba(0,0,0,.3);backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);display:flex;justify-content:flex-end;z-index:5000;animation:fadeIn .2s ease}
.drawer-mask.hidden{display:none}
.drawer-panel{background:var(--panel);border-left:1px solid var(--line2);width:min(520px,92vw);height:100vh;display:flex;flex-direction:column;box-shadow:-10px 0 40px rgba(0,0,0,.2);animation:slideInRight .25s ease}
@keyframes slideInRight{from{transform:translateX(100%)}to{transform:translateX(0)}}
.drawer-head{display:flex;justify-content:space-between;align-items:center;padding:16px 20px;border-bottom:1px solid var(--line);font-size:15px;font-weight:600;flex-shrink:0}
.drawer-body{padding:16px 20px;overflow:auto;flex:1}
.drawer-body label{display:block;font-size:12px;color:var(--text2);margin:12px 0 5px;font-weight:500}
.drawer-body input,.drawer-body select,.drawer-body textarea{width:100%;background:var(--input-bg);border:1px solid var(--line);border-radius:10px;padding:9px 12px;font-size:13px;outline:none;box-sizing:border-box;color:var(--ink);transition:.2s}
.drawer-body input:focus,.drawer-body select:focus,.drawer-body textarea:focus{border-color:var(--brand);box-shadow:0 0 0 4px var(--brand-glow)}
.drawer-cat-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:14px}
.drawer-cat-tab{padding:8px 16px;border:1px solid var(--line);border-radius:20px;font-size:12.5px;cursor:pointer;transition:.2s;background:var(--input-bg);color:var(--text2)}
.drawer-cat-tab:hover{border-color:var(--brand);color:var(--brand)}
.drawer-cat-tab.active{background:var(--brand);color:#fff;border-color:var(--brand)}
.drawer-item{padding:10px 12px;cursor:pointer;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;gap:8px;align-items:center;border-radius:8px;margin-bottom:2px;transition:.15s}
.drawer-item:hover{background:var(--soft)}
.drawer-item-name{font-size:13px;font-weight:500}
.drawer-item-meta{font-size:10.5px;color:var(--muted);margin-top:2px}
.drawer-item-price{color:#b8860b;font-weight:600;font-size:13px;white-space:nowrap}

/* ===== AI 助手 ===== */
.ai-fab{position:fixed;right:20px;bottom:20px;width:54px;height:54px;border-radius:50%;background:linear-gradient(135deg,#4d6bfe,#3a54d8);color:#fff;font-size:24px;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 8px 24px rgba(77,107,254,.4);z-index:300;transition:.2s}
.ai-fab:hover{transform:scale(1.08)}
.ai-dock{flex-shrink:0;background:var(--panel);display:none;flex-direction:column;z-index:50;min-height:0}
.ai-dock.open{display:flex}
.ai-dock.dock-bottom{height:300px;border-top:1px solid var(--line)}
.ai-dock.dock-right{width:380px;height:100%;border-left:1px solid var(--line)}
.ai-dock-head{display:flex;justify-content:space-between;align-items:center;padding:8px 16px;background:linear-gradient(135deg,#4d6bfe,#3a54d8);color:#fff;border-bottom:1px solid var(--line2);font-size:13px;cursor:ns-resize;flex-shrink:0}
.ai-dock-title{font-size:13.5px;display:flex;align-items:center;gap:4px}
.ai-dock-ops{display:flex;align-items:center;gap:10px}
.ai-dock-ops .btn-sm{padding:3px 10px;font-size:12px;background:rgba(255,255,255,.12);border:none;color:#fff;border-radius:6px;cursor:pointer}
.ai-dock-ops .btn-sm:hover{background:rgba(255,255,255,.22)}
.ai-view{font-size:12px;font-weight:400;opacity:.85;background:rgba(255,255,255,.12);border-radius:6px;padding:2px 8px;margin-left:6px}
.ai-mini{cursor:pointer;font-size:13px;opacity:.85;padding:0 4px}
.ai-msgs{flex:1;overflow-y:auto;padding:12px 16px;background:var(--soft)}
.ai-msg{display:flex;gap:8px;margin-bottom:12px}
.ai-msg .av{width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:14px;flex-shrink:0;background:rgba(88,166,255,.14)}
.ai-msg.user .av{background:rgba(63,185,80,.14)}
.ai-msg .bubble{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:9px 12px;font-size:13px;line-height:1.7;white-space:pre-wrap;max-width:85%}
.ai-msg.user .bubble{background:var(--brand);color:#fff;border-color:transparent;margin-left:auto}
.ai-chips{display:flex;gap:6px;padding:8px 12px;border-top:1px solid var(--line);flex-wrap:wrap;background:var(--panel)}
.chip-sm{font-size:11px;background:var(--soft);border:1px solid var(--line);border-radius:999px;padding:3px 10px;cursor:pointer;color:var(--text2)}
.chip-sm:hover{border-color:var(--brand);color:var(--brand)}
.cn-tag-chip{cursor:pointer;user-select:none;transition:.12s}
.cn-tag-chip.active{background:var(--brand);border-color:var(--brand);color:#fff}
.design-sec-head{display:flex;align-items:center;gap:8px;padding:10px 16px;font-size:13px;font-weight:700;color:var(--text2);cursor:pointer;border-bottom:1px solid var(--line);user-select:none}
.design-sec-head:hover{background:var(--soft)}
.design-sec-head.active{color:var(--brand);background:var(--brand-glow)}
.design-sec-head .design-arrow{margin-left:auto;font-size:10px;color:var(--muted);transition:transform .15s}
.design-sec-body{border-bottom:1px solid var(--line)}
.ai-input{display:flex;gap:8px;padding:10px 12px;border-top:1px solid var(--line);background:var(--panel)}
.ai-input input{flex:1;background:var(--input-bg);border:1px solid var(--line);border-radius:8px;padding:9px 12px;font-size:13px;outline:none;color:var(--ink)}
.ai-input input:focus{border-color:var(--brand)}
.ai-typing{color:var(--muted);font-size:12px;padding:4px 8px}

/* 内联浅色兼容：深色主题下将常见硬编码背景/文字映射为语义色（app.js 内联样式兜底） */
.link{color:var(--brand);cursor:pointer}
.link.danger{color:var(--red)}

@media (max-width:1100px){
  .kpis{grid-template-columns:repeat(2,1fr)}
  .grid2{grid-template-columns:1fr}
  .cal-wrap{grid-template-columns:1fr}
}

/* ===== 报价打印样式（保持浅色纸张输出） ===== */
@media print {
  body * { visibility: hidden !important; }
  #printArea, #printArea * { visibility: visible !important; }
  #printArea { display: block !important; position: absolute; left: 0; top: 0; width: 100%; padding: 14px 18px; background: #fff; color: #000; }
  #printArea .pq-meta { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 11px; border: 1px solid #ccc; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; }
  #printArea .pq-sec { margin-bottom: 12px; page-break-inside: avoid; }
  #printArea .pq-sec-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; border-left: 3px solid #b8860b; padding-left: 6px; }
  #printArea .pq-tbl { width: 100%; border-collapse: collapse; font-size: 11px; }
  #printArea .pq-tbl th, #printArea .pq-tbl td { border: 1px solid #bbb; padding: 4px 6px; text-align: left; }
  #printArea .pq-tbl th { background: #f0f0f0; font-weight: 600; }
  #printArea .pq-num { text-align: right; }
  #printArea .pq-space-total { text-align: right; font-size: 11px; margin-top: 3px; }
  #printArea .pq-sum { border: 1px solid #999; border-radius: 6px; padding: 8px 12px; margin-top: 12px; font-size: 12.5px; width: 340px; margin-left: auto; }
  #printArea .pq-line { display: flex; justify-content: space-between; padding: 2px 0; }
  #printArea .pq-total { border-top: 1px solid #999; font-size: 11px; font-weight: 700; margin-top: 4px; padding-top: 5px; }
  #printArea .pq-note { font-size: 11.5px; margin-top: 10px; border: 1px dashed #ccc; padding: 8px; }
  #printArea .pq-sign { display: flex; justify-content: space-between; margin-top: 28px; font-size: 11px; padding: 0 10px; }
  @page { size: A4; margin: 12mm; }
}

/* ===== 报价编辑器三栏布局 ===== */
.qe-layout{display:flex;flex:1;min-height:0}
.qe-left{width:200px;min-width:200px;border-right:1px solid var(--line);background:var(--soft);display:flex;flex-direction:column;overflow:hidden}
.qe-left-title{padding:10px 12px 6px;font-size:12.5px;font-weight:700;color:var(--text2)}
.qe-left-list{flex:1;overflow-y:auto;padding:0 8px 8px}
.qe-left-btns{padding:8px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:6px}
.qe-space-item{padding:8px 10px;border-radius:8px;cursor:pointer;margin-bottom:5px;border:1px solid transparent;background:var(--panel)}
.qe-space-item:hover{background:var(--soft2)}
.qe-space-item.active{background:var(--brand-glow);border-color:var(--brand)}
.qe-space-item.active b{color:var(--brand)}
.qe-mid{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0}
.qe-right{width:280px;min-width:280px;border-left:1px solid var(--line);background:var(--soft);overflow-y:auto;padding:12px 14px}
.qe-tbl{width:100%;border-collapse:collapse}
.qe-tbl th{position:sticky;top:0;background:var(--soft2);font-size:11px;color:var(--text2);padding:7px 5px;text-align:left;border-bottom:1px solid var(--line);white-space:nowrap;z-index:2}
.qe-tbl td{padding:3px 3px;border-bottom:1px solid var(--line);vertical-align:middle}
.qe-tbl input{width:100%;box-sizing:border-box;padding:5px 6px;background:var(--input-bg);border:1px solid var(--line);border-radius:6px;font-size:12.5px;color:var(--ink)}
.qe-tbl input:focus{outline:none;border-color:var(--brand)}
.qe-tbl td.num{text-align:right;font-weight:600;font-size:12.5px;white-space:nowrap}
/* 取消number输入框上下调节按钮 */
.qe-tbl input[type=number]::-webkit-inner-spin-button,
.qe-tbl input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.qe-tbl input[type=number]{-moz-appearance:textfield;appearance:textfield}
/* 单价列可点击编辑样式 */
.qe-price-cell{cursor:pointer;color:#2b6cb0;font-weight:600;text-align:center;background:#f8fafc;border-radius:4px;padding:5px 4px;user-select:none}
.qe-price-cell:hover{background:#e0f2fe;color:#1d4ed8}
.qe-note-cell{max-height:48px;overflow-y:auto;line-height:1.4;word-break:break-all}
/* 拖拽手柄样式 */
.qe-drag-handle{cursor:grab;color:#c0c4cc;font-size:14px;user-select:none;-webkit-user-select:none;touch-action:none}
.qe-drag-handle:hover{color:#2b6cb0}
.qe-drag-handle:active{cursor:grabbing}
#qe-rows tr{transition:background .15s}
#qe-rows tr.drag-over{border-top:2px solid #2b6cb0!important}
.qe-tbl{min-width:900px}
/* 只读价格列样式 */
.qe-readonly{background:var(--soft)!important;color:var(--text2)!important;cursor:default!important}
@media (max-width:1280px){ .qe-right{width:240px;min-width:240px} }
/* （报价编辑器的窄屏堆叠规则统一放在下方 @media (max-width:900px)，此处不再重复定义） */

/* ===== 工作日历 日期+安排模式 ===== */
.cal-vwrap{display:flex;gap:12px;align-items:flex-start}
.cal-vdates{width:150px;min-width:150px;display:flex;flex-direction:column;gap:4px;max-height:320px;overflow-y:auto;padding-right:4px}
.cal-vdate{padding:8px 10px;border:1px solid var(--line);border-radius:8px;cursor:pointer;font-size:12px;background:var(--panel)}
.cal-vdate:hover{border-color:var(--brand)}
.cal-vdate.today{background:rgba(210,153,34,.10);border-color:var(--gold)}
.cal-vdate.sel{border-color:var(--brand);background:var(--brand-glow);font-weight:700}
.cal-vdetail{flex:1;min-width:0;border:1px solid var(--line);border-radius:10px;padding:10px 12px;background:var(--soft)}
.cal-item{cursor:pointer}
.cal-item:hover{color:var(--brand)}
.cal-item .dot{margin-right:4px}
.cal-title{font-size:12.5px;font-weight:700;margin-bottom:6px;display:flex;align-items:center}

/* ===== 移动端适配 ===== */
@media (max-width: 1024px) {
  .sidebar { width: 140px; }
  .body { padding: 14px 16px; }
  .topbar { padding: 0 14px; }
  .topbar-search { max-width: 280px; margin: 0 10px; }
}
@media (max-width: 768px) {
  /* 侧边栏变为底部导航 */
  .app { flex-direction: column; }
  .sidebar {
    width: 100% !important;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .sidebar .brand { display: none; }
  .sidebar .nav {
    display: flex;
    flex-direction: row;
    padding: 6px 8px;
    overflow-x: auto;
    flex: 1;
  }
  .sidebar .nav-item {
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    font-size: 10.5px;
    white-space: nowrap;
    margin-bottom: 0;
    min-width: 56px;
    justify-content: center;
    align-items: center;
  }
  .sidebar .nav-item .ico { font-size: 18px; }
  .sidebar .nav-item .nav-txt { font-size: 10px; }
  .sidebar .nav-item .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 9px; }
  .sidebar .nav-arrow { display: none; }
  .sidebar .sidebar-foot { display: none; }
  .sidebar .sidebar-resizer { display: none; }
  .sidebar .nav-sub { display: none !important; }
  /* 主内容区 */
  .main { min-width: 0; }
  .topbar { height: 44px; padding: 0 10px; }
  .crumb { font-size: 11px; }
  .topbar-search { max-width: none; margin: 0 8px; flex: 1; }
  .topbar-search input { padding: 6px 10px; font-size: 11px; }
  .topbar-right { display: none; }
  .body { padding: 10px 12px; }
  /* 页面标题 */
  .page-title { font-size: 16px !important; margin-bottom: 10px !important; }
  .page-sub { font-size: 11px !important; }
  /* KPI卡片 */
  .kpis { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .kpi { padding: 10px !important; }
  .kpi-num { font-size: 18px !important; }
  .kpi-label { font-size: 10.5px !important; }
  .kpi-tip { font-size: 10px !important; }
  /* 面板 */
  .panel { margin-bottom: 10px !important; }
  .panel-head { padding: 8px 12px !important; font-size: 13px !important; }
  .panel-body { padding: 10px 12px !important; }
  /* 表格横向滚动 */
  .tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { font-size: 11.5px; min-width: 600px; }
  .tbl th, .tbl td { padding: 6px 8px !important; }
  /* 按钮 */
  .btn { padding: 6px 10px; font-size: 11px; }
  .btn-pri { padding: 6px 12px; }
  .btn-sm { padding: 3px 8px; font-size: 11px; }
  /* 输入框 */
  input, select, textarea { font-size: 13px; }
  /* 弹窗 */
  .modal-mask { padding: 10px !important; }
  .modal { width: 100% !important; max-width: 100% !important; max-height: 90vh !important; margin: 0 !important; }
  .modal-head { padding: 10px 14px !important; font-size: 14px !important; }
  .modal-body { padding: 12px 14px !important; max-height: calc(90vh - 100px) !important; }
  /* 客户详情三列变单列 */
  .client-detail-layout { flex-direction: column !important; }
  .client-main { width: 100% !important; min-width: 0 !important; }
  .client-side { width: 100% !important; min-width: 0 !important; margin-top: 10px; }
  /* 报价编辑器：窄屏堆叠规则见下方 @media (max-width:900px)（覆盖 iPad 竖屏/分屏 768~900） */
  /* 统计卡片网格 */
  [style*="grid-template-columns:repeat(auto-fit"] { grid-template-columns: repeat(2, 1fr) !important; }
  /* 隐藏次要元素 */
  .muted.hide-mobile { display: none !important; }
  /* 快捷操作栏 */
  .quick-row { flex-wrap: wrap; gap: 4px; }
  .quick-row .btn { flex: 1; min-width: 100px; font-size: 11px; padding: 8px 10px; }
}
/* 报价编辑器：≤900px（含 iPad 竖屏 768~834 与分屏）改为纵向堆叠。
   原先只在 ≤768 生效 → iPad 竖屏仍是 200px 左栏 + 280px 右栏，中间报价表被挤到 ~300px。 */
@media (max-width:900px){
  .qe-layout { flex-direction: column !important; }
  .qe-left { width: 100% !important; min-width: 0 !important; flex-direction: row !important; align-items: center; flex-wrap: wrap; border-right: none !important; border-bottom: 1px solid var(--line); }
  .qe-left-title { display: none !important; }
  .qe-left-list { display: flex; gap: 4px; overflow-x: auto; padding: 8px; flex: 1; -webkit-overflow-scrolling: touch; }
  .qe-space-item { margin-bottom: 0; white-space: nowrap; }
  .qe-left-btns { flex-direction: row !important; border-top: none !important; border-left: 1px solid var(--line); }
  .qe-left-btns .btn { white-space: nowrap; padding: 6px 10px; font-size: 11px; }
  .qe-right { width: 100% !important; min-width: 0 !important; border-left: none !important; border-top: 1px solid var(--line); }
  .qe-tbl { min-width: 700px; }
  /* 工单 › 工作日历：左侧 150px 固定日期列 → 顶部横向可滑日期条 */
  .cal-vwrap { flex-direction: column !important; gap: 8px !important; }
  .cal-vdates { width: 100% !important; min-width: 0 !important; flex-direction: row !important; max-height: none !important; overflow-x: auto !important; overflow-y: hidden !important; padding: 0 0 4px; -webkit-overflow-scrolling: touch; }
  .cal-vdate { flex: 0 0 auto; white-space: nowrap; min-height: 36px; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:repeat(auto-fit"] { grid-template-columns: 1fr !important; }
  .tbl { min-width: 500px; }
  .topbar-search { display: none; }
}

/* ===== 操作引导遮罩 ===== */
.guide-mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.guide-card { background: var(--panel); border-radius: 16px; padding: 24px; max-width: 480px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.guide-title { font-size: 18px; font-weight: 800; margin-bottom: 12px; color: var(--brand); }
.guide-steps { list-style: none; margin: 12px 0; }
.guide-steps li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; line-height: 1.6; }
.guide-steps li:last-child { border-bottom: none; }
.guide-step-num { width: 24px; height: 24px; background: var(--brand); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.guide-footer { display: flex; gap: 8px; margin-top: 16px; }
.guide-footer .btn { flex: 1; }

/* ===== 快捷键提示 ===== */
.kbd-hint { display: inline-block; padding: 1px 6px; background: var(--soft2); border: 1px solid var(--line); border-radius: 4px; font-size: 10.5px; font-family: monospace; color: var(--text2); }

/* ===== 消息提醒铃铛 ===== */
.topbar-bell { position: relative; cursor: pointer; padding: 6px 10px; border-radius: 8px; transition: background .15s; }
.topbar-bell:hover { background: var(--soft); }
.bell-ico { font-size: 18px; }
.bell-badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; background: #ef4444; color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px; line-height: 1; }
.bell-dropdown { position: absolute; top: 100%; right: 0; width: 380px; max-height: 480px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.15); z-index: 100; overflow: hidden; display: flex; flex-direction: column; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.bell-ops { display: flex; gap: 4px; }
.bell-tabs { display: flex; border-bottom: 1px solid var(--line); }
.bell-tab { flex: 1; padding: 8px; text-align: center; font-size: 11px; cursor: pointer; border: none; background: none; color: var(--text2); transition: all .15s; }
.bell-tab.active { color: var(--brand); font-weight: 700; border-bottom: 2px solid var(--brand); }
.bell-list { flex: 1; overflow-y: auto; }
.bell-empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }
.bell-item { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s; position: relative; }
.bell-item:hover { background: var(--soft); }
.bell-item.unread { background: rgba(59, 130, 246, .05); }
.bell-item.unread::before { content: ''; position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 6px; height: 6px; background: #3b82f6; border-radius: 50%; }
.bell-item-title { font-size: 12.5px; font-weight: 600; margin-bottom: 3px; display: flex; justify-content: space-between; align-items: center; }
.bell-item-priority { font-size: 10px; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.bell-item-priority.high { background: #fee2e2; color: #dc2626; }
.bell-item-priority.medium { background: #fef3c7; color: #d97706; }
.bell-item-priority.low { background: #dcfce7; color: #16a34a; }
.bell-item-content { font-size: 11.5px; color: var(--text2); line-height: 1.5; margin-bottom: 4px; }
.bell-item-meta { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: var(--muted); }
.bell-item-actions { display: flex; gap: 4px; }
.bell-item-actions button { font-size: 10.5px; padding: 2px 8px; }
/* 新提醒弹窗 */
.nf-popup { position: fixed; top: 70px; right: 20px; width: 340px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid #3b82f6; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.2); z-index: 300; padding: 14px; animation: nfSlideIn .3s ease; }
@keyframes nfSlideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.nf-popup-title { font-size: 13px; font-weight: 700; margin-bottom: 6px; display: flex; justify-content: space-between; }
.nf-popup-content { font-size: 11px; color: var(--text2); line-height: 1.5; margin-bottom: 10px; }
.nf-popup-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ===== 顶栏一体化导航（去掉左侧栏 · 导航/搜索/铃铛/账号在一行） ===== */
.app { height: 100vh; display: flex; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.topbar { height: 52px; gap: 10px; padding: 0 12px; justify-content: flex-start; flex-wrap: nowrap; }
.brand-mini { display: flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 800; white-space: nowrap; color: var(--ink); flex: none; }
.brand-ver-mini { font-size: 10px; font-weight: 400; color: var(--muted); }
.top-nav { display: flex; align-items: center; gap: 2px; overflow-x: auto; flex: none; max-width: 50%; scrollbar-width: none; }
.top-nav::-webkit-scrollbar { display: none; }
.top-nav .nav-item { width: auto; flex: none; display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 7px 11px; border: none; background: transparent; border-radius: 8px; color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.top-nav .nav-item .ico { font-size: 11px; line-height: 1; }
.top-nav .nav-item .nav-arrow { display: none; }
.top-nav .nav-item:hover { background: var(--soft); }
.top-nav .nav-item.active { background: var(--brand-glow); color: var(--brand); font-weight: 800; box-shadow: none; }
.top-nav .nav-badge { position: relative; margin-left: 2px; min-width: 15px; height: 16px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.topbar-search { flex: 1; min-width: 80px; max-width: 430px; margin: 0 4px; }
.topbar-bell { flex: none; }
.topbar-user { flex: none; margin-left: 2px; }
.topbar .btn-ghost { border: 1px solid var(--line); }

/* ===== AI 布局三屏适配（大屏右侧常驻 · 中屏悬浮球+底部 · 手机全屏） ===== */
.ai-dock.dock-phone { position: fixed !important; inset: 0; width: 100% !important; height: 100% !important; z-index: 280; border-left: none; border-radius: 0; }
@media (max-width: 767px) {
  .ai-fab { right: 14px; bottom: 14px; width: 50px; height: 50px; font-size: 22px; }
  .ai-dock-head .ai-dock-title .muted { display: none; }
}
@media (min-width: 768px) and (max-width: 1099px) {
  .ai-dock.sheet { height: 68vh; }
}
/* 中屏打开为底部浮层（fixed 覆盖 · 不挤压工作台） */
.ai-dock.sheet { position: fixed; left: 0; right: 0; bottom: 0; height: 68vh; max-height: 700px; z-index: 270; border-radius: 16px 16px 0 0; box-shadow: 0 -10px 34px rgba(0,0,0,.22); }

/* ===== 时间轴动画 ===== */
@keyframes tlFadeIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
.tl-item:hover { transform: translateX(4px); }

/* ===== 错峰动画 ===== */
@keyframes staggerFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.stagger-item { animation: staggerFadeIn 0.35s ease both; }

/* ===== 瀑布流布局 ===== */
.masonry-grid { column-count: 3; column-gap: 12px; }
.masonry-grid .masonry-item { break-inside: avoid; margin-bottom: 12px; }
@media (max-width: 1024px) { .masonry-grid { column-count: 2; } }
@media (max-width: 640px) { .masonry-grid { column-count: 1; } }

/* ===== 徽标样式 ===== */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 10px; font-weight: 700; color: #fff; line-height: 1; }
.badge-red { background: var(--red); }
.badge-green { background: var(--green); }
.badge-gold { background: var(--gold); }
.badge-blue { background: var(--brand); }
.badge-gray { background: var(--muted); }

/* ===== 多选下拉样式 ===== */
.multi-select { position: relative; }
.multi-select-tags { display: flex; flex-wrap: wrap; gap: 4px; min-height: 32px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); cursor: pointer; }
.multi-select-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; background: var(--brand-glow); color: var(--brand); border-radius: 6px; font-size: 11px; font-weight: 600; }
.multi-select-tag .remove { cursor: pointer; opacity: 0.7; }
.multi-select-tag .remove:hover { opacity: 1; }
.multi-select-dropdown { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); max-height: 240px; overflow-y: auto; z-index: 100; display: none; }
.multi-select-dropdown.show { display: block; animation: tlFadeIn 0.2s ease; }
.multi-select-option { padding: 8px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.multi-select-option:hover { background: var(--soft); }
.multi-select-option.selected { background: var(--brand-glow); color: var(--brand); }
.multi-select-group-title { padding: 6px 12px; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--soft); }

/* ===== 分组下拉样式 ===== */
.group-select-option { padding-left: 24px; }
.group-select-group { font-weight: 700; color: var(--text2); pointer-events: none; }

/* ===== 悬停微交互优化 ===== */
.btn { transition: all 0.15s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.btn:active { transform: translateY(0); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.card, .panel { transition: all 0.2s ease; }
.card:hover, .panel:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); transform: translateY(-1px); }

.nav-item { transition: all 0.15s ease; }
.nav-item:hover { background: var(--soft); transform: scale(1.02); }

.tbl tbody tr { transition: background 0.15s ease; }
.tbl tbody tr:hover { background: var(--brand-glow); }

.link { transition: all 0.15s ease; }
.link:hover { text-decoration: underline; opacity: 0.8; }

.st { transition: all 0.15s ease; }
.st:hover { transform: scale(1.05); }

/* ===== 多级侧边栏优化 ===== */
.cd-menu-group { transition: all 0.2s ease; }
.cd-menu-group .cd-submenu { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.cd-menu-group.open .cd-submenu { max-height: 500px; }
.cd-menu-item { transition: all 0.15s ease; position: relative; }
.cd-menu-item:hover { background: var(--soft); padding-left: 16px; }
.cd-menu-item.active { background: var(--brand-glow); color: var(--brand); font-weight: 700; }
.cd-menu-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 60%; background: var(--brand); border-radius: 0 2px 2px 0; }

/* ===== 列表项错峰动画 ===== */
.list-item { animation: staggerFadeIn 0.3s ease both; }
.list-item:nth-child(1) { animation-delay: 0.02s; }
.list-item:nth-child(2) { animation-delay: 0.04s; }
.list-item:nth-child(3) { animation-delay: 0.06s; }
.list-item:nth-child(4) { animation-delay: 0.08s; }
.list-item:nth-child(5) { animation-delay: 0.10s; }
.list-item:nth-child(6) { animation-delay: 0.12s; }
.list-item:nth-child(7) { animation-delay: 0.14s; }
.list-item:nth-child(8) { animation-delay: 0.16s; }
.list-item:nth-child(9) { animation-delay: 0.18s; }
.list-item:nth-child(10) { animation-delay: 0.20s; }

/* ===== 权限开关样式（明确的开启/关闭状态） ===== */
.perm-switch {
  -webkit-appearance: none;
  appearance: none;
  width: 44px !important;
  height: 24px !important;
  background: #e5e5ea !important;
  border-radius: 12px !important;
  border: none !important;
  position: relative;
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
  margin: 0 !important;
  padding: 0 !important;
}
.perm-switch::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.perm-switch:checked {
  background: #0071e3 !important;
}
.perm-switch:checked::before {
  left: 22px;
}
.perm-switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.perm-switch:disabled:checked {
  background: #34c759 !important;
}
/* 权限项标签样式 */
.perm-item {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  transition: background 0.15s ease !important;
}
.perm-item:hover {
  background: rgba(0,113,227,0.05) !important;
}
.perm-item-text {
  flex: 1;
  font-size: 12.5px;
  color: var(--text);
}
.perm-status {
  font-size: 11px;
  font-weight: 600;
  min-width: 36px;
  text-align: right;
}
.perm-status.on { color: #0071e3; }
.perm-status.off { color: #8e8e93; }
.perm-status.locked { color: #34c759; }
/* 权限树父级checkbox样式 */
.tree-children input[type=checkbox].perm-switch {
  width: 44px !important;
  height: 24px !important;
}
/* 树形结构的半选状态 */
.tree-children .perm-item {
  padding: 6px 8px !important;
}
.tree-children .perm-item-text {
  font-size: 12.5px;
}
/* 定额库二级类目树样式 */
.quota-sub-item:hover {
  background: rgba(0,113,227,0.08);
  color: #0071e3 !important;
}
.quota-sub-item.active {
  background: rgba(0,113,227,0.12);
  color: #0071e3 !important;
  font-weight: 600;
  border-right: 3px solid #0071e3;
}

/* 排期工作包样式 */
.wp-tab {
  padding: 8px 14px;
  font-size: 12.5px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  transition: all 0.2s;
}
.wp-tab:hover { color: var(--text); }
.wp-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}
.wp-tab-pane { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

:root {
  --blue: #0071e3;
  --blue-bg: rgba(0,113,227,0.08);
  --green: #34c759;
  --green-bg: rgba(52,199,89,0.1);
  --gold: #ff9500;
  --danger: #ff3b30;
  --soft: #f5f5f7;
  --soft2: #fafafa;
  --panel: #ffffff;
  --line: #e5e5ea;
  --muted: #86868b;
  --text: #1d1d1f;
  --text2: #515154;
}

/* ===== 响应式适配 ===== */

/* 平板端（768px - 1024px） */
@media (max-width: 1024px) {
  /* 排期左右分栏调整 */
  .plan-layout {
    grid-template-columns: 220px 1fr !important;
  }
  /* 工作包详情三栏变两栏 */
  .wp-stats-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .wp-stats-grid > div:last-child {
    grid-column: span 2;
  }
  /* 报价汇总侧边栏收窄 */
  .quote-summary-sidebar {
    width: 260px !important;
  }
}

/* 手机端（<768px） */
@media (max-width: 767px) {
  /* 排期左右分栏变上下布局 */
  .plan-layout {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto 1fr !important;
  }
  /* 左侧工序树变横向滚动条 */
  .plan-left {
    max-height: 180px !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
  }
  .plan-left .main-group {
    display: inline-block;
    margin-right: 8px;
  }
  /* 工作包详情三栏变单栏 */
  .wp-stats-grid {
    grid-template-columns: 1fr !important;
  }
  .wp-stats-grid > div:last-child {
    grid-column: auto;
  }
  /* 标签页文字变小 */
  .wp-tab {
    font-size: 11px !important;
    padding: 6px 8px !important;
  }
  /* 报价汇总侧边栏变底部抽屉 */
  .quote-summary-sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 50vh !important;
    z-index: 100 !important;
    border-radius: 16px 16px 0 0 !important;
  }
  /* 表格横向滚动 */
  .tbl-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  /* 项目详情标签横向滚动 */
  .cd-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .cd-tab {
    flex: 0 0 auto;
  }
  /* 关系人卡片双列变单列 */
  .rel-grid {
    grid-template-columns: 1fr !important;
  }
  /* 按钮大小调整 */
  .btn {
    padding: 8px 14px !important;
    font-size: 13px !important;
  }
}

/* 超大屏（>1400px） */
@media (min-width: 1400px) {
  /* 内容区最大宽度限制，居中显示 */
  .main-content {
    max-width: 1400px;
    margin: 0 auto;
  }
}


/* ===== 档案页左侧「分类侧边栏」===== */
.arc-cat{display:flex;justify-content:space-between;align-items:center;gap:6px;padding:5px 8px;border-radius:7px;font-size:12.5px;cursor:pointer;color:var(--text2);margin-bottom:2px;transition:background .12s}
.arc-cat:hover{background:var(--soft2)}
.arc-cat.active{background:var(--brand);color:#fff;font-weight:600}
.arc-cat.active span{color:rgba(255,255,255,.85)}
.arc-cat span{font-size:10.5px;color:var(--muted);flex:0 0 auto}
.arc-cat-head{font-size:10.5px;color:var(--muted);margin:8px 0 3px;padding-left:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* 二级细分（选中一级后展开） */
.arc-cat.sub{font-size:11.5px;padding:3px 8px 3px 20px;color:var(--muted)}
.arc-cat.sub.active{color:#fff}
/* 档案页 / 定额库：外层分栏容器（桌面左右分栏，窄屏由下方 @media 改纵向）
   注意：这类「内联样式抽成语义类」的容器必须同时有桌面基样式，
   否则 >900px 时容器退化为 block，左侧树会独占一行、内容掉到下面。 */
.arc-split{display:flex;gap:14px;align-items:flex-start}
.quota-split{display:flex;gap:0;border-top:1px solid var(--line)}
@media (max-width:900px){
  /* 档案页：174px 固定分类侧栏 → 顶部横向可滑 chip 条（原来只改宽度，父级不换行会挤压列表） */
  .arc-split{flex-direction:column!important;gap:10px!important}
  #archiveCatSide{width:100%!important;flex:0 0 auto!important;display:flex!important;gap:6px;overflow-x:auto!important;flex-wrap:nowrap;padding:8px!important;-webkit-overflow-scrolling:touch}
  #archiveCatSide .arc-cat{flex:0 0 auto;width:auto;white-space:nowrap;min-height:34px}
  #archiveCatSide .arc-cat-head{display:none}
  /* 定额库：160px 固定子类树 → 顶部横向可滑 chip 条 */
  .quota-split{flex-direction:column!important;border-top:1px solid var(--line)}
  #quotaSubTree{width:100%!important;min-width:0!important;border-right:none!important;border-bottom:1px solid var(--line);max-height:none!important;display:flex!important;gap:6px;overflow-x:auto!important;flex-wrap:nowrap;padding:8px!important;-webkit-overflow-scrolling:touch}
  #quotaSubTree .arc-cat{flex:0 0 auto;width:auto;white-space:nowrap;min-height:34px}
  #quotaSubTree .arc-cat-head{display:none}
}
/* ===== 设置中心（分组导航 + 总览卡片）===== */
#settingsNav [data-sgtab]{transition:background .12s,color .12s}
#settingsNav [data-sgtab]:hover{background:var(--soft2)}
.set-group{margin-bottom:14px}
.set-group-head{font-size:12px;font-weight:700;color:var(--text2);margin:0 0 8px;display:flex;align-items:center;gap:8px}
.set-group-head span{font-size:10.5px;font-weight:400;color:var(--muted);background:var(--soft);border:1px solid var(--line);border-radius:10px;padding:1px 8px}
.set-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(232px,1fr));gap:10px}
.set-card{border:1px solid var(--line);border-radius:12px;padding:11px 13px;background:var(--panel);cursor:pointer;transition:border-color .12s,box-shadow .12s,transform .12s;display:flex;flex-direction:column;gap:5px}
.set-card:hover{border-color:var(--brand);box-shadow:0 4px 14px rgba(0,0,0,.06);transform:translateY(-1px)}
.set-card.off{opacity:.5;cursor:not-allowed}
.set-card.off:hover{border-color:var(--line);box-shadow:none;transform:none}
.set-card-top{display:flex;align-items:center;gap:7px;font-size:13px}
.set-ico{font-size:15px;line-height:1}
.set-card-desc{font-size:11.5px;color:var(--muted);line-height:1.5;min-height:32px}
.set-card-stat{font-size:11px;color:var(--text2);background:var(--soft);border-radius:6px;padding:3px 8px;align-self:flex-start}
.set-card-go{font-size:11px;color:var(--brand);margin-top:auto;font-weight:600}
@media (max-width:900px){
  .set-grid{grid-template-columns:1fr}
}

/* ===== 甘特图：冲突格与移动端适配 ===== */
#ganttScroll{scrollbar-width:thin}
#ganttScroll::-webkit-scrollbar{height:9px}
#ganttScroll::-webkit-scrollbar-thumb{background:var(--line);border-radius:6px}
td.gantt-cf{box-shadow:inset 0 0 0 1px #f3b4b4}
td.gantt-cf:hover{background:#fde8e8!important;box-shadow:inset 0 0 0 2px #e57373}
td.gantt-cf::after{content:'';position:absolute;left:50%;top:50%;width:6px;height:6px;margin:-3px 0 0 -3px;border-radius:50%;background:#dc2626;opacity:.55}
th.gantt-today{outline:2px solid #f59e0b;outline-offset:-2px}
@media (max-width:820px){
  /* 手机/iPad 竖屏：日期列更窄、字号更小；人员列保持冻结 */
  #ganttScroll table{min-width:900px}
  #ganttScroll th,#ganttScroll td{font-size:9.5px}
  #ganttScroll th:first-child,#ganttScroll td:first-child{min-width:96px!important;font-size:11.5px!important}
  #ganttScroll td{height:34px!important}
}
/* ===== 项目详情：排期工作台 + 模块菜单 · 手机/iPad 适配 ===== */
.pd-plan-tools{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.pd-plan-wrap{display:grid;grid-template-columns:280px 1fr;gap:12px;height:calc(100vh - 220px);min-height:500px}
.pd-plan-tree{border:1px solid var(--line);border-radius:12px;overflow-y:auto;background:var(--soft);padding:8px}
.pd-plan-detail{border:1px solid var(--line);border-radius:12px;overflow:hidden;display:flex;flex-direction:column;min-width:0}
.pd-plan-hint{display:none}
.pd-wp-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.wp-tabs{display:flex;gap:0;border-bottom:1px solid var(--line);background:var(--soft2);padding:0 8px}
.cd-menu{width:160px;flex-shrink:0;max-height:calc(100vh - 120px);overflow-y:auto;padding-right:2px}
.cd-menu-flat{display:none}
.cd-menu .pd-menu-subs .cd-tab.active{background:var(--blue-bg)}
@media (max-width:820px){
  /* ① 排期：单列（工序树在上、工作包详情在下）；工具条吸顶并可横滑 */
  .pd-plan-tools{position:sticky;top:0;z-index:6;background:var(--panel);padding:8px 0;margin:0 0 8px;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .pd-plan-tools::-webkit-scrollbar{display:none}
  .pd-plan-tools .btn{flex:0 0 auto;min-height:36px}
  .pd-plan-wrap{grid-template-columns:1fr;height:auto;min-height:0}
  .pd-plan-tree{max-height:36vh;padding:6px;-webkit-overflow-scrolling:touch}
  .pd-plan-detail{min-height:360px}
  .pd-plan-hint{display:block;font-size:11.5px;color:var(--muted);background:var(--soft);border:1px dashed var(--line);border-radius:8px;padding:7px 10px;margin-bottom:8px}
  .pd-plan-tree [onclick]{min-height:34px}
  .wp-tabs{overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .wp-tabs::-webkit-scrollbar{display:none}
  .wp-tab{flex:0 0 auto;min-height:38px;padding:9px 14px}
  /* ② 详情页左侧模块菜单：两级菜单隐藏，改用一条可横滑的按钮带（每个模块一键直达） */
  .cd-menu{display:none}
  .cd-menu-flat{display:flex;flex:1 0 100%;gap:6px;overflow-x:auto;flex-wrap:nowrap;padding:2px 0 8px;-webkit-overflow-scrolling:touch;scrollbar-width:thin}
  .cd-menu-flat .cd-tab{flex:0 0 auto;display:block!important;width:auto!important;white-space:nowrap;min-height:36px;padding:8px 12px!important;font-size:13px!important;border:1px solid var(--line);border-radius:8px;background:var(--panel);margin:0!important}
  .cd-menu-flat .cd-tab.active{background:var(--brand);color:#fff;border-color:var(--brand)}
}
@media (max-width:560px){
  /* ③ 全站两列内联栅格在手机竖屏收成单列（内联样式需 !important 覆盖；表单类可点面积翻倍） */
  [style*="grid-template-columns:1fr 1fr"]{grid-template-columns:1fr!important}
  /* 三列 / 固定列数栅格同样收单列（报价编辑器、财务卡片等） */
  [style*="grid-template-columns:1fr 1fr 1fr"]{grid-template-columns:1fr!important}
  [style*="grid-template-columns:repeat(2,1fr)"],[style*="grid-template-columns:repeat(3,1fr)"],[style*="grid-template-columns:repeat(4,1fr)"],[style*="grid-template-columns:repeat(5,1fr)"]{grid-template-columns:1fr!important}
  /* 详情页内容列写死 min-width:280px：极窄屏会撑出横向滚动，改为允许收缩 */
  [style*="flex:1;min-width:280px"]{min-width:0!important}
  .pd-wp-grid{grid-template-columns:1fr!important}
}
@media (max-width:480px){
  /* 登录页：原来固定 360px + 36/40 内边距，在 360px 手机上直接溢出 */
  .login-mask{padding:14px}
  .login-card{width:100%;padding:24px 20px}
  .login-brand{font-size:19px}
  .login-sub{margin:6px 0 16px}
  .login-card input{padding:12px}
  .login-card .btn{min-height:44px}
}
/* ===== 设置项图块化：配置卡片 + 芯片编辑器 + 单选图块 + 知识库分类树 ===== */
.set-tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(290px,1fr));gap:10px;align-items:start}
.set-tile{border:1px solid var(--line);border-radius:12px;padding:12px 14px;background:var(--panel);display:flex;flex-direction:column;gap:8px;min-width:0}
.set-tile.wide{grid-column:1/-1}
.set-tile.soft{background:var(--soft);border-color:transparent;padding:9px 11px;gap:3px}
.set-tile-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px;font-weight:700}
.set-tile-head .sub{font-weight:400;font-size:11.5px;color:var(--muted)}
.set-tile-head .ops{margin-left:auto;display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.set-tile-body{display:flex;flex-direction:column}
.set-tile-tip{font-size:11px;color:var(--muted);line-height:1.65}
.set-tile-actions{margin-top:auto;display:flex;gap:6px;flex-wrap:wrap;padding-top:2px}
.set-tile label{font-size:11.5px;color:var(--muted);display:block;margin-bottom:3px}
.set-tile input,.set-tile select,.set-tile textarea{width:100%;box-sizing:border-box}
.chip-edit{display:flex;flex-wrap:wrap;gap:6px;align-items:center;min-height:34px}
.chip-edit .chip-x{color:var(--muted);cursor:pointer;font-weight:400;font-size:11px;margin-left:2px}
.chip-edit .chip-x:hover{color:#d14343}
.chip-edit .chip-add{border:1px dashed var(--line);border-radius:999px;padding:4px 10px;font-size:12px;background:transparent;width:auto;min-width:112px;flex:1 0 112px}
.chip-edit .chip-add:focus{border-color:var(--brand);outline:none}
.opt-tiles{display:grid;gap:6px}
.opt-tile{border:1px solid var(--line);border-radius:9px;padding:8px 11px;cursor:pointer;font-size:12.5px;display:flex;align-items:center;gap:8px;background:var(--panel);min-height:36px}
.opt-tile:hover{border-color:var(--brand)}
.opt-tile.on{border-color:var(--brand);background:var(--blue-bg);font-weight:600}
.opt-tile .dot-mark{width:14px;height:14px;border-radius:50%;border:1.5px solid var(--line);flex:0 0 auto}
.opt-tile.on .dot-mark{border-color:var(--brand);background:var(--brand);box-shadow:inset 0 0 0 2.5px #fff}
.kb-layout{display:grid;grid-template-columns:186px 1fr;gap:12px;align-items:start}
.kb-tree{border:1px solid var(--line);border-radius:12px;padding:8px;background:var(--panel);max-height:64vh;overflow-y:auto}
.kb-cat{display:flex;align-items:center;gap:6px;width:100%;border:none;background:transparent;border-radius:8px;padding:7px 9px;font-size:12.5px;cursor:pointer;color:var(--text2);text-align:left;font-family:inherit}
.kb-cat:hover{background:var(--soft2)}
.kb-cat.active{background:var(--brand);color:#fff;font-weight:600}
.kb-cat span{margin-left:auto;font-size:10.5px;opacity:.85}
.kb-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(258px,1fr));gap:10px}
.kb-card{border:1px solid var(--line);border-radius:11px;padding:11px 13px;background:var(--panel);cursor:pointer;display:flex;flex-direction:column;gap:5px;transition:border-color .12s,box-shadow .12s}
.kb-card:hover{border-color:var(--brand);box-shadow:0 4px 14px rgba(0,0,0,.06)}
@media (max-width:900px){
  .set-tiles{grid-template-columns:1fr}
  .kb-layout{grid-template-columns:1fr}
  .kb-tree{max-height:none;display:flex;gap:6px;overflow-x:auto;flex-wrap:nowrap;padding:6px;-webkit-overflow-scrolling:touch}
  .kb-tree .kb-cat{flex:0 0 auto;width:auto;white-space:nowrap;min-height:34px;border:1px solid var(--line);border-radius:8px;padding:7px 11px}
  .kb-cards{grid-template-columns:1fr}
}
/* ===== 设置页布局（桌面左右分栏 · ≤820px 顶部可横滑按钮条） ===== */
.set-layout{display:flex;gap:0;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--panel)}
.set-sidebar{width:190px;min-width:190px;border-right:1px solid var(--line);background:var(--soft);display:flex;flex-direction:column}
.set-sidebar-title{padding:12px 14px;font-size:13px;font-weight:700;color:var(--text2);border-bottom:1px solid #f0f0f2}
.set-nav{flex:1;overflow-y:auto;padding:8px}
.set-main{flex:1;min-width:0}
.set-nav-grp{font-size:10.5px;font-weight:700;color:var(--muted);padding:8px 4px 4px;letter-spacing:.5px}

/* 列表卡片版（窄屏替代宽表：首页项目列表等） */
.list-cards{display:none}
.arc-cards{display:none}
.list-cards-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:2px 2px 6px;font-size:12px;color:var(--text2)}
.list-cards-bar label{display:flex;align-items:center;gap:5px}
.list-card{border:1px solid var(--line);border-radius:11px;padding:10px 12px;background:var(--panel);display:flex;flex-direction:column;gap:5px;cursor:pointer}
.list-card:active{background:var(--soft)}
.list-card.off{opacity:.55}
.list-card-top{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.list-card-name{font-size:13.5px}
.list-card-line{font-size:12px;color:var(--text2);line-height:1.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.list-card-rec{max-width:100%}
.list-card-tags{display:flex;gap:4px;flex-wrap:wrap}
.list-card-ops{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-top:2px}
.list-card-sel{display:flex;align-items:center;gap:4px;font-size:11.5px;color:var(--muted);margin-right:auto}

/* ===== 材料商分类管理弹窗：树状图（一级 › 二级）===== */
.vbox-wide{width:min(780px,94vw)}
.sct-legend{font-size:11.5px;color:var(--text2);line-height:1.6;background:var(--soft);border:1px solid var(--line);border-radius:8px;padding:8px 10px;margin-bottom:8px}
.sct-tools{display:flex;align-items:center;gap:6px;margin-bottom:8px;flex-wrap:wrap}
.sct-tools .muted{margin-left:auto;font-size:11px}
.sct-tree{max-height:56vh;overflow-y:auto;padding-right:2px}
.sct-node{border:1px solid var(--line);border-radius:10px;margin-bottom:8px;overflow:hidden;background:var(--panel)}
.sct-row{display:flex;align-items:center;gap:8px;padding:6px 10px}
.sct-l1{background:var(--soft2)}
.sct-arrow{width:18px;text-align:center;cursor:pointer;color:var(--muted);user-select:none;transition:transform .15s;flex:0 0 auto}
.sct-node.collapsed .sct-arrow{transform:rotate(-90deg)}
.sct-l1-input{width:170px;flex:0 0 auto;border:1px solid var(--line);border-radius:6px;padding:4px 8px;font-size:12.5px;font-weight:700;background:var(--bg)}
.sct-count{font-size:11px}
.sct-ops{margin-left:auto;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.sct-kids{border-top:1px solid var(--line);padding:4px 0}
.sct-node.collapsed .sct-kids{display:none}
.sct-l2{padding-left:16px}
.sct-add{padding-left:16px}
.sct-branch{color:#c9ccd1;font-family:ui-monospace,monospace;font-size:12px;flex:0 0 auto}
.sct-l2-input{flex:1;min-width:160px;border:1px solid transparent;border-radius:6px;padding:3px 8px;font-size:12.5px;background:transparent}
.sct-l2-input:hover{border-color:var(--line)}
.sct-l2-input:focus{border-color:var(--brand);background:var(--panel);outline:none}
.sct-l3-badge{font-size:10.5px;color:var(--muted);background:var(--soft);border:1px solid var(--line);border-radius:10px;padding:1px 7px;white-space:nowrap;flex:0 0 auto}
.sct-del{flex:0 0 auto}
.sct-add input{flex:1;min-width:160px;border:1px dashed var(--line);border-radius:6px;padding:3px 8px;font-size:12px;background:transparent}
.sct-add input:focus{border-color:var(--brand);outline:none}
@media (max-width:560px){
  .sct-l1-input{width:100%;flex:1 1 120px}
  .sct-ops{margin-left:0;width:100%}
  .sct-l2-input,.sct-add input{min-width:0}
}

/* 内容卡片墙（报价模板库 / 角色权限 / 知识库同构） */.card-wall{display:grid;grid-template-columns:repeat(auto-fill,minmax(258px,1fr));gap:10px}
.item-card{border:1px solid var(--line);border-radius:11px;padding:11px 13px;background:var(--panel);display:flex;flex-direction:column;gap:6px;transition:border-color .12s,box-shadow .12s;min-width:0}
.item-card:hover{border-color:var(--brand);box-shadow:0 4px 14px rgba(0,0,0,.06)}
.item-card-actions{display:flex;gap:6px;margin-top:auto;padding-top:4px}

/* ===== 移动端 / 触摸基线（手机 + iPad）===== */
/* 触摸设备：去点击蓝框、禁双击缩放延迟；输入字号 16px 便于聚焦阅读 */
@media (hover:none) and (pointer:coarse){
  *{-webkit-tap-highlight-color:transparent}
  a,button,.btn,.link,[onclick],label,.cd-tab,.nav-item,.opt-tile,.kb-cat,.arc-cat,tbody tr{touch-action:manipulation}
  input,select,textarea{font-size:16px}
  .btn{min-height:34px}
  .btn-sm{min-height:30px}
  .link{display:inline-block;min-height:28px;line-height:28px;padding:0 2px}
  td .link + .link,th .link + .link{margin-left:10px}
  .cd-tab,.opt-tile,.kb-cat{min-height:38px}
  .chip-sm{min-height:30px}
  .item-card-actions .btn,.set-card .btn{min-height:32px}
  /* 数据权限里的角色勾选 chip：加大点击面积 */
  .set-card label{min-height:32px;padding:5px 11px!important}
}
/* 表格：一律可横向滚动（未包裹的由 app.js wrapTables 自动补 .tbl-scroll） */
.tbl-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%}
@media (max-width:820px){
  /* 表格不挤压：容器内横滑 */
  .tbl-scroll>table{min-width:640px}
  .tbl-scroll{scrollbar-width:thin}
  /* 内容卡片墙单列 */
  .card-wall{grid-template-columns:1fr}
  /* 首页项目列表 / 项目列表：窄屏用卡片版替代横滑宽表 */
  #clientTableWrap,#projTableWrap{display:none}
  .list-cards{display:grid;gap:8px}
  /* 档案（材料商/施工人员/施工队/员工）：分组内表格 → 卡片 */
  .arc-tbl-wrap{display:none}
  .arc-cards{display:grid;gap:8px;padding:10px}
  /* 设置页：左右分栏 → 顶部按钮条 + 单列内容 */
  .set-layout{flex-direction:column}
  .set-sidebar{width:100%;min-width:0;border-right:none;border-bottom:1px solid var(--line);flex-direction:row;align-items:center}
  .set-sidebar-title{display:none}
  .set-nav{display:flex;gap:6px;overflow-x:auto;flex-wrap:nowrap;padding:8px;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .set-nav::-webkit-scrollbar{display:none}
  .set-nav-grp{display:none}
  .set-nav-btn{width:auto!important;white-space:nowrap;margin-bottom:0!important;min-height:36px;flex:0 0 auto}
  /* 弹窗 → 底部抽屉（拇指可达） */
  .vmask{align-items:flex-end}
  .vbox{width:100%;max-width:100%;border-radius:16px 16px 0 0;max-height:92vh;animation:sheetUp .24s ease}
  .vm-head{padding:14px 16px;font-size:14.5px}
  .vm-body{padding:14px 16px calc(16px + env(safe-area-inset-bottom,0px))}
  .vm-body .btn{min-height:40px}
  /* 抽屉全宽 */
  .drawer{width:100%!important;max-width:100%!important}
  /* 定额库右侧滑出面板：原写死 420px，手机上比屏还宽 */
  #priceLibPanel{width:min(420px,100vw)!important}
  /* 提醒弹窗：原固定 340px + right:20px，320px 小屏溢出 */
  .nf-popup{width:calc(100vw - 24px)!important;right:12px!important;left:12px;max-width:none}
}
@keyframes sheetUp{from{transform:translateY(100%)}to{transform:translateY(0)}}
/* iPad 横屏 / 大平板（≥821px 的触摸设备）：表格与正文略放大，触控更舒适。
   与上面的 coarse 基线是两条正交规则：基线管"手感"（所有触摸设备、所有宽度），
   这里管"大屏触摸的字号与行高"；桌面（pointer:fine）完全不受影响。 */
@media (pointer:coarse) and (min-width:821px){
  .tbl{font-size:13px}
  .tbl th,.tbl td{padding:9px 10px}
  .panel-body{font-size:13.5px}
  .list-card-line,.list-card-name{font-size:13px}
  .set-card-desc,.set-tile-tip{font-size:12px}
  .btn{padding:7px 12px}
}
@media print{
  .top-nav,.sidebar,#sidebar,.ops,#userMenuBtn,.page-title .ops{display:none!important}
  #ganttScroll{overflow:visible!important}
  #ganttScroll table{min-width:0!important;width:100%!important}
  .tbl-scroll{overflow:visible!important}
  .tbl-scroll>table{min-width:0!important;width:100%!important}
}

/* 权限设置卡片样式 */
.perm-card {
  position: relative;
  padding: 8px 6px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #fff;
}
.perm-card:hover {
  border-color: #3b82f6;
}
.perm-card.on {
  border-color: #3b82f6;
  background: #eff6ff;
}
.perm-card .perm-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  transition: all 0.2s;
}
.perm-card.on .perm-check {
  background: #3b82f6;
  border-color: #3b82f6;
}
.perm-card .perm-name {
  font-size: 11px;
  color: #374151;
  text-align: center;
  line-height: 1.3;
}
.perm-card.on .perm-name {
  color: #1d4ed8;
  font-weight: 500;
}


