/* 作業指示書ひな形 編集 modal (= phase 2-A) v1.7.0 */

.job-template-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  z-index:9200;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px 16px;
  box-sizing:border-box;
}

.job-template-modal[style*="display:none"],
.job-template-modal[style*="display: none"]{
  display:none !important;
}

.job-template-inner{
  background:#fff;
  border-radius:12px;
  width:100%;
  max-width:1280px;
  height:calc(100vh - 40px);
  max-height:920px;
  display:flex;
  flex-direction:column;
  box-shadow:0 12px 36px rgba(0,0,0,.2);
  overflow:hidden;
}

.job-template-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  padding:14px 18px;
  border-bottom:1px solid #e6e8ee;
  flex-shrink:0;
  gap:12px;
}

.job-template-title{
  font-size:14px;
  font-weight:800;
  color:#1a1a2e;
  margin-bottom:2px;
}

.job-template-sub{
  font-size:11px;
  color:#666;
  line-height:1.4;
}

.job-template-close{
  background:transparent;
  border:none;
  font-size:22px;
  line-height:1;
  cursor:pointer;
  color:#666;
  padding:4px 8px;
  border-radius:6px;
  flex-shrink:0;
}

.job-template-close:hover{
  background:#f1f5f9;
  color:#1a1a2e;
}

.job-template-body{
  display:grid;
  grid-template-columns:minmax(0,1.4fr) minmax(320px,1fr);
  flex:1 1 auto;
  min-height:0;
  overflow:hidden;
}

.job-template-left{
  background:#f5f5f7;
  padding:16px 18px;
  overflow-y:auto;
  border-right:1px solid #e6e8ee;
}

