/* ==========================================================================
   営業日・納期計算ツール
   PC: 左に入力カード / 右に計算結果（sticky）
   SP: 入力 → 結果の1カラム
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  background: #f3f5f8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic Pro', 'Yu Gothic', 'Meiryo', sans-serif;
  color: #1f2937;
  line-height: 1.6;
}

button, input, select, textarea { font-family: inherit; }

:focus-visible {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

/* ── パンくず・導入 ───────────────────────────────────────────── */
.bdc__breadcrumb,
.bdc__seo-header,
.bdc__main-container,
.bdc__doc-section {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

.bdc__breadcrumb { margin-top: 14px; padding: 0 16px; }

.bdc__seo-header {
  margin-top: 10px;
  margin-bottom: 22px;
  padding: 0 16px;
}

.bdc__seo-header h1 {
  margin: 0 0 8px;
  font-size: 1.58rem;
  font-weight: 700;
  line-height: 1.4;
}

.bdc__seo-lead {
  margin: 0;
  max-width: 760px;
  color: #444;
  line-height: 1.75;
}

/* ── メインレイアウト ─────────────────────────────────────────── */
.bdc__main-container {
  margin-bottom: 48px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(320px, 55fr) minmax(300px, 45fr);
  gap: 20px;
  align-items: start;
}

.bdc__form-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bdc__card {
  background: #fff;
  border: 1px solid #e4e9f0;
  border-radius: 10px;
  padding: 22px 22px 18px;
}

.bdc__block-title {
  margin: 0 0 14px;
  font-size: .95rem;
  font-weight: 700;
  color: #374151;
}

.bdc__divider {
  border: none;
  border-top: 1px solid #eef1f5;
  margin: 18px 0;
}

/* ── タブ ───────────────────────────────────────────── */
.bdc__tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e4e9f0;
}

