/* TIA Portal–inspired lab shell. Scoped so marketing pages stay as-is. */
body.lab-app {
  background: #d6d6d6;
  color: #1a1a1a;
  overflow: hidden;
  height: 100vh;
}
body.lab-app a { color: #005f73; }

.tia-root {
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tia-title {
  height: 36px;
  background: linear-gradient(180deg, #1a8a96, #0e6e78);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.tia-title .mark {
  width: 18px; height: 18px; background: #fff; border-radius: 3px;
  display: grid; place-items: center; color: #0e6e78; font-size: 11px; font-weight: 800;
}
.tia-title a { color: #e7fffb; font-weight: 600; }
.tia-title .sp { flex: 1; }
.tia-title .run-pill {
  font-size: 11px; background: #0b4f56; padding: 3px 8px; border-radius: 3px;
  font-family: var(--mono);
}
.tia-title .run-pill.go { background: #1f7a32; }
.tia-title .run-pill.stop { background: #8a6a00; }

.tia-menu {
  height: 28px;
  background: #f3f3f3;
  border-bottom: 1px solid #bdbdbd;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  font-size: 12px;
  flex-shrink: 0;
}
.tia-menu button, .tia-menu a.mb {
  border: 1px solid transparent;
  background: transparent;
  color: #222;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
}
.tia-menu button:hover, .tia-menu a.mb:hover { background: #fff; border-color: #c4c4c4; }
.tia-menu button.on { background: #fff; border-color: #8aa; }

.tia-work {
  flex: 1;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 250px;
  min-height: 0;
}

.tia-col {
  background: #f7f7f7;
  border-right: 1px solid #b5b5b5;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tia-col:last-child { border-right: 0; border-left: 1px solid #b5b5b5; }

.tia-col-h {
  background: linear-gradient(180deg, #ececec, #ddd);
  border-bottom: 1px solid #b5b5b5;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #444;
}

.tia-col-b { flex: 1; overflow: auto; padding: 8px; }

.tree-item {
  font-size: 12px; padding: 3px 6px 3px 8px; cursor: default; color: #222;
}
.tree-item.grp { font-weight: 700; color: #333; margin-top: 6px; }
.tree-item.sel { background: #cce8f4; outline: 1px solid #99c; }

.inst {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  border: 1px solid #cfcfcf;
  background: #fff;
  padding: 5px 7px;
  margin-bottom: 5px;
  cursor: pointer;
  text-align: left;
  color: #222;
  border-radius: 2px;
  font-size: 12px;
}
.inst:hover { border-color: #7aa; background: #f3fbfc; }
.inst.sel { outline: 2px solid #0e6e78; background: #e7f6f7; }
.inst .g {
  width: 40px; height: 22px; border: 1px solid #333; background: #fafafa;
  display: grid; place-items: center; font-family: var(--mono); font-size: 11px;
}

.editor-wrap { padding: 10px; overflow: auto; background: #e9e9e9; flex: 1; min-height: 0; }

.network {
  background: #fff;
  border: 1px solid #b0b0b0;
  margin-bottom: 10px;
}
.net-h {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, #f0ead0, #e4d9a8);
  border-bottom: 1px solid #c9bd86;
  padding: 4px 8px;
  font-size: 12px;
}
.net-h b { font-weight: 700; }
.net-h input {
  flex: 1; border: 1px solid transparent; background: transparent;
  padding: 2px 4px; color: #222;
}
.net-h input:focus { background: #fff; border-color: #888; outline: none; }
.net-h .del {
  border: 1px solid #bbb; background: #fafafa; font-size: 11px; padding: 1px 6px; cursor: pointer;
}

.ladder {
  display: flex;
  align-items: stretch;
  min-height: 92px;
  padding: 8px 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 22px, rgba(0,0,0,0.03) 23px);
}
.rail {
  width: 8px;
  background: #222;
  margin: 6px 0;
  flex-shrink: 0;
}
.rail.right { margin-left: auto; }

.cells {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.cell {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.wire {
  width: 22px;
  height: 3px;
  background: #222;
  position: relative;
}
.wire.hot { background: #e6c200; box-shadow: 0 0 6px rgba(230,194,0,0.7); }

.op {
  min-width: 78px;
  text-align: center;
  cursor: pointer;
  padding: 2px 4px;
  position: relative;
}
.op.sel { outline: 2px solid #0078d4; background: rgba(0,120,212,0.06); }
.op .operand {
  color: #003399;
  font-size: 11px;
  font-weight: 700;
  min-height: 14px;
  font-family: var(--mono);
}
.op .glyph {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111;
}
.op .sub {
  font-size: 10px;
  color: #555;
  font-family: var(--mono);
  min-height: 12px;
}

.contact-g {
  width: 36px; height: 22px; position: relative;
}
.contact-g::before, .contact-g::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 3px; background: #111;
}
.contact-g::before { left: 8px; }
.contact-g::after { right: 8px; }
.op.nc .contact-g::after,
.op.nc .slash {
  /* slash drawn separately */
}
.slash {
  position: absolute; left: 50%; top: -2px; width: 2px; height: 26px;
  background: #111; transform: translateX(-50%) rotate(22deg);
}
.op.hot .contact-g::before, .op.hot .contact-g::after, .op.hot .slash { background: #c9a800; }

.coil-g {
  width: 28px; height: 22px; border: 3px solid #111; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}
.op.hot .coil-g { border-color: #c9a800; color: #8a7000; }

.box-g {
  border: 1px solid #333;
  background: #f5f5f5;
  min-width: 108px;
  text-align: left;
  padding: 4px 6px;
  font-size: 11px;
  font-family: var(--mono);
  color: #111;
}
.box-g b { display: block; font-size: 12px; }
.op.hot .box-g { outline: 2px solid #e6c200; }

.par {
  display: flex; flex-direction: column; justify-content: center; gap: 0;
  padding: 0 2px;
}
.par-leg {
  display: flex; align-items: center; min-height: 40px;
}
.par-join {
  width: 8px; align-self: stretch;
  background: linear-gradient(#222, #222) 0 50%/3px 100% no-repeat;
  position: relative;
}
.par-join::before, .par-join::after {
  content: ""; position: absolute; left: 0; width: 8px; height: 3px; background: #222;
}
.par-join::before { top: 18px; }
.par-join::after { bottom: 18px; }
.par.hot .par-join, .par.hot .par-join::before, .par.hot .par-join::after { background: #e6c200; }

.insert {
  width: 28px; height: 28px;
  border: 1px dashed #8aa;
  background: #f7fbfc;
  color: #0e6e78;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  margin: 0 4px;
}
.insert:hover { background: #dff4f6; border-style: solid; }

.add-net {
  width: 100%;
  border: 1px dashed #9aa;
  background: #f3f3f3;
  padding: 8px;
  cursor: pointer;
  color: #333;
  font-size: 12px;
}
.add-net:hover { background: #fff; }

.watch {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  background: #fff;
}
.watch th {
  text-align: left; background: #ececec; border: 1px solid #ccc;
  padding: 4px; font-weight: 700;
}
.watch td { border: 1px solid #ddd; padding: 3px 4px; }
.watch .tn { color: #003399; font-family: var(--mono); font-weight: 700; }
.watch button.mod {
  border: 1px solid #999; background: #eee; padding: 1px 6px; cursor: pointer; font-size: 11px;
}
.watch tr.on td { background: #fff8c8; }

.prop label { display: block; font-size: 11px; color: #444; margin: 8px 0 3px; font-weight: 600; }
.prop input, .prop select {
  width: 100%; border: 1px solid #aaa; padding: 4px 6px; background: #fff; color: #111;
}
.hint-l { font-size: 11px; color: #666; margin-top: 8px; line-height: 1.4; }

.tia-status {
  height: 24px;
  background: #efefef;
  border-top: 1px solid #bbb;
  display: flex; align-items: center; gap: 14px;
  padding: 0 10px;
  font-size: 11px;
  color: #333;
  flex-shrink: 0;
}

.f-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  min-height: 0;
  flex: 1;
  background: #e9e9e9;
}
.f-grid .tia-col { background: #f7f7f7; }
.mod-lite {
  border: 1px solid #ccc;
  background: #fff;
  padding: 10px;
  margin-bottom: 8px;
}
.mod-lite h4 { font-size: 13px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.kv2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.msg { font-size: 12px; padding: 8px; border: 1px solid #ccc; margin-bottom: 8px; }
.msg.bad { background: #fde8e8; border-color: #e0a0a0; color: #7a1010; }
.msg.ok { background: #e8f6e8; border-color: #a3d0a3; color: #145214; }
.msg.warn { background: #fff6d8; border-color: #e0d08a; color: #6a5500; }
.sig-l { font-family: var(--mono); font-size: 11px; background: #f4f4f4; padding: 6px; margin-top: 6px; }

.help-paper {
  max-width: 720px; margin: 16px auto; background: #fff; border: 1px solid #bbb; padding: 20px 24px;
  color: #222; overflow: auto;
}
.help-paper h2 { font-size: 18px; margin-bottom: 8px; }
.help-paper li { margin: 4px 0; }

.dlg-back {
  position: fixed; inset: 0; background: rgba(40,40,40,.35);
  display: grid; place-items: center; z-index: 80;
}
.dlg {
  width: min(420px, 92vw);
  background: #f4f4f4;
  border: 1px solid #777;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.dlg-h { background: #0e6e78; color: #fff; padding: 6px 10px; font-size: 13px; font-weight: 700; }
.dlg-b { padding: 12px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 6px; padding: 8px 12px; background: #ececec; border-top: 1px solid #ccc; }
.dlg-f button { border: 1px solid #888; background: #f7f7f7; padding: 4px 12px; cursor: pointer; }

@media (max-width: 980px) {
  body.lab-app { overflow: auto; height: auto; }
  .tia-work, .f-grid { grid-template-columns: 1fr; }
  .tia-root { height: auto; min-height: 100vh; }
}
