/* 牧歌 CRM（NUGE）深绿主题 · 依据 02-dashboard.png 设计系统 */
:root{
  --g:#16A34A; --g-dark:#15803D; --g-deep:#1D4E3F;
  --amber:#B45309; --amber2:#D97706;
  --ink:#1C2B27; --sub:#5B6E67; --faint:#8AA096;
  --line:#E4EAE6; --line2:#EDF2EF; --bg:#F5F6F4;
  --red:#DC2626; --cyan:#0E7490;
  --nav:#0C1F1A; --nav-t:#8FAF9F; --nav-on:#1B3D31;
}
*{margin:0;padding:0;box-sizing:border-box;font-family:"Microsoft YaHei","PingFang SC",sans-serif}
body{background:var(--bg);color:var(--ink);-webkit-font-smoothing:antialiased}
.px{display:flex;align-items:center}
.px-col{display:flex;flex-direction:column}
body.px{align-items:stretch}
.grow{flex:1}
/* 侧边导航 */
.nav{width:200px;background:var(--nav);flex-shrink:0;flex-direction:column;padding:16px 0 0}
.logo{display:flex;align-items:center;gap:10px;padding:0 18px 16px;border-bottom:1px solid rgba(255,255,255,.06)}
.lg{width:34px;height:34px;border-radius:9px;background:linear-gradient(135deg,#16A34A,#22C55E);color:#fff;font-weight:bold;font-size:17px;display:flex;align-items:center;justify-content:center}
.ln{color:#fff;font-size:15.5px;font-weight:bold;letter-spacing:.5px}
.ls{font-size:9.5px;color:#6E8C7E;margin-top:1px}
.ng{font-size:10.5px;color:#6E8C7E;padding:12px 20px 5px;letter-spacing:1px}
.mi{display:flex;align-items:center;gap:10px;margin:1px 10px;padding:9px 12px;font-size:13.5px;color:var(--nav-t);border-radius:8px}
.mi.on{background:var(--nav-on);color:#fff;font-weight:bold}
.mi .ic{width:16px;text-align:center;font-size:13px}
.bdg{margin-left:auto;background:var(--amber2);color:#fff;font-size:10px;min-width:16px;height:16px;border-radius:8px;display:flex;align-items:center;justify-content:center;padding:0 4px}
.navbot{margin-top:auto;border-top:1px solid rgba(255,255,255,.06);padding:12px 18px;display:flex;align-items:center;gap:10px}
.av{width:30px;height:30px;border-radius:50%;background:linear-gradient(135deg,#16A34A,#22C55E);color:#fff;font-size:12px;display:flex;align-items:center;justify-content:center;font-weight:bold;flex-shrink:0}
/* 顶栏 */
.main{flex:1;min-width:0;flex-direction:column}
.topbar{height:56px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;padding:0 22px;gap:14px}
.tb-t{font-size:16px;font-weight:bold}
.tb-s{font-size:11px;color:var(--faint);margin-top:1px}
.srch{width:220px;height:32px;border:1px solid var(--line);border-radius:8px;display:flex;align-items:center;padding:0 10px;font-size:12px;color:var(--faint);background:#FAFBFA}
.segm{height:32px;border:1px solid var(--line);border-radius:8px;display:flex;align-items:center;padding:0 12px;font-size:12.5px;color:var(--sub);background:#fff;gap:6px}
.btn-g{height:32px;padding:0 14px;background:var(--g);color:#fff;border-radius:8px;display:flex;align-items:center;font-size:12.5px;font-weight:bold;gap:5px}
.btn-o{height:32px;padding:0 12px;border:1px solid var(--line);color:var(--sub);border-radius:8px;display:flex;align-items:center;font-size:12.5px;background:#fff;gap:5px}
/* 内容区 */
.content{flex:1;padding:14px 22px 16px;display:flex;flex-direction:column;gap:10px;overflow:hidden}
.card{background:#fff;border:1px solid var(--line);border-radius:10px}
.card-h{display:flex;align-items:center;justify-content:space-between;padding:11px 16px;border-bottom:1px solid var(--line2)}
.card-t{font-size:14px;font-weight:bold}
.card-sub{font-size:11px;color:var(--faint)}
.tag{display:inline-flex;align-items:center;font-size:11px;padding:2px 8px;border-radius:4px;line-height:1.5;white-space:nowrap}
.tag-g{background:#ECFDF5;color:#15803D}
.tag-a{background:#FFF7ED;color:#9A3412}
.tag-r{background:#FEF2F2;color:#DC2626}
.tag-b{background:#EFF6FF;color:#1D4ED8}
.tag-c{background:#ECFEFF;color:#0E7490}
.tag-gray{background:#F1F5F4;color:var(--sub)}
.dot{width:7px;height:7px;border-radius:50%;display:inline-block}
.kpi{flex:1;background:#fff;border:1px solid var(--line);border-radius:10px;padding:12px 16px}
.kpi .l{font-size:12px;color:var(--sub)}
.kpi .n{font-size:23px;font-weight:bold;letter-spacing:-.3px;margin-top:3px}
.kpi .d{font-size:11px;color:var(--faint);margin-top:3px}
.bar{height:6px;border-radius:3px;background:#E5EAE7;overflow:hidden}
.bar>i{display:block;height:100%;border-radius:3px}
.alert{flex:1;background:#fff;border:1px solid var(--line);border-radius:10px;padding:10px 14px;font-size:12px;line-height:1.6}
.alert .at{display:flex;align-items:center;gap:7px;font-weight:bold;font-size:12.5px;margin-bottom:4px}

/* ===== 由原型各页 style 抽取的公共组件（去 zoom，改自适应宽度） ===== */
body.px{min-height:100vh}
.nav{min-height:100vh}
.main{min-height:100vh}
.mi{overline:none}
.row{display:flex;align-items:center;padding:0 16px;flex:none;min-height:36px;border-bottom:1px solid var(--line2);font-size:12.5px;text-decoration:none;color:inherit}
.row:last-child{border-bottom:none}
.row.hd{min-height:0;padding:7px 16px;background:#F8FAF9;font-size:11px;color:var(--faint);font-weight:normal}
.row.fill{flex:1;min-height:32px}
.row.sel{background:#F0FDF4;box-shadow:inset 3px 0 0 var(--g)}
.row.miss{background:#FFF9F5}
.row.warn{background:#FFF9F5}
.row:hover{background:#FAFCFB}
.row.plain{cursor:default}
.row.plain:hover{background:transparent}
.rolechip{font-size:10.5px;font-weight:bold;padding:2px 8px;border-radius:5px;background:#F1F5F4;color:var(--sub);border:1px solid var(--line);white-space:nowrap}
.mono{font-family:Consolas,monospace;font-size:11px;color:var(--faint)}
.kh{display:inline-block;font-family:Consolas,monospace;font-size:11px;color:var(--faint);background:#F8FAF9;border:1px solid var(--line);border-radius:5px;padding:1px 7px}
.lvl{font-size:10.5px;font-weight:bold;width:20px;height:20px;display:inline-flex;align-items:center;justify-content:center;border-radius:5px;flex-shrink:0}
.lvl.a{background:#ECFDF5;color:#15803D;border:1px solid #A7F3D0}
.lvl.b{background:#F0F9FF;color:#0369A1;border:1px solid #BAE6FD}
.lvl.c{background:#F4F5F6;color:#6B7280;border:1px solid #E1E4E8}
.lvl.d{background:#FFF7ED;color:#C2410C;border:1px solid #FED7AA}
.stg{font-size:11px;padding:2px 8px;border-radius:4px;white-space:nowrap;display:inline-block}
.stg.s1{background:#F4F5F6;color:#6B7280}
.stg.s2{background:#F0FDF4;color:#4D7C0F}
.stg.s3{background:#FEFCE8;color:#A16207}
.stg.s4{background:#FFF7ED;color:#9A3412}
.stg.s5{background:#F0F9FF;color:#0369A1}
.stg.s6{background:#F1F5F4;color:var(--sub)}
.tm{font-size:11px;color:var(--sub);font-variant-numeric:tabular-nums}
.tm.late{color:var(--red);font-weight:bold}
.tl{position:relative;padding:2px 0 2px 26px}
.tl::before{content:"";position:absolute;left:9px;top:10px;bottom:10px;width:2px;background:var(--line2)}
.tn{position:relative;padding:0 0 11px 12px;font-size:12px;line-height:1.55}
.tn:last-child{padding-bottom:2px}
.tn::before{content:"";position:absolute;left:-21px;top:4px;width:8px;height:8px;border-radius:50%;background:#fff;border:2px solid var(--g)}
.tn.warn::before{border-color:var(--red)}
.tn.plan{color:var(--sub)}
.tn .tm{font-size:11px;color:var(--faint);margin-top:1px}
.evib{display:flex;align-items:center;gap:6px}
.evib .b{width:52px;height:5px;border-radius:3px;background:#E5EAE7;overflow:hidden}
.evib .b>i{display:block;height:100%;border-radius:3px}
.todo{padding:9px 14px;border-bottom:1px solid var(--line2)}
.todo:last-child{border-bottom:none}
.task{padding:10px 14px;border-bottom:1px solid var(--line2)}
.task:last-child{border-bottom:none}
.task .t{font-size:12.5px;font-weight:bold;display:flex;align-items:center;justify-content:space-between;gap:8px}
.task .d{font-size:11px;color:var(--faint);margin-top:4px;line-height:1.7}
.el{display:flex;gap:5px;flex-wrap:wrap;margin-top:5px}
.el .e{font-size:10px;padding:1px 6px;border-radius:4px;background:#F1F5F4;color:var(--sub)}
.el .e.ok{background:#ECFDF5;color:#15803D}
.el .e.miss{background:#FEF2F2;color:#DC2626}
.gapbox{padding:12px 14px;border-bottom:1px solid var(--line2)}
.gapbox:last-child{border-bottom:none}
.gapbox .t{font-size:12.5px;font-weight:bold;display:flex;align-items:center;justify-content:space-between;gap:8px}
.gapbox .d{font-size:11px;color:var(--faint);margin-top:5px;line-height:1.7}
.proc{flex:1;padding:0 10px}
.proc .pl{font-size:10.5px;color:var(--faint)}
.proc .pv{font-size:12px;font-weight:bold;margin-top:2px;display:flex;align-items:center;justify-content:space-between}
.week{display:flex;gap:5px;margin-top:8px}
.week .d1{flex:1;text-align:center;font-size:10px;color:var(--faint);padding:3px 0;border-radius:5px;background:#F1F5F4;line-height:1.5}
.week .d1.on{background:#ECFDF5;color:#15803D;font-weight:bold}
.week .d1.hit{background:#16A34A;color:#fff}
.frow{display:flex;gap:12px;padding:0 18px;margin-top:12px}
.fld2{flex:1;min-width:0}
.fld2 label{display:block;font-size:11.5px;color:var(--sub);margin-bottom:5px}
.fld2 label b{color:var(--red);margin-left:2px}
.fld2 input,.fld2 select,.fld2 textarea{width:100%;box-sizing:border-box;height:32px;border:1px solid var(--line);border-radius:7px;padding:0 10px;font-size:12.5px;color:var(--ink);background:#fff;outline:none}
.fld2 textarea{height:58px;padding:8px 10px;resize:vertical;line-height:1.6}
.fld2 input:focus,.fld2 select:focus,.fld2 textarea:focus{border-color:var(--g);box-shadow:0 0 0 2px rgba(22,163,74,.08)}
.fld2 .hint{font-size:10.5px;color:var(--faint);margin-top:4px}
.fld2 .hint.err{color:var(--red)}
.sect{display:flex;align-items:center;gap:8px;padding:14px 18px 0}
.sect .st{font-size:12.5px;font-weight:bold}
.sect .sl{font-size:10.5px;color:var(--faint)}
.opt{font-size:10.5px;color:var(--faint)}
.chiprow{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}
.indchip{font-size:11px;padding:3px 10px;border:1px solid var(--line);border-radius:6px;color:var(--sub);background:#FAFBFA;cursor:pointer}
.indchip.on{background:#ECFDF5;color:#15803D;border-color:#A7F3D0;font-weight:bold}
.uprow{display:flex;gap:12px;padding:0 18px;margin-top:10px}
.upbox{flex:1;height:62px;border:1px dashed var(--line);border-radius:8px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:11px;color:var(--faint);background:#FAFBFA}
.upbox b{font-size:12px;color:var(--sub)}
.btn-line{height:34px;border:1px solid var(--line);color:var(--sub);border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:12.5px;background:#fff;cursor:pointer}
.btn-main{flex:1;height:34px;background:var(--g);color:#fff;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:12.5px;font-weight:bold;border:none;cursor:pointer}
.formbar{display:flex;gap:8px;padding:12px 18px;border-top:1px solid var(--line2)}
.note{font-size:11px;color:var(--faint);line-height:1.7}
.warnline{font-size:11px;color:var(--red);background:#FEF2F2;border:1px solid #FECACA;border-radius:7px;padding:7px 10px;margin:0 18px}
.okline{font-size:11px;color:#15803D;background:#ECFDF5;border:1px solid #A7F3D0;border-radius:7px;padding:7px 10px;margin:0 18px}
.scroll{flex:1;min-height:0;overflow:auto}
/* ============================================================
   手机 / 小屏适配（v1.6 追加，≤900px）
   侧栏横向变顶部标签条；卡片纵向堆叠；表格可横向滑动
   ============================================================ */
@media (max-width: 900px){
  html,body{height:auto !important}
  body.px{display:block !important;align-items:initial !important}

  /* 侧栏 → 左侧抽屉（点 ☰ 滑出，点遮罩/菜单项自动收起） */
  .nav{
    position:fixed !important;left:0;top:0;bottom:0;z-index:90;
    width:276px !important;min-height:0 !important;height:100% !important;
    flex-direction:column !important;flex-wrap:nowrap !important;
    align-items:stretch;overflow-y:auto;overflow-x:hidden;
    padding:0 0 10px;border-bottom:none;
    transform:translateX(-100%);transition:transform .22s ease;
    box-shadow:2px 0 20px rgba(0,0,0,.18);
    -webkit-overflow-scrolling:touch;
  }
  .nav.open{transform:translateX(0)}
  .nav::-webkit-scrollbar{display:none}
  .logo{display:flex !important}
  .ng{display:block !important}
  .navbot{display:flex !important;margin-top:auto;padding:14px 16px;gap:10px;align-items:center}
  .mi{margin:2px 10px;padding:12px 12px;white-space:nowrap;flex:0 0 auto;font-size:14.5px}
  .mi .ic{width:18px;margin-right:4px}

  /* 主区 */
  .main{min-height:0 !important;width:100%}
  .topbar{height:auto !important;min-height:50px;padding:8px 12px !important;gap:8px;flex-wrap:wrap}
  .tb-t{font-size:15px !important}
  .search,.srch{display:none !important}
  .content{padding:10px 10px 18px !important;gap:8px !important;overflow:visible !important}

  /* 卡片与行：允许换行、允许横向滚动看宽表 */
  .card{overflow-x:auto;-webkit-overflow-scrolling:touch}
  body .px{flex-wrap:wrap;align-items:stretch}
  body .px-col{min-width:0}

  /* KPI 两列 */
  .kpi{flex:1 1 46% !important;min-width:46% !important;padding:10px 12px}
  .kpi .n{font-size:19px !important}
  .alert{flex:1 1 100% !important;min-width:100% !important}

  /* 表格：字号收一点，允许横向滑动，不压列 */
  table{font-size:12px !important;min-width:520px}
  th,td{padding-left:8px !important;padding-right:8px !important}

  /* 表单：两列并排 → 单列 */
  .fld2{flex:1 1 100% !important;min-width:100% !important}
  input,select,textarea{font-size:15px !important}   /* 防 iOS 聚焦放大 */

  /* 按钮做大一点，方便手指点 */
  .btn-g,.btn-o,.segm{height:36px !important;font-size:13px !important}
  .btn-g{padding:0 16px !important}
}
/* 极窄屏再收一档 */
@media (max-width: 420px){
  .content{padding:8px 8px 16px !important}
  .topbar{padding:7px 10px !important}
}

/* 第二轮修正：KPI 行换行 + 禁止整页横向滚动 */
@media (max-width: 900px){
  body{overflow-x:hidden !important}
  .kpis,.pg> .px,body .px{flex-wrap:wrap !important}
  .kpi{
    flex:1 1 calc(50% - 6px) !important;
    min-width:0 !important;
    max-width:calc(50% - 6px) !important;
  }
  .sect-t{flex-wrap:wrap;gap:6px}
  .card>div[style*="display:flex"]{flex-wrap:wrap;gap:6px}
}

/* 第三轮修正：取消内部滚动区，整页自然滚动 */
@media (max-width: 900px){
  html,body{height:auto !important;min-height:0 !important}
  .main{height:auto !important;min-height:0 !important}
  .content{
    overflow:visible !important;
    overflow-y:visible !important;
    overflow-x:visible !important;
    max-height:none !important;
    height:auto !important;
    flex:none !important;
  }
  .pg{min-height:0 !important}
  .nav{position:fixed}
}

/* 第四轮修正：手机上卡片不再被 flex 拉伸，消灭大片空白 */
@media (max-width: 900px){
  .content>*,.pg>*{flex:none !important}
  .card{flex:none !important;align-self:stretch}
  .two>.card{flex:none !important}
  .kpi{flex:0 0 calc(50% - 6px) !important}
  .alert{flex:0 0 100% !important}
  .card .card{flex:none !important}
}

/* 第五轮修正：满宽 + 不收缩，卡片不再按内容撑宽 */
@media (max-width: 900px){
  .content>*, .pg>*, .card{
    flex:0 0 auto !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
  }
  .card{overflow-x:auto !important}
  body .px{width:100% !important;max-width:100% !important}
  table{min-width:0 !important}
  th,td{white-space:nowrap}
}

/* 第六轮修正：左右并排的卡片改为竖向堆叠 */
@media (max-width: 900px){
  .two{flex-direction:column !important;width:100% !important;max-width:100% !important}
  .two>.card{width:100% !important;flex:0 0 auto !important}
  .two{display:flex !important}
  .scroll{box-sizing:border-box !important;max-width:100% !important}
  .sect-t{flex-wrap:wrap}
  .row{gap:6px !important}
}

/* 第七轮修正：列表行保持单行，容器内横向滑动，避免挤歪 */
@media (max-width: 900px){
  .row, .sect-t, .dec{flex-wrap:nowrap !important}
  .row{min-width:0}
  .scroll{overflow-x:auto !important;-webkit-overflow-scrolling:touch}
  .f1{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .bar{min-width:60px}
}

/* 第八轮修正：只让「内容区顶层行」换行，内层微排版一律不换行 */
@media (max-width: 900px){
  body .px{flex-wrap:nowrap !important}
  .content>.px, .content>.kpis, .card>.px{flex-wrap:wrap !important}
  .card>div[style*="display:flex"]{flex-wrap:nowrap !important}
}

/* 第九轮修正：行内标签不折行 */
@media (max-width: 900px){
  .px span, .row span, .rank span, .dec span{white-space:nowrap}
  .px .grow{flex:0 0 6px}
}

/* 第十轮修正：含表单字段的行允许换行（否则第二列被裁掉） */
@media (max-width: 900px){
  .px:has(.fld2), .px:has(input), .px:has(select), .px:has(textarea),
  .px:has(.fld1), .card:has(.fld2){flex-wrap:wrap !important}
  .fld2{flex:1 1 100% !important;min-width:100% !important;max-width:100% !important}
  .fld2 input,.fld2 select,.fld2 textarea{font-size:16px !important} /* 防 iOS 聚焦缩放 */
  .card-h{flex-wrap:wrap !important;gap:6px}
}

/* 第十一轮修正：.frow 表单行换行，每个字段占满一行 */
@media (max-width: 900px){
  .frow{flex-wrap:wrap !important}
  .frow>.fld2,.frow>.fld1{flex:1 1 100% !important;min-width:100% !important;max-width:100% !important}
  .sect{flex-wrap:wrap !important;gap:4px}
}

/* 第十二轮修正：多列布局（.px-col）在手机上竖排 */
@media (max-width: 900px){
  .px:has(> .px-col){flex-direction:column !important;align-items:stretch !important;height:auto !important}
  .px-col{width:100% !important;max-width:100% !important;flex:0 0 auto !important;height:auto !important}
  .px-col>*{flex:none !important}
}

/* 第十三轮修正：步骤条改为可横滑，单步固定宽度不再挤压 */
@media (max-width: 900px){
  .step{overflow-x:auto !important;flex-wrap:nowrap !important;-webkit-overflow-scrolling:touch}
  .step>.s{flex:0 0 118px !important;min-width:118px !important}
  .step .bar1{min-width:0}
}

/* ===== v1.7 追加：表格与栅格（Supabase 静态版） ===== */
.tbl{width:100%;border-collapse:collapse;font-size:12.5px}
.tbl th{font-size:11px;color:var(--faint);font-weight:normal;text-align:left;padding:7px 12px;background:#F8FAF9;border-bottom:1px solid var(--line2);white-space:nowrap}
.tbl td{padding:8px 12px;border-bottom:1px solid var(--line2);vertical-align:middle}
.tbl tr:last-child td{border-bottom:none}
.tbl tr.warn td{background:#FFF9F5}
.tbl tr:hover td{background:#FAFCFB}
.num{font-variant-numeric:tabular-nums}
.num.r{text-align:right}
.mut{color:var(--faint)}
.sm{font-size:11px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.grid4{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.card-body{padding:12px 16px}
@media (max-width:1100px){.grid4{grid-template-columns:1fr 1fr}.grid3{grid-template-columns:1fr 1fr}}
@media (max-width:720px){.grid2,.grid3{grid-template-columns:1fr}.grid4{grid-template-columns:1fr 1fr}.tbl{font-size:12px}.tbl th,.tbl td{padding:6px 8px}
  .tblwrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
  .tblwrap>.tbl{margin:0}}

.tblwrap{width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}
.tblwrap>.tbl{min-width:0}

/* 第三轮修正（v1.7 全量版）：窄屏只在表格自己的滚动容器里横向滑动，卡片不再裁切 */
@media (max-width:900px){
  .card{overflow-x:visible !important}
  .tblwrap{overflow-x:auto !important;max-width:100%}
  .tblwrap>.tbl{width:max-content;min-width:100%}
  .kpi{min-width:0 !important}
}

/* ============ v1.9d：手机固定顶栏 + 左侧抽屉菜单 ============ */
.mobile-bar{display:none}
.navmask{display:none}
.navout{color:#fff;background:rgba(255,255,255,.10);border:1px solid rgba(255,255,255,.16);
  border-radius:7px;padding:5px 10px;font-size:11.5px;white-space:nowrap}
.navout:hover{background:rgba(255,255,255,.18)}

@media (max-width:900px){
  .mobile-bar{
    display:flex;align-items:center;gap:10px;
    position:fixed;top:0;left:0;right:0;height:54px;padding:0 12px;
    background:#fff;border-bottom:1px solid var(--line);
    box-shadow:0 1px 6px rgba(16,24,20,.06);z-index:80;
  }
  .mobile-bar b{font-size:15.5px;letter-spacing:.4px}
  .mb-sub{font-size:11px;color:var(--faint)}
  .mb-out{margin-left:auto;font-size:12.5px;color:#B4442F;border:1px solid #F3D6CF;background:#FFF7F4;
    border-radius:8px;padding:6px 12px;white-space:nowrap}
  .mbtn{width:40px;height:40px;border:1px solid var(--line);border-radius:10px;background:#fff;
    font-size:18px;line-height:1;color:#374151;display:flex;align-items:center;justify-content:center}
  .mbtn:active{background:#F3F6F4}
  body{padding-top:54px !important}
  .navmask.show{display:block;position:fixed;inset:0;background:rgba(12,24,18,.44);z-index:85}
  /* 手机端顶栏不再是 .topbar，标题在内容区里单独一行 */
  .topbar{position:static;box-shadow:none;border-bottom:1px solid var(--line2)}
}

/* ============ v1.9d：手机端 KPI 两列网格、表格可横滑不被裁 ============ */
@media (max-width:900px){
  .px:has(>.kpi){display:grid !important;grid-template-columns:1fr 1fr;gap:8px;
    flex-wrap:nowrap !important;width:100% !important;align-items:stretch}
  .px:has(>.kpi)>.kpi{width:auto !important;min-width:0 !important;max-width:none !important;flex:none !important}
  .kpis{display:grid !important;grid-template-columns:1fr 1fr;gap:8px}
  .kpis>.kpi{width:auto !important;min-width:0 !important;max-width:none !important;flex:none !important}
  .kpi .n{font-size:20px !important;line-height:1.25}
  .tblwrap{overflow-x:auto !important;max-width:100%}
  .tblwrap>.tbl{min-width:560px !important}
  .card:has(.tblwrap){overflow:hidden !important}
}

/* v1.9d 终修：手机端 KPI 栅格真正等分，卡片不再被 flex 基准压窄 */
@media (max-width:900px){
  .grid4{grid-template-columns:1fr 1fr !important}
  .grid4>.kpi,.kpis>.kpi{width:100% !important;min-width:0 !important;max-width:none !important;
    flex:none !important;padding:12px 14px !important;box-sizing:border-box}
  .grid3{grid-template-columns:1fr !important}
  .grid2{grid-template-columns:1fr !important}
  .kpi .d{font-size:11px !important}
}
/* ================= v1.10 新增样式 ================= */
/* 红色闪框：字段非法时抖三下 + 红边（配 flashErr() 使用） */
@keyframes nugeShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.flash-err {
  border-color: #DC2626 !important;
  background: #FFF5F5 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .18) !important;
  animation: nugeShake .42s ease-in-out 0s 2;
}
/* 职级标签：0 销售 / 1 经理 / 2 高级经理 / 3 总监 */
.rankchip {
  display: inline-block; font-size: 10.5px; line-height: 1.5; padding: 1px 7px;
  border-radius: 4px; border: 1px solid var(--line); background: #F1F5F4; color: #4A5568;
  font-weight: 600; white-space: nowrap;
}
.rankchip.r1 { background: #ECFDF5; border-color: #A7F3D0; color: #0B5C36; }
.rankchip.r2 { background: #EFF6FF; border-color: #BFDBFE; color: #1D4ED8; }
.rankchip.r3 { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
/* 页签（老板权限与角色） */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabb {
  padding: 7px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; color: var(--sub, #5B6E67); cursor: pointer; font-weight: 600; user-select: none;
}
.tabb.on { background: #16A34A; border-color: #16A34A; color: #fff; }
.pane { display: none; flex-direction: column; gap: 10px; }
.pane.show { display: flex; }
.rsel {
  height: 28px; border: 1px solid var(--line); border-radius: 6px; background: #FAFBFA;
  font-size: 12px; color: var(--ink, #12181A); padding: 0 5px; outline: none; cursor: pointer;
}
.rsel:focus { border-color: #16A34A; background: #fff; }
.gchip {
  font-size: 11.5px; padding: 5px 12px; border-radius: 14px; border: 1px solid var(--line);
  background: #fff; color: var(--sub, #5B6E67);
}
.gchip b { color: var(--ink, #12181A); }
@media (max-width: 900px) {
  .tabb { padding: 6px 11px; font-size: 12px; }
  .rsel { max-width: 132px; }
}
/* v1.10 收尾：侧栏底部身份行单行省略，退出按钮不被挤 */
.navbot>div:nth-child(2){flex:1 1 auto;min-width:0;overflow:hidden}
.navbot>div:nth-child(2)>div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.navbot .btn-ghost,.navbot button{flex:0 0 auto}

/* v1.10 手机端：销售组芯片横向滚动、不拆字；人员表允许横向滑动 */
@media (max-width: 720px) {
  .gwrap { flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 12px !important; }
  .gchip { flex: 0 0 auto; white-space: nowrap; border-radius: 12px; }
  .tbl { min-width: 620px; }
  .pane .card, .pane .box { overflow-x: auto; }
}

/* v1.11：客户列表状态圆点（黄=待审批，红=已建档） + 草稿行 */
.dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:7px;vertical-align:middle;flex:0 0 auto}
.dot.y{background:#F59E0B;box-shadow:0 0 0 2px #FEF3C7}
.dot.r{background:#DC2626;box-shadow:0 0 0 2px #FEE2E2}
.mk{white-space:nowrap}
.draft{display:flex;align-items:center;gap:8px;border:1px solid var(--line);border-left:3px solid #F59E0B;
  background:#FFFDF6;padding:9px 12px;border-radius:2px}
.draft b{font-size:13px}
.draft .btn-o{height:26px;padding:0 10px;font-size:12px;flex:0 0 auto}

/* ===== v1.14 销售端 UI 重做：10 阶段条 / 弹窗 / 折扣计算 / 历史记录 ===== */
.content{overflow-y:auto}
.card{min-height:0}
.scroll{overflow-y:auto;min-height:0}
.stagebar{display:flex;align-items:stretch;gap:0;margin-top:8px;padding:6px 2px 2px}
.stage{flex:1;position:relative;text-align:center;padding:0 2px;cursor:pointer}
.stage .dot{width:24px;height:24px;line-height:22px;border-radius:50%;margin:0 auto;font-size:10.5px;font-weight:bold;border:1.5px solid var(--line);background:#fff;color:var(--faint);position:relative;z-index:2}
.stage .sn{font-size:11px;color:var(--sub);margin-top:4px;font-weight:bold}
.stage .sc{font-size:9.5px;color:var(--faint);margin-top:1px}
.stage.link-done::before{content:"";position:absolute;left:-100%;top:11px;width:100%;height:2px;background:#BBF7D0;z-index:1}
.stage.done .dot{border-color:var(--g);background:#ECFDF5;color:var(--g-dark)}
.stage.cur .dot{background:var(--g);border-color:var(--g);color:#fff;box-shadow:0 0 0 3px #DCFCE7}
.stage.cur .sn{color:var(--g-dark)}
.stage.future .dot{background:#fff;border-style:dashed;color:#B9C7C1}
.stage.post .sn{color:var(--cyan)}
.stage.post.done .dot{border-color:var(--cyan);background:#ECFEFF;color:var(--cyan)}
.stagebar.dead .dot{border-color:#FCA5A5;background:#FEF2F2;color:#DC2626}
/* 弹窗 */
.mask{position:fixed;inset:0;background:rgba(12,31,26,.42);display:none;align-items:center;justify-content:center;z-index:900}
.mask.on{display:flex}
.dlg{width:440px;max-width:92vw;max-height:86vh;overflow:auto;background:#fff;border-radius:14px;box-shadow:0 18px 50px rgba(12,31,26,.28);padding:16px 18px}
.dlg .dt{font-size:15px;font-weight:bold}
.dlg .ds{font-size:11.5px;color:var(--sub);margin-top:3px;line-height:1.6}
.dlg .fl{font-size:11px;color:var(--sub);margin:12px 0 5px}
.dlg input,.dlg select,.dlg textarea{width:100%;border:1px solid var(--line);border-radius:8px;padding:8px 10px;font-size:12.5px;outline:none;background:#fff}
.dlg textarea{min-height:64px;resize:vertical}
.dlg input:focus,.dlg select:focus,.dlg textarea:focus{border-color:var(--g);box-shadow:0 0 0 2px #DCFCE7}
.dlg .calc{margin-top:10px;border:1px solid var(--line2);border-radius:8px;padding:9px 11px;background:#FAFBFA;font-size:11.5px;display:none}
.dlg .calc.on{display:block}
.dlg .calc .row2{display:flex;justify-content:space-between;padding:2px 0}
.dlg .calc .row2.off b{color:#DC2626}
.dlg .btns{display:flex;gap:8px;justify-content:flex-end;margin-top:16px}
.dlg .btns button{height:32px;padding:0 16px;border-radius:8px;border:1px solid var(--line);background:#fff;font-size:12.5px;cursor:pointer}
.dlg .btns button.ok{background:var(--g);border-color:var(--g);color:#fff;font-weight:bold}
/* 项目历史记录 */
.hit{padding:7px 0 7px 10px;border-left:2px solid var(--line2);margin-left:2px;position:relative}
.hit.k-visit{border-left-color:#16A34A}
.hit.k-disc{border-left-color:#D97706}
.hit .h1{display:flex;gap:6px;align-items:center;font-size:10.5px;color:var(--faint)}
.hit .hk{background:#F1F5F3;border-radius:4px;padding:0 5px;color:var(--sub)}
.hit .ht{font-size:11.5px;line-height:1.55;margin-top:2px}
.hit .hm{font-size:9.5px;color:var(--faint);margin-top:1px}
.row.opp.sel{background:#F3FBF6;box-shadow:inset 3px 0 0 var(--g)}
