.cart-modal-body {
  max-height: 60vh;
  overflow-y: auto;
  padding: 14px 16px;
}
@media (max-width: 1100px){
  .layout{grid-template-columns:320px 1fr}
  .calc-result-toolbar-main{grid-template-columns:repeat(2,minmax(0,1fr))}
  .calc-result-edit{border-left:none;padding:0}
}
@media (max-width: 820px){
  .layout{display:flex;flex-direction:column;height:auto}
  .sb,.mn{max-height:none}
  .calc-result-toolbar{flex-direction:column;align-items:stretch}
  .calc-result-toolbar-main{grid-template-columns:1fr}
  .calc-toolbar-cart{width:100%}
}

.cart-section {
  margin-bottom: 16px;
}

.cart-section-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.cart-project-placeholder {
  background: #f8f8fc;
  border: 1px dashed #e0e0ea;
  border-radius: 8px;
  color: #aaa;
  font-size: 11px;
  padding: 10px 12px;
}

.cart-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.cart-action-btn {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #f8f8fc;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  color: #1a1a2e;
}

.cart-action-btn:hover:not(:disabled),
.cart-action-btn:focus:not(:disabled) {
  background: #eef2ff;
  outline: none;
  box-shadow: none;
}

.cart-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* カートが空のときはアクションボタンを隠す */
.cart-section--empty .cart-actions-grid {
  display: none;
}

.cart-modal-count {
  font-size: 11px;
  color: #888;
  font-weight: 600;
}

#histPreviewModal {
  z-index: 9500 !important;
}

.cart-item-status {
  font-size: 10px;
  color: #666;
  margin-top: 4px;
}

/* === v1.12.0 統合 cartModal (= 左 preview / 右 作業情報 / 下 actions) === */

