/* ============================================================
   calcTabs.css — 計算タブ (master 依頼 2026-09-03)
   #calcTabBar は #rp (結果パネル) の先頭に sticky 配置。
   ============================================================ */
.ctab-bar {
  position: sticky;
  top: -24px;               /* #rp の padding 24px ぶん上に張り付く */
  z-index: 5;
  margin: -24px -24px 0;
  padding: 10px 24px 8px;
  background: #f3f3f7;      /* .mn の背景と同じ (スクロールで下の結果が透けない) */
  border-bottom: 1px solid #e3e3ec;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ctab-bar[hidden] { display: none; }
.ctab-scroll {
  display: flex;
  align-items: stretch;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
}
.ctab {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  min-width: 120px;
  padding: 6px 6px 6px 10px;
  border: 1px solid #d9dde6;
  border-bottom-color: #d9dde6;
  border-radius: 10px 10px 4px 4px;
  background: #fff;
  color: #4b5563;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: background .12s, border-color .12s, color .12s;
}
.ctab:hover { background: #fafafe; border-color: #c7d2fe; }
.ctab:focus-visible { outline: 2px solid var(--br, #4f46e5); outline-offset: 1px; }
.ctab.is-active {
  background: #fff;
  border-color: var(--br, #4f46e5);
  color: #1a1a2e;
  box-shadow: 0 2px 0 0 var(--br, #4f46e5) inset, 0 6px 16px rgba(79, 70, 229, .10);
}
.ctab-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}
.ctab.is-active .ctab-dot { background: var(--br, #4f46e5); }
.ctab-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ctab-title {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctab-sub { font-size: 10px; color: #8888a8; white-space: nowrap; }
.ctab-close {
  background: transparent;
  border: none;
  color: #a1a1aa;
  font-size: 15px;
  line-height: 1;
  width: 20px; height: 20px;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  font-family: inherit;
}
.ctab-close:hover { background: #fee2e2; color: #b91c1c; }
.ctab-new {
  align-self: center;
  background: transparent;
  border: 1px dashed #c7c7d4;
  color: #6b7280;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
}
.ctab-new:hover { border-color: var(--br, #4f46e5); color: var(--br, #4f46e5); background: #f5f7ff; }
.ctab-count {
  font-size: 11px;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  border-radius: 9px;
  padding: 2px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}
/* 吸い込み中のゴースト (calcTabs.js が position:fixed をインラインで付与) */
.ctab-ghost { box-shadow: 0 12px 28px rgba(79, 70, 229, .25); }

/* モバイルシェル: #rp はボトムシートなので bleed なし・通常フローで置く */
body.mobile-shell .ctab-bar {
  position: static;
  margin: 0;
  padding: 6px 10px;
  border-radius: 10px;
}
body.mobile-shell .ctab { min-width: 104px; max-width: 200px; padding: 5px 4px 5px 8px; }
body.mobile-shell .ctab-count { display: none; }

/* ダークテーマ */
html[data-theme="dark"] .ctab-bar { background: #15162a; border-bottom-color: #2a2b45; }
html[data-theme="dark"] .ctab { background: #1e1f38; border-color: #33345a; color: #c7c9e6; }
html[data-theme="dark"] .ctab.is-active { color: #fff; }
html[data-theme="dark"] .ctab-new { border-color: #44466b; color: #a3a6cf; }
html[data-theme="dark"] .ctab-count { background: #2b2c52; color: #c7c9e6; }

@media (prefers-reduced-motion: reduce) {
  .ctab { transition: none; }
}

/* 履歴カードの「再計算」ボタン (履歴から計算タブとして開き直す、v1.19.0) */
.hist-recalc-btn {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background .12s;
}
.hist-recalc-btn:hover { background: #d1fae5; }

/* 作業指示書 (カート) の材料行「再計算」 (v1.19.1) */
.cart-unified-item-recalc {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  margin-right: 6px;
}
.cart-unified-item-recalc:hover { background: #d1fae5; }
