/* ============================================================
   E-計算！ Math — 日数計算（date-calculator.html）だけで使う見た目
   共通（../assets/css/ek.css・css/math.css）の上に重ねる。色は変数だけを使う。クラス名は dc- で始める。
   ============================================================ */

/* ページ上部の要点 */
.dc-quick { margin: 4px 0 20px; }
.dc-quick ul { margin: 2px 0 0; }
.dc-quick li { margin: 2px 0; }

/* 計算すること（4つの切り替え）：2×2 のセグメント。共通の「4つ以上はチップ」の指定より強くする */
html[data-ui="v2"] .radio-row.dc-seg4.dc-seg4 {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px;
  background: var(--page); border-radius: var(--r); padding: 3px;
}
html[data-ui="v2"] .radio-row.dc-seg4.dc-seg4 label {
  flex: none; justify-content: center; text-align: center; padding: 9px 6px; font-size: 13.5px; line-height: 1.4;
  background: transparent; color: var(--ink-2); border-radius: 8px; word-break: keep-all; overflow-wrap: anywhere;
}
html[data-ui="v2"] .radio-row.dc-seg4.dc-seg4 label:has(input:checked) {
  background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 12%, transparent);
}
@media (max-width: 400px) {
  html[data-ui="v2"] .radio-row.dc-seg4.dc-seg4 label { padding: 8px 4px; font-size: 13px; }
}
/* 2つの選択肢（数え方など）は、狭い画面で文字が長くても枠からはみ出さないように折り返す */
html[data-ui="v2"] .dc-mode .radio-row label { text-align: center; line-height: 1.4; word-break: keep-all; overflow-wrap: anywhere; }

/* 日付の欄（文字で入れる欄 ＋ カレンダーのボタン） */
.dc-date { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
html[data-ui="v2"] .dc-date input[type="text"] {
  flex: 1 1 auto; width: 100%; min-width: 0; height: 44px; padding: 0 12px; font-size: 15px; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
}
html[data-ui="v2"] .dc-date input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.dc-pick {
  flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.dc-pick:hover { background: var(--accent-soft); color: var(--accent); }
.dc-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dc-pick svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
/* カレンダーを開くための日付の欄（見えない。ボタンの下に置き、選ぶ画面がボタンの近くに出るようにする） */
.dc-native { position: absolute; right: 0; bottom: 0; width: 44px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }

/* 数と単位（日後・か月 など）を横に並べる */
.dc-vu { display: grid; grid-template-columns: minmax(0, 1fr) minmax(7em, 9em); gap: 8px; align-items: center; }
.dc-vu select { width: 100%; }
html[data-ui="v2"] .dc-vu input[type="text"] {
  width: 100%; min-width: 0; height: 44px; padding: 0 12px; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
}
html[data-ui="v2"] .dc-vu input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
@media (max-width: 560px) {   /* iOS で入力時に拡大されないように */
  html[data-ui="v2"] .dc-date input[type="text"], html[data-ui="v2"] .dc-vu input[type="text"] { font-size: 16px; }
}
/* 入力の誤り（math.css の .vp-row input.bad と同じ見た目） */
html[data-ui="v2"] .dc-date input.bad, html[data-ui="v2"] .dc-vu input.bad { border-color: var(--s2); border-width: 2px; }

/* くわしい条件（営業日の数え方） */
.dc-more { margin: 0 0 14px; border-top: 1px solid var(--grid); padding-top: 10px; }
.dc-more > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent); }
.dc-more[open] > summary { margin-bottom: 10px; }
.dc-more .field { margin-bottom: 0; }
html[data-ui="v2"] .dc-more .radio-row label { flex: 1 1 100%; white-space: normal; }

/* ---- 結果 ---- */
#result { min-height: 236px; }
/* 大きな数字は狭い画面で縮める。日付（2027年1月23日）は少し小さく、年のあとで折り返せる */
html[data-ui="v2"] .dc-out .res-hero .big { flex-wrap: wrap; row-gap: 0; }
html[data-ui="v2"] .dc-out .res-hero .big b { font-size: clamp(30px, 9vw, 44px); overflow-wrap: normal; }
html[data-ui="v2"] .dc-out .res-hero .big b .dc-dt { font-size: clamp(24px, 7vw, 36px); }
html[data-ui="v2"] .dc-out .res-mini .v { overflow-wrap: normal; word-break: normal; }
html[data-ui="v2"] .dc-out .res-mini .v small { white-space: nowrap; }
html[data-ui="v2"] .dc-out .res-mini .s { overflow-wrap: anywhere; }
@media (max-width: 400px) {
  html[data-ui="v2"] .dc-out .res-mini .v { font-size: 15px; }
  html[data-ui="v2"] .dc-out .res-mini .v.text { font-size: 13.5px; }
}