.bdc-tab {
  flex: 1 1 0;
  padding: 10px 8px;
  border: none;
  background: none;
  font-size: .88rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.bdc-tab:hover { color: #2f6fb0; }

.bdc-tab.is-active {
  color: #1d4ed8;
  border-bottom-color: #1d4ed8;
}

/* ── フォーム項目 ───────────────────────────────────────────── */
.bdc__form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.bdc__form-field label {
  font-size: .85rem;
  font-weight: 600;
  color: #4b5563;
}

.bdc__form-field input[type="date"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font-size: 1.05rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
}

.bdc__form-field input:focus { border-color: #2f6fb0; }

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

.bdc__days-row input[type="number"] {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
}

.bdc__step-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 46px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #374151;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

.bdc__step-btn:hover { background: #eff6ff; border-color: #2f6fb0; color: #2f6fb0; }

.bdc__error {
  margin: -8px 0 14px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: .82rem;
  line-height: 1.6;
}

/* クイック選択 */
.bdc__quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 16px;
}

.bdc__quick-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #374151;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}

.bdc__quick-btn:hover { background: #eff6ff; border-color: #2f6fb0; color: #2f6fb0; }

/* 詳細設定（基準日を1日目として数える） */
.bdc__advanced { margin: 4px 0 16px; }

.bdc__advanced-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: .88rem;
  font-weight: 600;
  color: #2f6fb0;
  cursor: pointer;
  list-style: none;
}

.bdc__advanced-summary::-webkit-details-marker { display: none; }

.bdc__advanced-icon::before { content: "＋"; }
.bdc__advanced[open] .bdc__advanced-icon::before { content: "－"; }

.bdc__advanced-body { padding-top: 12px; }

.bdc__count-start {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 6px;
}

.bdc__count-start input { margin-top: 3px; }

.bdc__count-start label {
  font-size: .88rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
}

.bdc__count-start-hint {
  margin: 6px 0 0;
  font-size: .78rem;
  color: #6b7280;
  line-height: 1.6;
}

/* ── 営業日の設定（初期状態は折りたたみ） ───────────────────────── */
.bdc__settings-details { margin: 4px 0 0; }

.bdc__settings-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 4px 0;
  cursor: pointer;
  list-style: none;
}

.bdc__settings-summary::-webkit-details-marker { display: none; }

.bdc__settings-summary-title {
  font-size: .95rem;
  font-weight: 700;
  color: #374151;
}

.bdc__settings-summary-text {
  font-size: .82rem;
  font-weight: 600;
  color: #2f6fb0;
}

.bdc__settings-body { padding-top: 16px; }

.bdc__setting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.bdc__setting-row label {
  font-size: .9rem;
  color: #374151;
  cursor: pointer;
}

.bdc__custom-holiday-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 10px;
}

.bdc__custom-holiday-add input[type="date"] {
  flex: 1 1 auto;
  min-height: 42px;
  padding: 8px 10px;
  font-size: .95rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

.bdc__btn-add {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #2f6fb0;
  background: #fff;
  color: #2f6fb0;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}

.bdc__btn-add:hover { background: #eff6ff; }

.bdc__custom-holiday-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bdc__custom-holiday-empty {
  margin: 0;
  font-size: .8rem;
  color: #9ca3af;
}

.bdc__custom-holiday-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 12px;
  background: #f8fafc;
  border: 1px solid #e4e9f0;
  border-radius: 999px;
  font-size: .85rem;
  color: #374151;
}

.bdc__custom-holiday-remove {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #9ca3af;
  font-size: .9rem;
  line-height: 1;
  cursor: pointer;
}

.bdc__custom-holiday-remove:hover { background: #fef2f2; color: #dc2626; }

/* ── ボタン ───────────────────────────────────────────── */
.bdc__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.bdc__auto-calc-note {
  font-size: .78rem;
  color: #9ca3af;
}

.bdc__btn-text {
  background: none;
  border: none;
  padding: 6px 4px;
  font-size: .85rem;
  color: #9ca3af;
  text-decoration: underline;
  cursor: pointer;
}

.bdc__btn-text:hover { color: #6b7280; }

/* ── 結果カード ───────────────────────────────────────────── */
.bdc__result-column {
  position: sticky;
  top: 20px;
}

.bdc__result-title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
}

.bdc__result-empty {
  padding: 30px 12px;
  text-align: center;
  color: #9ca3af;
  font-size: .9rem;
}

.bdc__result-main {
  text-align: center;
  padding: 22px 12px;
  margin-bottom: 18px;
  background: #eff6ff;
  border-radius: 10px;
}

.bdc__result-main-label {
  display: block;
  font-size: .92rem;
  font-weight: 600;
  color: #1d4ed8;
  margin-bottom: 8px;
}

.bdc__result-main-value {
  display: block;
  font-size: 2.15rem;
  font-weight: 800;
  color: #1e3a8a;
  line-height: 1.25;
}

.bdc__result-sub-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: #f8fafc;
  border-radius: 8px;
}

.bdc__result-sub-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: .88rem;
}

.bdc__result-sub-line-label { color: #6b7280; }
.bdc__result-sub-line-value { color: #1f2937; font-weight: 700; }

/* 内訳 */
.bdc__breakdown {
  margin: 0 0 18px;
}

.bdc__breakdown-summary {
  padding: 4px 0;
  font-size: .9rem;
  font-weight: 600;
  color: #2f6fb0;
  cursor: pointer;
  list-style: none;
}

.bdc__breakdown-summary::-webkit-details-marker { display: none; }

.bdc__breakdown-list {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 10px;
  border: 1px solid #eef1f5;
  border-radius: 8px;
}

.bdc__breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  font-size: .85rem;
  border-bottom: 1px solid #f1f5f9;
}

.bdc__breakdown-row:last-child { border-bottom: none; }

.bdc__breakdown-row--off {
  color: #9ca3af;
  background: #fafbfc;
}

.bdc__breakdown-date { font-weight: 600; color: #374151; }
.bdc__breakdown-row--off .bdc__breakdown-date { color: #9ca3af; font-weight: 500; }
.bdc__breakdown-status { color: #6b7280; }

/* カレンダー（スマホでは折りたたみ、PCでは常に表示） */
.bdc__calendar-details { margin: 0 0 18px; }

.bdc__calendar-summary {
  padding: 4px 0;
  font-size: .9rem;
  font-weight: 600;
  color: #2f6fb0;
  cursor: pointer;
  list-style: none;
}

.bdc__calendar-summary::-webkit-details-marker { display: none; }

.bdc__calendar-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

@media (min-width: 901px) {
  .bdc__calendar-summary { display: none; }
  .bdc__calendar-wrap { margin-top: 0; }
}

.bdc__calendar {
  flex: 1 1 220px;
  min-width: 220px;
}

.bdc__calendar-title {
  margin-bottom: 8px;
  font-size: .82rem;
  font-weight: 700;
  color: #4b5563;
  text-align: center;
}

.bdc__calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.bdc__calendar-weekday {
  text-align: center;
  font-size: .68rem;
  color: #9ca3af;
  padding: 2px 0;
}

.bdc__calendar-weekday.is-sun { color: #dc2626; }
.bdc__calendar-weekday.is-sat { color: #2563eb; }

.bdc__calendar-day {
  text-align: center;
  font-size: .74rem;
  padding: 5px 0;
  border-radius: 6px;
  color: #374151;
}

.bdc__calendar-day--blank { visibility: hidden; }

.bdc__calendar-day.is-sat { color: #2563eb; }
.bdc__calendar-day.is-sun { color: #dc2626; }
.bdc__calendar-day.is-holiday { color: #dc2626; background: #fef2f2; }
.bdc__calendar-day.is-inrange { background: #eff6ff; }

.bdc__calendar-day.is-start {
  box-shadow: inset 0 0 0 1px #94a3b8;
  font-weight: 700;
}

.bdc__calendar-day.is-result {
  background: #1d4ed8;
  color: #fff;
  font-weight: 800;
}

.bdc__note-small {
  margin: 0 0 14px;
  font-size: .74rem;
  color: #9ca3af;
}

/* コピー・印刷 */
.bdc__result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bdc__btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  border: 1px solid #2f6fb0;
  color: #2f6fb0;
}

.bdc__btn-outline:hover { background: #eff6ff; }

.bdc__copy-status {
  font-size: .82rem;
  color: #16a34a;
  font-weight: 600;
}

/* ── 解説・FAQセクション ───────────────────────────────────── */
.bdc__doc-section {
  margin-top: 40px;
  margin-bottom: 60px;
  padding: 0 16px;
  color: #374151;
  line-height: 1.85;
}

.bdc__doc-section h2 {
  margin: 38px 0 14px;
  padding-left: 10px;
  border-left: 4px solid #1d4ed8;
  color: #111827;
  font-size: 1.22rem;
  font-weight: 700;
}

.bdc__doc-section h2:first-of-type { margin-top: 0; }

.bdc__doc-section h3 {
  margin: 0 0 6px;
  color: #1d4ed8;
  font-size: 1rem;
  font-weight: 700;
}

.bdc__doc-section p,
.bdc__doc-section li {
  color: #374151;
  font-size: .92rem;
  line-height: 1.85;
}

.bdc__doc-section p { margin: 0 0 12px; }
.bdc__doc-section a { color: #1d4ed8; font-weight: 600; }

.bdc__compare-table {
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: .86rem;
  width: auto;
}

.bdc__compare-table th,
.bdc__compare-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 16px;
  text-align: center;
}

.bdc__compare-table th {
  background: #f8fafc;
  color: #4b5563;
  font-weight: 600;
}

.bdc__faq-item {
  margin-bottom: 10px;
  padding: 13px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.bdc__faq-item p { margin: 0; }

.related-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-links li a {
  display: block;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  background: #fff;
  color: #1d4ed8;
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
}

.related-links li a:hover { background: #eff6ff; }

/* ── レスポンシブ ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .bdc__main-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .bdc__form-column { order: 1; }
  .bdc__result-column {
    order: 2;
    position: static;
  }

  .bdc__result-main-value { font-size: 1.9rem; }
}

@media (max-width: 560px) {
  .bdc__calendar-wrap { flex-direction: column; }
  .bdc__actions { flex-direction: column-reverse; align-items: stretch; text-align: center; }
}

/* ── 印刷 ───────────────────────────────────────────── */
@media print {
  #header, #footer, .bdc__breadcrumb, .bdc__form-column,
  .bdc__result-actions, .bdc__doc-section { display: none !important; }
  .bdc__main-container { display: block; }
  .bdc__result-column { position: static; }
}