.cart-unified-modal{
  position:fixed; inset:0;
  background:rgba(0,0,0,.55);
  z-index:9100;
  display:none;
  align-items:center; justify-content:center;
  padding:20px 16px; box-sizing:border-box;
}
#cartModal.cart-unified-modal[style*="display: block"],
#cartModal.cart-unified-modal[style*="display:block"]{
  display:flex !important;
}
.cart-unified-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,.18);
  overflow:hidden;
}
.cart-unified-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 18px;
  border-bottom:1px solid #e6e8ee;
  flex-shrink:0;
}
.cart-unified-title{
  display:flex; align-items:center; gap:10px;
  font-size:14px; font-weight:800; color:#1a1a2e;
}
.cart-modal-count{
  font-size:11px; color:#4f46e5; background:#eef2ff;
  padding:2px 8px; border-radius:99px; font-weight:700;
}
.cart-unified-close{
  /* v1.12.11: × 文字、 円ボタン、 hover で薄い赤 */
  background:#fff; border:1px solid #e6e8ee;
  cursor:pointer; color:#888;
  width:32px; height:32px; padding:0;
  border-radius:50%;
  font-size:20px; font-weight:600; line-height:1;
  display:inline-flex; align-items:center; justify-content:center;
  font-family:inherit;
  transition:background .12s, color .12s, border-color .12s;
}
.cart-unified-close:hover{
  background:#fef2f2; color:#dc2626; border-color:#fca5a5;
}
.cart-unified-body{
  display:grid;
  grid-template-columns:minmax(0,1.4fr) minmax(320px,1fr);
  flex:1 1 auto; min-height:0; overflow:hidden;
}
.cart-unified-left{
  background:#f5f5f7; padding:16px 18px;
  overflow-y:auto;
  border-right:1px solid #e6e8ee;
}
.cart-unified-right{
  background:#fff; padding:14px 16px;
  overflow-y:auto;
  display:flex; flex-direction:column; gap:10px;
}
.cart-unified-right-head{
  display:flex; align-items:center; justify-content:space-between;
  padding-bottom:8px;
  border-bottom:1px solid #e6e8ee;
}
.cart-unified-right-label{
  font-size:13px; font-weight:800; color:#1a1a2e;
}
.cart-unified-items-section{
  margin-top:6px; padding-top:10px; border-top:1px dashed #d4d4dc;
}
.cart-unified-items-title{
  font-size:11px; font-weight:700; color:#646678;
  letter-spacing:.04em; margin-bottom:6px;
}
.cart-unified-items-list{
  display:flex; flex-direction:column; gap:6px;
}
.cart-unified-item{
  display:flex; align-items:center; gap:8px;
  padding:7px 10px;
  border:1px solid #e6e8ee; border-radius:6px;
  background:#fafbfd;
  font-size:11px;
}
.cart-unified-item-main{ flex:1 1 auto; min-width:0; }
.cart-unified-item-title{
  font-weight:700; color:#1a1a2e;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.cart-unified-item-spec{
  color:#888; font-size:10px;
}
.cart-unified-item-del{
  background:transparent; border:1px solid #d4d4dc;
  border-radius:5px; padding:3px 8px;
  cursor:pointer; color:#999; font-size:11px;
  flex-shrink:0;
}
.cart-unified-item-del:hover{
  background:#fee2e2; color:#b91c1c; border-color:#fca5a5;
}
.cart-unified-empty{
  padding:40px 20px; text-align:center;
  color:#888; font-size:12px; line-height:1.6;
}
.cart-unified-foot{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 18px;
  border-top:1px solid #e6e8ee;
  flex-shrink:0; gap:8px;
}
.cart-unified-foot-left,
.cart-unified-foot-right{
  display:flex; gap:8px;
}
.cart-action-btn{
  border:1px solid #d4d4dc; background:#fff;
  border-radius:7px; padding:8px 14px;
  font-size:12px; font-weight:700; cursor:pointer;
  color:#1a1a2e; font-family:inherit;
}
.cart-action-btn:hover{ background:#f1f5f9; }
.cart-action-btn.cart-action-primary{
  background:#1a1a2e; color:#fff; border-color:#1a1a2e;
}
.cart-action-btn.cart-action-primary:hover{ background:#2a2a3e; }
.cart-action-btn.cart-action-danger{
  color:#b91c1c; border-color:#fca5a5;
}
.cart-action-btn.cart-action-danger:hover{
  background:#fee2e2;
}
.cart-action-btn[disabled],
.cart-action-btn:disabled{
  opacity:.4; cursor:not-allowed; pointer-events:none;
}

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

@media print{
  .cart-unified-modal{ display:none !important; }
}

/* === v1.12.2 タブ式 + 副次折りたたみ === */

.cart-unified-tabs{
  display:flex; gap:4px;
  border-bottom:1px solid #e6e8ee;
  margin-bottom:10px;
  flex-shrink:0;
}
.cart-unified-tab{
  background:transparent; border:none;
  padding:8px 12px;
  font-size:12px; font-weight:700; color:#888;
  cursor:pointer; font-family:inherit;
  border-bottom:2px solid transparent;
  border-radius:0;
  transition:color .12s, border-color .12s;
}
.cart-unified-tab:hover{ color:#1a1a2e; }
.cart-unified-tab.is-active{
  color:#4f46e5;
  border-bottom-color:#4f46e5;
}
.cart-unified-tab span{
  display:inline-block; margin-left:4px;
  font-size:10px; background:#eef2ff; color:#4f46e5;
  padding:1px 6px; border-radius:99px;
}

.cart-unified-tabpane{
  display:none;
  flex-direction:column;
  gap:10px;
  min-height:0;
}
.cart-unified-tabpane.is-active{
  display:flex;
}

.cart-unified-more-wrap{
  position:relative;
}
.cart-unified-more-menu{
  position:absolute;
  bottom:calc(100% + 6px);
  right:0;
  background:#fff;
  border:1px solid #e6e8ee;
  border-radius:8px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
  padding:6px;
  display:flex; flex-direction:column;
  gap:4px;
  min-width:170px;
  z-index:10;
}
.cart-unified-more-menu .cart-action-btn{
  text-align:left;
  width:100%;
}
.cart-unified-more-btn{
  background:#fff;
  color:#666;
  border-color:#d4d4dc;
}

/* === v1.12.11 部材ごと ラベル管理 (= ログイン user) === */
.cart-parts-row{
  border:1px solid #e6e8ee; border-radius:8px;
  padding:9px 11px; margin-bottom:8px; background:#fafbfd;
}
.cart-parts-row-head{
  display:flex; align-items:center; gap:7px; margin-bottom:7px;
}
.cart-parts-dot{
  width:11px; height:11px; border-radius:50%; flex-shrink:0;
}
.cart-parts-len{
  font-size:13px; font-weight:800; color:#1a1a2e;
}
.cart-parts-qty{
  font-size:11px; color:#888; font-weight:600;
}
.cart-parts-fields{
  display:grid; grid-template-columns:1fr 1fr; gap:6px;
}
.cart-parts-input{
  border:1px solid #d4d4dc; border-radius:6px;
  padding:6px 9px; font-size:12px; font-family:inherit;
  color:#1a1a2e; background:#fff; box-sizing:border-box; width:100%;
}
.cart-parts-input:focus{
  outline:none; border-color:#4f46e5; box-shadow:0 0 0 2px rgba(79,70,229,.12);
}
/* v1.12.15 本数分割ラベル UI */
.cart-parts-split-btn{
  margin-top:7px; border:1px dashed #c3c6d4; background:#fff; color:#4f46e5;
  border-radius:6px; padding:5px 9px; font-size:11px; font-weight:700;
  font-family:inherit; cursor:pointer; line-height:1.3;
}
.cart-parts-split-btn:hover{ background:#f4f4ff; border-color:#4f46e5; }
.cart-parts-split-btn--off{ color:#888; }
.cart-parts-split-btn--off:hover{ background:#f7f7f9; border-color:#aaa; color:#555; }
.cart-parts-alloc{
  display:grid; grid-template-columns:64px 1fr 1fr 26px; gap:6px;
  align-items:center; margin-bottom:6px;
}
.cart-parts-alloc-count{ text-align:center; }
.cart-parts-alloc-del{
  width:26px; height:30px; border:1px solid #e6c4c4; background:#fff; color:#dc2626;
  border-radius:6px; font-size:15px; line-height:1; cursor:pointer; padding:0;
}
.cart-parts-alloc-del:hover{ background:#fdecec; }
.cart-parts-rest{ font-size:10px; color:#888; font-weight:600; margin:2px 0 6px; }
.cart-parts-rest--over{ color:#dc2626; }
.cart-parts-split-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.cart-parts-split-actions .cart-parts-split-btn{ margin-top:0; }