.job-template-right{
  background:#fff;
  padding:14px 16px;
  overflow-y:auto;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.jt-section{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding-bottom:12px;
  border-bottom:1px solid #eef0f4;
}

.jt-section:last-child{
  border-bottom:none;
}

.jt-section-head{
  font-size:12px;
  font-weight:800;
  color:#1a1a2e;
  letter-spacing:.04em;
}

.jt-section-hint{
  font-size:10px;
  color:#888;
  margin-top:-4px;
}

.jt-field{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.jt-field label{
  font-size:11px;
  font-weight:700;
  color:#646678;
}

.jt-field input,
.jt-field select{
  border:1px solid #d4d4dc;
  border-radius:7px;
  padding:7px 10px;
  font-size:12px;
  font-family:inherit;
  color:#1a1a2e;
  background:#fff;
  box-sizing:border-box;
  width:100%;
  min-height:34px;
}

.jt-field input:focus,
.jt-field select:focus{
  outline:none;
  border-color:#4f46e5;
  box-shadow:0 0 0 2px rgba(79,70,229,.12);
}

.jt-field-list{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.jt-field-row{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border:1px solid #e6e8ee;
  border-radius:7px;
  background:#fafbfd;
}

.jt-field-row[data-on="false"]{
  background:#fff;
  opacity:.6;
}

.jt-field-row-check{
  flex-shrink:0;
  width:16px;
  height:16px;
  margin:0;
  cursor:pointer;
}

.jt-field-row-label{
  flex:1 1 auto;
  font-size:12px;
  color:#1a1a2e;
  font-weight:600;
}

.jt-field-row-label-btn{
  flex:1 1 auto;
  text-align:left;
  background:transparent;
  border:none;
  padding:0;
  font:inherit;
  font-size:12px;
  color:#1a1a2e;
  font-weight:600;
  cursor:pointer;
}

.jt-field-row-label-btn:hover{
  color:#4f46e5;
  text-decoration:underline;
}

/* === canvas (= phase 2-B-1 自由配置) === */

.jt-canvas{
  /* set inline (= width/height from template) */
}

.jt-block{
  user-select:none;
  -webkit-user-select:none;
}

.jt-block:hover{
  background:rgba(79,70,229,0.04) !important;
  outline:1px dashed rgba(79,70,229,0.4);
  outline-offset:-1px;
}

.jt-block.is-selected{
  z-index:10;
}

/* resize handles (= 4 隅、 selected 時のみ表示) */
.jt-resize-handle{
  position:absolute;
  width:10px;
  height:10px;
  background:#fff;
  border:2px solid #4f46e5;
  border-radius:50%;
  z-index:11;
  pointer-events:auto;
}
.jt-rh-nw{ left:-5px; top:-5px; cursor:nwse-resize; }
.jt-rh-ne{ right:-5px; top:-5px; cursor:nesw-resize; }
.jt-rh-sw{ left:-5px; bottom:-5px; cursor:nesw-resize; }
.jt-rh-se{ right:-5px; bottom:-5px; cursor:nwse-resize; }

/* canvas itself should allow scroll if exceeds modal */
.jt-canvas-wrap{
  overflow:auto;
  max-height:100%;
}

.jt-cutting-below{
  /* dimmed cutting area (= sample data) */
  opacity:.85;
}

/* field list 内のクリッカブルラベル */
.jt-field-row[data-on="false"]{
  opacity:.55;
}

/* === 選択中ブロック パレット === */

.jt-selected-head{
  font-size:11px;
  color:#666;
  padding:6px 8px;
  background:#eef2ff;
  border-radius:5px;
  margin-bottom:6px;
}

.jt-coord-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
}

.jt-inline-row{
  display:flex;
  align-items:center;
  gap:8px;
}

.jt-inline-row input[type="number"]{
  width:64px;
  min-height:32px;
}

.jt-inline-unit{
  font-size:11px;
  color:#666;
}

.jt-inline-check{
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-size:11px;
  color:#1a1a2e;
  font-weight:600;
  cursor:pointer;
  margin:0;
}

.jt-inline-check input[type="checkbox"]{
  margin:0;
  cursor:pointer;
}

.jt-selected-deselect{
  margin-top:6px;
  background:#fff;
  border:1px solid #d4d4dc;
  border-radius:6px;
  padding:5px 10px;
  font-size:11px;
  color:#666;
  cursor:pointer;
  font-family:inherit;
}

.jt-selected-deselect:hover{
  background:#f1f5f9;
  color:#1a1a2e;
}

.jt-empty-hint{
  font-size:11px;
  color:#888;
  background:#f7f8fb;
  padding:10px 12px;
  border-radius:6px;
  border:1px dashed #d4d4dc;
  line-height:1.5;
}

/* v1.11.0 simplified: orientation radio + custom slots */
.jt-radio-row{
  display:flex;
  gap:14px;
  align-items:center;
}
.jt-radio{
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-size:11px;
  color:#1a1a2e;
  cursor:pointer;
  margin:0;
}
.jt-radio input{
  margin:0;
}

.jt-custom-list{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-bottom:8px;
}
.jt-custom-row{
  display:flex;
  align-items:flex-start;
  gap:6px;
  padding:8px;
  border:1px solid #e6e8ee;
  border-radius:7px;
  background:#fafbfd;
}
.jt-custom-row-fields{
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.jt-custom-row-fields input{
  width:100%;
  border:1px solid #d4d4dc;
  border-radius:5px;
  padding:6px 8px;
  font-size:11px;
  box-sizing:border-box;
  font-family:inherit;
}
.jt-custom-row-fields input:focus{
  outline:none;
  border-color:#4f46e5;
}
.jt-custom-del{
  background:transparent;
  border:1px solid #d4d4dc;
  border-radius:5px;
  padding:4px 8px;
  cursor:pointer;
  color:#999;
  font-size:14px;
  flex-shrink:0;
}
.jt-custom-del:hover{
  background:#fee2e2;
  color:#b91c1c;
  border-color:#fca5a5;
}
.jt-add-custom{
  background:#eef2ff;
  color:#4f46e5;
  border:1px dashed #c7d2fe;
  border-radius:6px;
  padding:8px 12px;
  font-size:11px;
  font-weight:700;
  cursor:pointer;
  width:100%;
  font-family:inherit;
}
.jt-add-custom:hover{
  background:#4f46e5;
  color:#fff;
}

.jt-field-row-actions{
  display:flex;
  gap:3px;
  flex-shrink:0;
}

.jt-move-btn{
  width:24px;
  height:24px;
  border:1px solid #d4d4dc;
  background:#fff;
  border-radius:5px;
  cursor:pointer;
  font-size:10px;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#666;
  padding:0;
}

.jt-move-btn:hover{
  background:#eef2ff;
  color:#4f46e5;
  border-color:#4f46e5;
}

.jt-move-btn:disabled{
  opacity:.3;
  cursor:not-allowed;
}

.jt-info{
  font-size:11px;
  color:#666;
  line-height:1.55;
  background:#f7f8fb;
  padding:10px 12px;
  border-radius:7px;
  border:1px dashed #d4d4dc;
}

.job-template-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 18px;
  border-top:1px solid #e6e8ee;
  flex-shrink:0;
  gap:8px;
}

.job-template-foot-right{
  display:flex;
  gap:8px;
}

.job-template-reset,
.job-template-cancel,
.job-template-save{
  border:none;
  border-radius:7px;
  padding:8px 16px;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  font-family:inherit;
}

.job-template-reset{
  background:#fff;
  color:#888;
  border:1px solid #d4d4dc;
  font-size:11px;
}

.job-template-reset:hover{
  background:#fee2e2;
  color:#b91c1c;
  border-color:#fca5a5;
}

.job-template-cancel{
  background:#fff;
  color:#1a1a2e;
  border:1px solid #d4d4dc;
}

.job-template-cancel:hover{
  background:#f1f5f9;
}

.job-template-save{
  background:#1a1a2e;
  color:#fff;
}

.job-template-save:hover{
  background:#2a2a3e;
}

@media (max-width:880px){
  .job-template-inner{
    height:calc(100vh - 16px);
    max-height:none;
    border-radius:0;
  }
  .job-template-body{
    grid-template-columns:1fr;
  }
  .job-template-left{
    border-right:none;
    border-bottom:1px solid #e6e8ee;
    max-height:50%;
  }
}

@media print{
  .job-template-modal{
    display:none !important;
  }
}