/* 日付の一覧（開始日・終了日などと和暦） */
.dc-facts { margin: 16px 0 0; padding: 10px 14px; border-radius: var(--r); background: var(--page); font-size: 13.5px; line-height: 1.6; }
.dc-facts > div { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); gap: 8px; padding: 4px 0; }
.dc-facts > div + div { border-top: 1px solid var(--grid); }
.dc-facts dt { color: var(--muted); font-weight: 600; }
.dc-facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.dc-facts dd span { display: block; font-size: 12px; color: var(--ink-2); }
@media (max-width: 400px) { .dc-facts > div { grid-template-columns: minmax(0, 1fr); gap: 0; } }

.dc-proj, .dc-142 { margin-top: 14px; font-size: 13.5px; line-height: 1.8; }
.dc-proj b, .dc-142 b { color: var(--ink); }
.dc-h3 { margin: 20px 0 4px; font-size: 15px; }
.dc-p { margin: 8px 0; font-size: 13.5px; line-height: 1.8; color: var(--ink-2); }
.dc-fl { display: block; margin: 0 0 8px; overflow-wrap: anywhere; }

/* 除いた祝日・1日ずつの数え方の表 */
table.data.dc-hol td, table.data.dc-trace td { white-space: normal; }
table.data.dc-hol td:first-child, table.data.dc-trace td:first-child { white-space: nowrap; }
table.data.dc-trace tr.dc-off td { color: var(--muted); }
.dc-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--tint-warn); color: var(--tint-warn-ink); white-space: nowrap; }

/* ---- 期間の帯（始まりの日・起算日・満了日・応当日）。HTML の格子で描く（狭い画面でも文字の大きさが変わらない） ---- */
.dc-band { margin: 18px 0 0; padding: 14px 14px 10px; border: 1px solid var(--grid); border-radius: var(--r); background: var(--surface); min-width: 0; }
.dc-band figcaption { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.dc-cells { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px 4px; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
.dc-c { min-width: 0; padding: 8px 4px 7px; border-radius: 8px; text-align: center; line-height: 1.35; border: 1px solid var(--grid); background: var(--page); }
.dc-c .t { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-2); word-break: keep-all; overflow-wrap: anywhere; }
.dc-c b { display: block; margin-top: 2px; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.dc-c .y { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }
.dc-c .s { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-2); word-break: keep-all; overflow-wrap: anywhere; }
.dc-c-skip { background: repeating-linear-gradient(135deg, var(--page) 0 6px, color-mix(in srgb, var(--grid) 70%, var(--page)) 6px 8px); }
.dc-c-in, .dc-c-end { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.dc-c-end { border-color: var(--accent); border-width: 2px; padding: 7px 3px 6px; }
.dc-c-outo { background: var(--surface); border-style: dashed; border-color: var(--line-strong); }
.dc-span { grid-column: var(--a, 1) / var(--b, 2); height: 22px; line-height: 22px; border-radius: 6px; text-align: center; font-size: 12px; font-weight: 600; color: var(--accent-ink); background: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-band-note { font-size: 11.5px; color: var(--ink-2); line-height: 1.8; padding-top: 8px; margin: 10px 0 0; border-top: 1px solid var(--grid); }
/* 狭い画面（横に4つ並べると日付が入らない幅）では、縦に並べる。期間の帯は、起算日・満了日の色で示す */
@media (max-width: 480px) {
  .dc-cells { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .dc-span { display: none; }
  .dc-c { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; padding: 7px 10px; text-align: left; }
  .dc-c-end { padding: 6px 9px; }
  .dc-c .t { flex: 0 0 88px; }
  .dc-c b { margin-top: 0; }
  .dc-c .s { flex: 1 1 100%; margin-top: 0; padding-left: 96px; }
}

/* 本文の満了日の例の表 */
table.data.dc-ex td, table.data.dc-ex th { white-space: normal; }
table.data.dc-ex td:nth-child(-n+3) { white-space: nowrap; }
table.data.dc-ex td:last-child { min-width: 11em; }
