:root{
  --cell: 18px;
  --gap: 2px;
  --bg: #0f1115;
  --panel: #161a22;
  --panel2:#111521;
  --panel3:#0b0d12;
  --text: #e6e6e6;
  --muted:#a8b0c0;
  --border:#2a3140;
  --border2:#3a455c;
  --ok:#2ecc71;
  --ok2:#27ae60;
  --warn:#f39c12;
  --bad:#e74c3c;
  --avail:#3b82f6;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --sidebarW: 420px;
  --splitW: 10px;
}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}
.app{
  display:grid;
  grid-template-columns: 1fr var(--splitW) var(--sidebarW);
  gap: 12px;
  padding: 12px;
  height: 100vh;
  box-sizing:border-box;
}
.splitter{
  grid-column: 2;
  border-radius:10px;
  background: rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.06);
  cursor: col-resize;
  transition: background 120ms ease, border-color 120ms ease;
  min-height:0;
}
.splitter:hover{
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.10);
}
.splitter:focus{
  outline:2px solid rgba(59,130,246,0.35);
  outline-offset:2px;
}
.mainPanel{ min-width: 360px; }
.sidebar{
  grid-column: 3;
  min-height:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.configCard{ flex: 1 1 auto; }
.configCard .content{
  overflow:auto;
  scrollbar-gutter: stable both-edges;
  overscroll-behavior: contain;
}
.configCard .content::-webkit-scrollbar{ width: 10px; }
.configCard .content::-webkit-scrollbar-track{ background: rgba(255,255,255,0.03); }
.configCard .content::-webkit-scrollbar-thumb{
  background: rgba(168,176,192,0.25);
  border: 2px solid rgba(0,0,0,0);
  background-clip: padding-box;
  border-radius: 999px;
}
.configCard .content:hover::-webkit-scrollbar-thumb{ background: rgba(168,176,192,0.35); }
.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:10px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height:0;
}
.card .hdr{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  background:linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
}
.title{
  font-weight:600;
  font-size:14px;
}
.sub{
  color:var(--muted);
  font-size:12px;
}
.row{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}
button, select, input[type="checkbox"] + label{
  font:inherit;
  font-size:12px;
}
button{
  background:var(--panel2);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:8px;
  padding:7px 10px;
  cursor:pointer;
}
button:hover{ border-color:#3a455c; }
button.primary{ border-color: rgba(59,130,246,0.55); }
button.danger{ border-color: rgba(231,76,60,0.55); }
button:disabled{
  opacity:0.55;
  cursor:not-allowed;
}
input[type="number"]{
  background:var(--panel2);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:8px;
  padding:6px 8px;
  height: 30px;
  box-sizing:border-box;
}
.content{
  padding: 12px;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:10px;
  flex:1;
}
.sections{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.section{
  background:rgba(255,255,255,0.02);
  border:1px solid rgba(255,255,255,0.04);
  border-radius:12px;
  padding:10px;
}
.sectionHdr{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.sectionTitle{
  font-weight:650;
  letter-spacing:0.2px;
  font-size:12px;
}
.sectionSub{
  color:var(--muted);
  font-size:12px;
}
.miniGrid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:10px;
}
.sidebar .miniGrid{
  grid-template-columns: 1fr;
}
.miniCard{
  background:linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.00));
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  min-width:0;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
.miniCard:hover{
  border-color: var(--border2);
  transform: translateY(-1px);
}
.miniHdr{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.miniTitle{ font-size:12px; font-weight:600; }
.miniSub{ color:var(--muted); font-size:12px; margin-top:2px; }
.miniBody{ margin-top:10px; display:flex; flex-direction:column; gap:8px; }
.miniMeta{ color:var(--muted); font-size:12px; }
.calcBox{
  background: var(--panel2);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #e5e7eb;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.calcBox.dim{ opacity: 0.75; }
.controlRow{ display:flex; gap:8px; align-items:center; }
.range{ flex:1; min-width:0; }
.rangeWrap{ position:relative; flex:1; min-width:0; }
.rangeWrap .range{ width:100%; }
.rangeMark{
  position:absolute;
  top:50%;
  transform: translate(-50%, -50%);
  width:3px;
  height:14px;
  border-radius:999px;
  background: rgba(59,130,246,0.95);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.18), 0 0 12px rgba(59,130,246,0.25);
  pointer-events:none;
}
.rangeMark.bad{
  background: rgba(231,76,60,0.95);
  box-shadow: 0 0 0 2px rgba(231,76,60,0.18), 0 0 12px rgba(231,76,60,0.25);
}
.num{ width:92px; }

/* Switch */
.switch{ position:relative; display:inline-flex; align-items:center; }
.switch input{ position:absolute; opacity:0; width:1px; height:1px; }
.switch .slider{
  width:42px;
  height:24px;
  border-radius:999px;
  background:rgba(255,255,255,0.10);
  border:1px solid var(--border);
  position:relative;
  transition: background 140ms ease, border-color 140ms ease;
}
.switch .slider::after{
  content:"";
  position:absolute;
  top:50%;
  left:3px;
  width:18px;
  height:18px;
  background:#e5e7eb;
  border-radius:999px;
  transform: translateY(-50%);
  transition: transform 140ms ease, background 140ms ease;
}
.switch input:checked + .slider{
  background: rgba(59,130,246,0.35);
  border-color: rgba(59,130,246,0.75);
}
.switch input:checked + .slider::after{
  transform: translate(18px, -50%);
  background:#ffffff;
}
.switch:focus-within .slider{
  outline:2px solid rgba(59,130,246,0.25);
  outline-offset:2px;
}

.gridWrap{
  display:flex;
  flex-direction:column;
  gap:8px;
  min-height:0;
  flex:1;
}
.grid{
  background:var(--panel3);
  border:1px solid var(--border);
  border-radius:10px;
  padding: 10px;
  overflow:auto;
  flex:1;
  min-height:0;
}
.gridInner{
  display:grid;
  gap: var(--gap);
  width: max-content;
  user-select:none;
}
.cell{
  width:var(--cell);
  height:var(--cell);
  border-radius:4px;
  background:#222838;
  border:1px solid #1a1f2c;
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:10px;
  color:#cbd5e1;
}
.cell.claimed{
  background:rgba(46,204,113,0.25);
  border-color: rgba(46,204,113,0.65);
}
.cell.available{
  background:rgba(59,130,246,0.18);
  border-color: rgba(59,130,246,0.65);
}
.cell.blocked{
  background:rgba(231,76,60,0.14);
  border-color: rgba(231,76,60,0.55);
  color: rgba(231,76,60,0.95);
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}
.cell:hover{
  outline:2px solid rgba(255,255,255,0.12);
  outline-offset:1px;
}
.legend{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  color:var(--muted);
  font-size:12px;
  align-items:center;
}
.dot{
  width:10px;height:10px;border-radius:3px;display:inline-block;margin-right:6px;border:1px solid var(--border);
}
.dot.ok{ background:rgba(46,204,113,0.25); border-color:rgba(46,204,113,0.65);}
.dot.av{ background:rgba(59,130,246,0.18); border-color:rgba(59,130,246,0.65);}
.dot.bd{ background:rgba(231,76,60,0.14); border-color:rgba(231,76,60,0.55);}

.splitter{ touch-action:none; }

@media (orientation: portrait){
  :root{ --sidebarW: 360px; }
}

@media (max-width: 1000px){
  :root{ --sidebarW: 320px; }
  .mainPanel{ min-width: 280px; }
  .miniGrid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px){
  .miniGrid{ grid-template-columns: 1fr; }
}
