:root {
  --bg: #f1f5f9;
  --card: #fff;
  --line: #e2e8f0;
  --line2: #cbd5e1;
  --txt: #0f172a;
  --txt2: #475569;
  --txt3: #94a3b8;
  --indigo: #6366f1;
  --indigo2: #818cf8;
  --purple: #8b5cf6;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15,23,42,.06);
  --font: "PingFang SC","Microsoft YaHei","Segoe UI",sans-serif;
}
*{box-sizing:border-box;margin:0;padding:0;}
html,body{height:100%;}
body{
  font-family:var(--font); font-size:13.5px; color:var(--txt);
  background:var(--bg); line-height:1.5;
}
.app{min-height:100%; display:flex; flex-direction:column;}

.topbar{
  height:54px; padding:0 22px; background:#fff; border-bottom:1px solid var(--line);
  display:flex; align-items:center; gap:14px; position:sticky; top:0; z-index:20;
}
.brand{display:flex; align-items:center; gap:10px;}
.bm{
  width:34px; height:34px; border-radius:9px;
  background:linear-gradient(135deg,var(--indigo),var(--indigo2));
  color:#fff; display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:16px;
  box-shadow:0 4px 10px rgba(99,102,241,.28);
}
.bt{font-weight:700; font-size:14.5px;}
.bs{font-size:11.5px; color:var(--txt3);}
.spacer{flex:1;}
.chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px; border-radius:999px; font-size:12px; font-weight:500;
  background:#ecfdf5; color:#047857; border:1px solid #a7f3d0;
}
.chip.warn{background:#fff1f2; color:#b91c1c; border-color:#fecdd3;}
.chip .d{width:6px; height:6px; border-radius:50%; background:currentColor;}
.chip.expiry-chip{
  background:#eef2ff; color:#4338ca; border-color:#c7d2fe;
  font-variant-numeric:tabular-nums; white-space:nowrap;
}
.chip.expiry-chip.warn,
.chip.expiry-chip.expired{
  background:#fff7ed; color:#c2410c; border-color:#fed7aa;
}
.meta{color:var(--txt2); font-size:12.5px;}
@media (max-width:720px){
  .topbar{padding:8px 12px; height:auto; min-height:54px; flex-wrap:wrap; gap:8px;}
  .chip.expiry-chip{font-size:11px;}
}
.nav-btn{
  text-decoration:none; color:#fff; font-size:12.5px; font-weight:600;
  padding:7px 14px; border-radius:8px;
  background:linear-gradient(135deg,var(--indigo),var(--indigo2));
  box-shadow:0 4px 10px rgba(99,102,241,.22);
}
.nav-btn:hover{filter:brightness(1.05);}

.main-grid{
  flex:1; padding:18px 22px 32px;
  display:grid; grid-template-columns:1.35fr .9fr; gap:16px;
  max-width:1200px; width:100%; margin:0 auto;
}
@media(max-width:960px){.main-grid{grid-template-columns:1fr;}}

.col-left,.col-right{display:flex; flex-direction:column; gap:14px;}

.panel{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); overflow:hidden;
}
.panel-hd{
  padding:12px 16px; border-bottom:1px solid var(--line);
  display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
}
.ph-t{font-size:13.5px; font-weight:650; display:inline-flex; align-items:center; gap:8px;}
.ph-t em{font-style:normal; color:#4338ca; font-weight:700;}
.ph-d{font-size:12px; color:var(--txt3);}
.dot{width:8px; height:8px; border-radius:50%; display:inline-block;}
.dot.w{background:var(--indigo);}
.dot.i{background:#38bdf8;}
.dot.p{background:var(--purple);}
.panel-bd{padding:14px 16px;}

.pool-pick{display:grid; grid-template-columns:1fr 1fr; gap:14px;}
@media(max-width:640px){.pool-pick{grid-template-columns:1fr;}}
.pool-card{
  position:relative; overflow:hidden;
  border:1.5px solid var(--line); border-radius:14px; padding:16px 16px 14px;
  cursor:pointer; background:#fff; transition:transform .18s, box-shadow .18s, border-color .18s;
}
.pool-card .pc-glow{
  position:absolute; inset:-40% -20% auto auto; width:140px; height:140px;
  border-radius:50%; pointer-events:none; opacity:.55;
  background:radial-gradient(circle, rgba(99,102,241,.22), transparent 70%);
}
.pool-card.black .pc-glow{
  background:radial-gradient(circle, rgba(139,92,246,.22), transparent 70%);
}
.pool-card:hover{transform:translateY(-2px); box-shadow:0 10px 28px rgba(15,23,42,.08);}
.pc-top{display:flex; align-items:flex-start; gap:10px; position:relative; z-index:1;}
.pc-title{display:flex; flex-direction:column; gap:2px; min-width:0;}
.radio{
  width:18px; height:18px; margin-top:2px; border:2px solid #cbd5e1; border-radius:50%;
  position:relative; flex-shrink:0; background:#fff;
}
.pool-card.on .radio{border-color:var(--indigo); box-shadow:0 0 0 3px rgba(99,102,241,.15);}
.pool-card.on .radio::after{
  content:""; position:absolute; left:50%; top:50%; width:8px; height:8px;
  border-radius:50%; background:var(--indigo); transform:translate(-50%,-50%);
}
.label{font-size:15px; font-weight:750; letter-spacing:.2px;}
.badge{
  margin-left:auto; font-size:10px; font-weight:800; padding:4px 8px; border-radius:6px;
  letter-spacing:1px; align-self:flex-start;
}
.badge.w{color:#4338ca; background:#eef2ff; border:1px solid #c7d2fe;}
.badge.b{color:#6d28d9; background:#f5f3ff; border:1px solid #ddd6fe;}
.subt{font-size:11.5px; color:var(--txt3); line-height:1.35;}
.stat-row{margin-top:14px; display:grid; grid-template-columns:repeat(4,1fr); gap:8px; position:relative; z-index:1;}
.stat-row .st{
  padding:10px 6px; border-radius:10px; background:#f8fafc; border:1px solid var(--line);
  text-align:center;
}
.stat-row .st-k{display:block; font-size:10.5px; color:var(--txt3); margin-bottom:3px;}
.stat-row b{display:block; font-size:17px; color:var(--txt); font-weight:750; font-variant-numeric:tabular-nums;}
.stat-row .st.onl b{color:var(--green);}
.stat-row .st.busy b{color:var(--amber);}
.pool-card.on{
  background:linear-gradient(165deg,#eef2ff 0%,#fff 48%);
  border-color:#818cf8; box-shadow:0 10px 28px rgba(99,102,241,.16);
}
.pool-card.on .label{color:#3730a3;}
.pool-card.on .stat-row .st{background:rgba(255,255,255,.9); border-color:#c7d2fe;}
.pool-card.black.on{
  background:linear-gradient(165deg,#f5f3ff 0%,#fff 48%);
  border-color:#a78bfa; box-shadow:0 10px 28px rgba(139,92,246,.16);
}
.pool-card.black.on .radio{border-color:var(--purple); box-shadow:0 0 0 3px rgba(139,92,246,.15);}
.pool-card.black.on .radio::after{background:var(--purple);}
.pool-card.black.on .label{color:#5b21b6;}
.pool-card.black.on .stat-row .st{border-color:#ddd6fe;}

.map-label{
  display:block; font-size:12px; color:var(--txt3); margin-bottom:6px; font-weight:600;
}
.map-select{
  width:100%; height:44px; border-radius:10px; border:1.5px solid var(--line);
  background:#fff; color:var(--txt); font-size:14px; font-weight:600;
  font-family:inherit; padding:0 12px; cursor:pointer;
  appearance:auto; outline:none;
}
.map-select:hover{border-color:#a5b4fc;}
.map-select:focus{border-color:#818cf8; box-shadow:0 0 0 3px rgba(99,102,241,.12);}

.btn-create{
  width:100%; height:48px; border:none; border-radius:12px; cursor:pointer;
  color:#fff; font-size:15px; font-weight:700; letter-spacing:2px; font-family:inherit;
  background:linear-gradient(135deg,#334155,#1e293b);
  box-shadow:0 8px 18px rgba(15,23,42,.18);
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
}
.btn-create:hover{filter:brightness(1.08);}
.btn-create:disabled{opacity:.5; cursor:not-allowed;}
.btn-create .ico,
.btn-create [data-icon]{
  width:16px; height:16px; flex-shrink:0;
}
.btn-create .ico svg,
.btn-create [data-icon] svg{
  width:16px; height:16px; display:block;
}

/* SVG 图标尺寸（禁止 emoji；防止未约束时撑满按钮） */
.ico{
  display:inline-flex; align-items:center; justify-content:center;
  flex-shrink:0; line-height:0; color:inherit; vertical-align:middle;
}
.ico svg{width:100%; height:100%; display:block;}
.ico-sm{width:14px; height:14px;}
.ico-md{width:16px; height:16px;}
.ico-lg{width:18px; height:18px;}
.ico-xl{width:20px; height:20px;}
.ph-t .ico{width:14px; height:14px;}
.ph-t [data-icon]{width:14px; height:14px; display:inline-flex; flex-shrink:0;}
.ph-t [data-icon] svg{width:14px; height:14px; display:block;}
.create-meta{
  margin-top:10px; display:flex; justify-content:flex-end; align-items:center;
  gap:6px; font-size:12px; color:var(--txt2);
}
.tag{
  display:inline-flex; padding:2px 9px; height:22px; align-items:center;
  border-radius:5px; border:1px solid #c7d2fe; background:#eef2ff; color:#4338ca;
  font-size:11px; font-weight:500;
}
.hint{
  margin-top:10px; padding:10px 12px; border-radius:8px;
  border:1px dashed var(--line2); color:var(--txt3); font-size:12px; background:#fafbfc;
}

.room-panel .panel-bd{min-height:160px; padding:12px 14px;}
.empty-room{
  text-align:center; color:var(--txt3); padding:36px 12px; font-size:13px; line-height:1.7;
}
.empty-room small{color:#b0b8c4;}

.room-code-bar{
  display:flex; align-items:center; justify-content:center; gap:8px;
  margin-bottom:10px; padding:8px 12px; border-radius:8px;
  background:linear-gradient(135deg,#eef2ff,#e0e7ff);
  border:1px solid #c7d2fe; color:#3730a3; font-size:12.5px; font-weight:600;
}
.room-code-bar b{
  font-family:Consolas,"SF Mono",monospace; font-size:16px; letter-spacing:1px;
}
.room-code-sub{font-size:11px; color:#6366f1; font-weight:500;}
.room-code-bar.pending{
  background:#f8fafc; border-color:var(--line); color:var(--txt3); font-size:12px;
}

/* 紧凑横向行：总控浅红；每人各自房间号 */
.rm-row{
  display:grid;
  grid-template-columns:28px 58px 1fr 100px 48px;
  gap:6px; align-items:center;
  padding:8px 10px; margin-bottom:6px;
  border:1px solid var(--line); border-radius:8px;
  background:#fff;
}
.rm-row.master{
  background:#fff1f2;
  border-color:#fecdd3;
}
.rm-seat{
  font-size:11px; font-weight:700; color:var(--txt3); text-align:center;
}
.rm-role{
  font-size:11px; font-weight:700; text-align:center;
  padding:3px 0; border-radius:5px;
  background:#e2e8f0; color:#475569;
}
.rm-row.master .rm-role{
  background:#fda4af; color:#9f1239;
}
.rm-user{
  font-size:12.5px; font-weight:600; color:var(--txt);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  display:flex; flex-direction:column; gap:1px; min-width:0;
}
.rm-map{
  font-size:10.5px; font-weight:500; color:#6366f1;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.rm-code{
  font-family:Consolas,"SF Mono",monospace;
  font-size:13px; font-weight:700; text-align:center;
  color:#4338ca; letter-spacing:.5px;
}
.rm-code.pending{color:var(--txt3); font-size:11px; font-weight:600;}
.rm-row.master .rm-code{ color:#be123c; }
.rm-st{
  font-size:11px; text-align:right; color:#059669; font-weight:600;
}

.room-event{
  margin:0 14px 10px; padding:8px 12px; border-radius:8px;
  background:#eef2ff; border:1px solid #c7d2fe; color:#3730a3;
  font-size:12px; font-weight:600; line-height:1.45;
}
.room-event.warn{background:#fff7ed; border-color:#fed7aa; color:#c2410c;}
.room-event.ok{background:#ecfdf5; border-color:#a7f3d0; color:#047857;}

.room-actions{
  padding:12px 16px; border-top:1px solid var(--line);
  display:flex; flex-wrap:wrap; gap:12px; align-items:center;
}
.sw-row{display:inline-flex; align-items:center; gap:8px;}
.sw-lab{font-size:12px; color:var(--txt2); user-select:none;}
.switch{
  position:relative; display:inline-block; width:40px; height:22px; flex-shrink:0;
}
.switch input{opacity:0; width:0; height:0;}
.slider{
  position:absolute; cursor:pointer; inset:0;
  background:#cbd5e1; border-radius:999px; transition:.2s;
}
.slider::before{
  content:""; position:absolute; height:16px; width:16px; left:3px; top:3px;
  background:#fff; border-radius:50%; transition:.2s;
  box-shadow:0 1px 3px rgba(15,23,42,.2);
}
.switch input:checked + .slider{
  background:linear-gradient(135deg,#6366f1,#818cf8);
}
.switch input:checked + .slider::before{transform:translateX(18px);}
.btn-stop{
  margin-left:auto; height:32px; padding:0 12px; border-radius:8px; cursor:pointer;
  border:1px solid #fecaca; background:#fff; color:#b91c1c; font-size:12px; font-family:inherit;
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
}
.btn-stop .ico{width:14px; height:14px; flex-shrink:0;}
.btn-stop:hover{background:#fef2f2;}
.room-actions{justify-content:flex-end;}
.btn-log{
  height:32px; padding:0 12px; border-radius:8px; text-decoration:none;
  border:1px solid var(--line); background:#fff; color:var(--txt2); font-size:12px;
  display:inline-flex; align-items:center;
}
.btn-log:hover{background:#f8fafc;}

.toast{
  position:fixed; right:20px; bottom:20px; max-width:420px; z-index:50;
  background:#1e293b; color:#fff; padding:12px 16px; border-radius:10px;
  font-size:13px; box-shadow:0 12px 40px rgba(0,0,0,.25);
}
.toast.err{background:#7f1d1d;}

/* —— 建房进度弹窗 —— */
.crm-mask{
  position:fixed; inset:0; z-index:80;
  background:rgba(15,23,42,.45); backdrop-filter:blur(2px);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
}
.crm-mask[hidden]{display:none !important;}
.crm-box{
  width:min(560px,100%); background:#fff; border-radius:16px;
  border:1px solid var(--line); box-shadow:0 24px 60px rgba(15,23,42,.22);
  overflow:hidden; animation:crmIn .18s ease-out;
}
@keyframes crmIn{
  from{opacity:0; transform:translateY(8px) scale(.98);}
  to{opacity:1; transform:none;}
}
.crm-hd{
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
  padding:16px 18px 12px; border-bottom:1px solid var(--line);
  background:linear-gradient(180deg,#f8fafc,#fff);
}
.crm-title{font-size:16px; font-weight:750; color:var(--txt);}
.crm-sub{margin-top:2px; font-size:12px; color:var(--txt3);}
.crm-x{
  width:32px; height:32px; border:none; border-radius:8px; cursor:pointer;
  background:#f1f5f9; color:#64748b; font-size:20px; line-height:1; font-family:inherit;
}
.crm-x:hover{background:#e2e8f0; color:#0f172a;}
.crm-list{padding:12px 16px; max-height:min(52vh,420px); overflow:auto;}
.crm-row{
  display:grid; grid-template-columns:52px 1fr 52px; gap:8px 10px;
  align-items:center; padding:12px; margin-bottom:8px;
  border:1px solid var(--line); border-radius:12px; background:#fafbfc;
}
.crm-row.master{background:#fff1f2; border-color:#fecdd3;}
.crm-row.ok{border-color:#a7f3d0; background:#ecfdf5;}
.crm-row.fail{border-color:#fecaca; background:#fef2f2;}
.crm-role{
  font-size:11px; font-weight:700; text-align:center; padding:4px 0; border-radius:6px;
  background:#e2e8f0; color:#475569;
}
.crm-row.master .crm-role{background:#fda4af; color:#9f1239;}
.crm-meta{min-width:0;}
.crm-user{
  font-size:13px; font-weight:650; color:var(--txt);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.crm-stage{margin-top:2px; font-size:11.5px; color:var(--txt3);}
.crm-row.ok .crm-stage{color:#047857;}
.crm-row.fail .crm-stage{color:#b91c1c;}
.crm-pct{
  font-size:13px; font-weight:750; text-align:right; color:#4338ca;
  font-variant-numeric:tabular-nums;
}
.crm-row.ok .crm-pct{color:#059669;}
.crm-row.fail .crm-pct{color:#dc2626;}
.crm-prog{
  grid-column:1 / -1; height:8px; border-radius:999px; background:#e2e8f0; overflow:hidden;
}
.crm-prog > i{
  display:block; height:100%; width:0%; border-radius:999px;
  background:linear-gradient(90deg,#6366f1,#818cf8);
  transition:width .25s ease;
}
.crm-row.master .crm-prog > i{background:linear-gradient(90deg,#f43f5e,#fb7185);}
.crm-row.ok .crm-prog > i{background:linear-gradient(90deg,#10b981,#34d399);}
.crm-row.fail .crm-prog > i{background:linear-gradient(90deg,#ef4444,#f87171);}
.crm-rid{
  grid-column:1 / -1; font-size:12px; color:#4338ca;
  font-family:Consolas,"SF Mono",monospace; font-weight:700;
}
.crm-ft{
  padding:12px 16px 16px; border-top:1px solid var(--line);
  display:flex; align-items:center; gap:14px;
}
.crm-overall{flex:1; display:flex; align-items:center; gap:10px;}
.crm-bar{
  flex:1; height:10px; border-radius:999px; background:#e2e8f0; overflow:hidden;
}
.crm-bar > i{
  display:block; height:100%; background:linear-gradient(90deg,#4f46e5,#6366f1);
  transition:width .25s ease;
}
#crmOverallPct{font-size:13px; font-weight:750; color:#4338ca; min-width:40px; text-align:right;}
.crm-done{
  height:36px; padding:0 18px; border:none; border-radius:10px; cursor:pointer;
  background:linear-gradient(135deg,#6366f1,#4f46e5); color:#fff;
  font-size:13px; font-weight:700; font-family:inherit;
  box-shadow:0 6px 14px rgba(99,102,241,.28);
}
.crm-done:disabled{opacity:.45; cursor:not-allowed; box-shadow:none;}
.crm-done:not(:disabled):hover{filter:brightness(1.06);}
