/*
 * 事業所の台数・金額・助成区分まわりの画面（2026-10-03）で使う部品。
 * 新規案件登録の事業所一覧・介護事業所検索から取込（admin/index.php）、案件進捗管理の展開部と法人の行の進み具合（admin/contract.php）、
 * 一括支払いのご案内（admin/billing_letter.php）から読む。お客様画面とは共有しない（assets/app.css は変えない）。
 * 色・形は、既存の OMS の書き方に合わせる：
 *   ・警告／エラー／お知らせの文：要フォローの印（.flag：色の点＋文字。黄 #94670F・赤 #8E2A12）と同じ
 *   ・タグ：共通の .tag-ok（緑）・.tag-no（灰）と同じ形。黄は、リマインダー画面の注意（.rm-notice.warn）の色
 *   ・案内の枠：リマインダー画面の .rm-notice（青）・.rm-notice.warn（黄）・.rm-notice.err（赤）と同じ
 */

/* ---- 行ごとの警告・エラー・お知らせ（要フォローの印と同じ形：色の点＋文字。文が長いときは折り返す） ---- */
.ob-msg{display:flex;align-items:baseline;gap:6px;font-size:12px;font-weight:700;line-height:1.45;margin-top:4px;white-space:normal}
.ob-msg i{width:8px;height:8px;border-radius:50%;flex:none;display:inline-block;border:1.5px solid;transform:translateY(-1px)}
.ob-msg.w{color:#94670F}
.ob-msg.w i{background:#EDB53F;border-color:#B8860B}
.ob-msg.e{color:#8E2A12}
.ob-msg.e i{background:#F1B09E;border-color:#8E2A12}
.ob-msg.i{color:#1F4E80;font-weight:500}
.ob-msg.i i{background:#E4EDF8;border-color:#1F4E80}

/* ---- タグ（共通の .tag-no と同じ形）。黄＝注意（助成区分 未選択・修正）。緑・灰は共通の .tag-ok・.tag-no をそのまま使う ---- */
.ob-tag-warn{display:inline-block;font-size:12.5px;font-weight:700;color:#5A3D05;background:#FBEECB;border:1px solid #B8860B;border-radius:5px;padding:1px 9px;white-space:nowrap}
.ob-tag-s{font-size:11.5px;padding:0 7px;line-height:1.6}   /* 表の中の小さめのタグ（.tag-ok・.tag-no・.ob-tag-warn に足す） */

/* ---- 案内の枠（リマインダー画面の .rm-notice と同じ） ---- */
.ob-notice{background:#E4EDF8;border:2px solid #1F4E80;color:#183D63;border-radius:10px;padding:10px 14px;margin:0 0 12px;font-size:13.5px;line-height:1.6}
.ob-notice.warn{background:#FBEECB;border-color:#B8860B;color:#5A3D05}
.ob-notice.err{background:#FDF0EE;border-color:#8E2A12;color:#8E2A12;font-weight:700}

/* ---- 新規案件登録：事業所一覧の上の操作 ---- */
.reg-office-tools{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:18px}
.reg-office-tools .hint{margin:0}
/* 新規案件登録：事業所一覧を1枚のカードにまとめる（2026-10-03。docs/mock/OMS_新規案件登録_拡張モック.html の構成） */
#screen-register .card.reg-office-card{max-width:none;margin-top:20px;padding:18px 20px 16px;overflow:visible}
#screen-register .reg-office-h{margin:0;font:700 17px "Zen Maru Gothic",sans-serif;display:flex;align-items:center;gap:10px}
#screen-register .reg-office-count{font:700 12.5px "Zen Maru Gothic",sans-serif;background:var(--surface-2);border:1.5px solid var(--line-strong);border-radius:999px;padding:1px 10px;color:var(--ink-2)}
#screen-register .reg-office-card .reg-office-tools{margin-top:12px}
#screen-register .reg-office-tools-hint{margin-left:auto!important;font-size:12.5px}
#screen-register .reg-office-foot{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:12px}
#screen-register .reg-office-foot .hint{margin:0;font-size:12.5px;flex:1;min-width:200px}
/* 新規案件登録：法人・担当者の枠（2026-10-04）。横幅いっぱいに広げ、入力欄を横に並べる（PC 1366px で2行）。スマホ幅（600px以下）は1列 */
#screen-register .reg-lead{margin-bottom:14px;max-width:none}
#screen-register .card.reg-top-card{max-width:none;padding:16px 20px 18px}
#screen-register .reg-top-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:12px 14px;margin-top:10px}
#screen-register .reg-top-grid .field{margin-top:0;min-width:0;gap:4px}
#screen-register .reg-top-grid .field > label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* 1行＝6枠（PC 1366px）。法人名・電話番号・メールアドレスの2つは2枠ずつ（項目名と「？」が切れないように）。1行目：法人名・部署・氏名・電話番号、2行目：メール・メール（確認）・事業所数・営業担当（2026-10-04 に入れ替え）、3行目：作業予定日（全事業所共通）・作業開始時間・作業終了時間 */
#screen-register .reg-top-grid .reg-f-wide{grid-column:span 2}
#screen-register .reg-top-grid .reg-f-2{grid-column:span 2}
#screen-register .reg-top-grid .field input,#screen-register .reg-top-grid .field select{width:100%;box-sizing:border-box;min-width:0}
#screen-register .reg-top-grid .count-row input[type=number]{width:96px;flex:0 0 auto}
#screen-register .reg-hint-1{margin:0;font-size:11.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#screen-register .reg-tip{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;margin-left:5px;border-radius:50%;border:1.5px solid var(--line-strong);background:var(--surface-2);color:var(--ink-2);font-size:11px;font-weight:700;cursor:help;vertical-align:1px}
#screen-register .reg-tip:focus{outline:2px solid var(--accent);outline-offset:1px}
@media (max-width:600px){
  #screen-register .reg-top-grid{grid-template-columns:1fr}
  #screen-register .reg-top-grid .reg-f-wide,#screen-register .reg-top-grid .reg-f-2{grid-column:auto}
  #screen-register .card.reg-top-card{padding:14px 12px}
}
/* 新規案件登録：まとめて削除（2026-10-04）。「削除」はチェックが無いときは薄く表示、横に「○件選択中」 */
#screen-register .reg-del-btn:disabled{opacity:.4;cursor:not-allowed;box-shadow:none}
#screen-register .reg-sel-count{font-size:12.5px;font-weight:700;color:var(--ink-3)}
#screen-register .reg-sel-count.on{color:var(--ink)}
.reg-del-card{max-width:460px}
.reg-del-msg{margin:12px 0 6px;font-weight:700}
.reg-del-list{margin:0 0 4px;padding-left:1.2em;font-size:13px;color:var(--ink-2);max-height:40vh;overflow:auto}
.reg-del-list li.more{list-style:none;margin-left:-1.2em}
.reg-del-btns{display:flex;justify-content:flex-end;gap:10px;margin-top:16px}
/* 新規案件登録：前回の入力の復元のお知らせ・ポップアップが止められたときの案内（2026-10-04） */
#screen-register .reg-draft{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 14px;padding:10px 14px;border:1.5px solid #B8860B;border-radius:10px;background:#FBEECB;color:#5A3D05;font-weight:700;font-size:13.5px}
#screen-register .reg-draft[hidden]{display:none}
#screen-register .reg-draft-text{flex:1;min-width:220px}
#screen-register .reg-letter-msg{font-size:12.5px;font-weight:700;color:#8E2A12}
#screen-register .reg-letter-msg[hidden]{display:none}
/* 取込のウィンドウ：説明文と、法人名のお知らせ */
.imp-lead{margin:0;font-weight:700;font-size:14px;color:var(--ink)}
.imp-corp-msg{margin:10px 0 0}
.imp-corp-msg[hidden]{display:none}
@media (max-width:600px){
  #screen-register .card.reg-office-card{padding:14px 12px}
  #screen-register .reg-office-tools-hint{margin-left:0!important}
  #screen-register .reg-office-tools #regImportBtn{flex:1 1 100%}   /* スマホ：取込は1行。次の行に「＋ 事業所を手入力で追加」と、その右に「削除」「○件選択中」（2026-10-04） */
}

/* エラーのある行（登録できない）：赤い案内の枠と同じ地の色 */
table.reg-office-table tbody tr.has-err td{background:#FDF0EE}

/* ---- 介護事業所検索から取込（ポップアップ。既存の .modal-overlay / .modal-card を使う） ---- */
#importModal .modal-card{max-width:980px;max-height:90vh}
.imp-steps{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0 12px}
#impPaste{width:100%;height:170px;box-sizing:border-box;font-family:"Roboto Mono",Consolas,monospace;font-size:12px;padding:8px;border:1.5px solid var(--line-strong);border-radius:8px;background:var(--surface);color:var(--ink)}
.imp-table-wrap{max-height:46vh;overflow:auto;border:1.5px solid var(--line-strong);border-radius:10px}
table.imp-table{min-width:760px;width:100%;border-collapse:collapse;font-size:13px}
table.imp-table th{position:sticky;top:0;z-index:1;background:var(--outline);color:#fff;text-align:left;font-family:"Zen Maru Gothic",sans-serif;font-size:12.5px;font-weight:700;padding:8px 8px;white-space:nowrap}
table.imp-table td{padding:6px 8px;border-bottom:1px solid var(--line);vertical-align:top;background:var(--surface)}
table.imp-table input[type=text],table.imp-table select{width:100%;box-sizing:border-box;font:inherit;padding:5px 7px;border:1.5px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--ink)}
.imp-mode{display:flex;gap:18px;flex-wrap:wrap;margin:12px 0 4px}

/* ---- 案件進捗管理（2026-10-03 の整理）：法人の行の進み具合の棒と、展開部（上のボタン・1事業所＝1行の表・ポップアップ） ----
 * 色は既存の OMS に合わせる：棒・「確定」は作業日（確定）の緑 #4E9187、注意は #FBEECB、エラーは #FDF0EE、表の見出しは .contract-detail-table と同じ */
#screen-contract .cd-prog{min-width:120px;white-space:nowrap;line-height:1.4}
/* 法人の行：進み具合（文字・棒・日付の範囲の3段）が、見出しの帯の下に隠れないよう、上下に余白をとる */
#contractRows > tr.contract-parent > td{padding-top:10px;padding-bottom:10px}
#screen-contract .cd-prog-t{font-weight:700;font-size:13.5px}
#screen-contract .cd-prog-sub{display:inline-block;margin-left:6px;font-size:11px;font-weight:700;color:var(--grey-ink);background:var(--grey-bg);border:1px solid var(--line-strong);border-radius:4px;padding:0 5px;line-height:1.5;vertical-align:1px}
#screen-contract .cd-bar{height:6px;background:var(--grey-bg);border-radius:3px;margin-top:4px;overflow:hidden;max-width:160px}
#screen-contract .cd-bar span{display:block;height:100%;background:#4E9187}
/* 上の行：左にボタン3つ（＋Excel）、キャンセルの札、右端に「台数を変更」 */
#screen-contract .cd-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 10px}
/* ボタンの並びは、表の枠の見えている幅に収め、表の枠を横にスクロールしても左に残す（右端の「台数を変更」が、横スクロールしなくても見える。2026-10-05。値は JS の pinUpdate） */
@media (min-width:821px){
  #screen-contract .contract-detail-inner > .cd-top{position:sticky;left:var(--ct-top-l,0px);box-sizing:border-box;max-width:calc(var(--ct-vis-w,100vw) - var(--ct-top-l,0px) - 16px)}
}
#screen-contract .cd-top .cd-sp{flex:1}
#screen-contract .cd-btn-xs{padding:2px 10px;font-size:12px;min-height:0}
#screen-contract .cd-cancel{white-space:nowrap;max-width:420px;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}
/* 「その他」：担当者・案内メール・送信履歴・営業担当の変更履歴 */
#screen-contract .cd-more{border:1.5px dashed var(--line-strong);border-radius:10px;padding:6px 14px 10px;margin:0 0 10px;background:var(--surface)}
#screen-contract .cd-more .contact-line{margin:6px 0}
/* 1事業所＝1行の表（自分の枠の中で横スクロール。事業所名の列は左に固定。文字は折り返さない） */
#screen-contract .cd-scroll{overflow-x:auto;overscroll-behavior-x:contain;border:1.5px solid var(--line-strong);border-radius:10px;background:var(--surface)}
#screen-contract table.contract-detail-table.cd-table{width:max-content;min-width:100%;border-collapse:separate;border-spacing:0}
#screen-contract table.cd-table th,#screen-contract table.cd-table td{padding:5px 8px;white-space:nowrap;vertical-align:middle;border-bottom:1px solid var(--line);background:var(--surface)}
#screen-contract table.cd-table thead th{background:var(--surface-2);font-size:11.5px}
#screen-contract table.cd-table thead tr.cd-head-g th{text-align:center;padding-top:4px;padding-bottom:2px;border-bottom:0}
#screen-contract table.cd-table td.num{text-align:right;font-variant-numeric:tabular-nums}
#screen-contract table.cd-table th.num{text-align:center}   /* 見出しは中央揃え（新規案件登録の表と同じ。2026-10-04）。数字の欄は右揃えのまま */
#screen-contract table.cd-table .cd-g1,#screen-contract table.cd-table .cd-g2,#screen-contract table.cd-table .cd-g3{border-left:1.5px solid var(--line-strong)}
#screen-contract table.cd-table .cd-no{color:var(--ink-2);font-size:12px;text-align:right}
/* 事業所名の列は、横スクロールしても左に固定する。見出しの2段（グループ見出しの段も）も同じ幅で固定する。
   背景は不透明（下を通る列が透けない）。境目は細い線と影 */
#screen-contract table.cd-table .cd-name{position:sticky;left:0;z-index:2;border-right:2px solid var(--ink-3);box-shadow:6px 0 8px -4px rgba(60,40,10,.38);clip-path:inset(0 -14px 0 0);max-width:260px;overflow:hidden;text-overflow:ellipsis}
#screen-contract table.cd-table thead .cd-name{z-index:3}
#screen-contract table.cd-table .cd-name-t{font-weight:700}
#screen-contract table.cd-table tbody tr:hover td{background:var(--surface-2)}
#screen-contract table.cd-table tr.editing td{background:#FBEECB}
#screen-contract table.cd-table tr.has-err td{background:#FDF0EE}
#screen-contract table.cd-table tfoot td{font-weight:700;background:var(--surface-2);border-bottom:0}
#screen-contract table.cd-table select,#screen-contract table.cd-table input{font:inherit;font-size:12.5px;padding:3px 6px;border:1.5px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--ink);box-sizing:border-box;min-height:0}
#screen-contract table.cd-table input.bill-n{width:50px;text-align:right}
#screen-contract table.cd-table input.bill-no{width:112px}
#screen-contract table.cd-table select.bill-cat{width:176px}
/* 金額の手修正（2026-10-05）：「台数を変更」中の金額の欄、手で直した金額の「手」の印、「自動計算に戻す」。重複している事業所番号は赤字 */
#screen-contract table.cd-table input.bill-fee{width:78px;text-align:right;font-variant-numeric:tabular-nums}
#screen-contract table.cd-table input.bill-fee.is-manual{border-color:#B7791F;background:#FFF8E6}
#screen-contract table.cd-table .cd-fee-m{display:inline-block;margin-right:3px;font-size:10.5px;font-weight:700;line-height:1;padding:3px;border-radius:4px;background:#B7791F;color:#fff;vertical-align:middle}
#screen-contract table.cd-table .cd-fee-m[hidden]{display:none}
#screen-contract table.cd-table .bill-fee-reset{display:block;margin:3px 0 0 auto;white-space:nowrap}
#screen-contract table.cd-table .bill-fee-reset[hidden]{display:none}
#screen-contract table.cd-table td.cd-c-kj.cd-dup,#screen-contract table.cd-table td.cd-c-kj.cd-dup input{color:var(--danger);font-weight:700}
#screen-contract table.cd-table td.cd-c-kj.cd-dup input{border-color:var(--danger)}
#screen-contract table.cd-table .cd-wd-plan{color:var(--ink-3)}
#screen-contract table.cd-table .cd-wd-ok{color:#1F5B50;font-weight:700}
#screen-contract table.cd-table .cd-wd-ok .wd-badge{margin-right:4px}
/* 助成区分の札・住所（2026-10-06。docs/plan/2026-10-06_案件進捗管理の列追加と手数料文言.md） */
#screen-contract table.cd-table th.cd-c-cat,#screen-contract table.cd-table td.cd-c-cat{text-align:center}
#screen-contract table.cd-table .cd-cat{display:inline-block;min-width:1.6em;box-sizing:border-box;font-size:11.5px;font-weight:700;line-height:1.55;text-align:center;padding:0 3px;border:1px solid var(--line-strong);border-radius:4px;background:var(--surface);color:var(--ink);cursor:help}
#screen-contract table.cd-table .cd-cat-none{color:var(--ink-3);border-color:var(--line);font-weight:400}
#screen-contract table.cd-table td.cd-c-addr{max-width:200px;overflow:hidden;text-overflow:ellipsis}
#screen-contract table.cd-table .cd-addr-t{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px}
#screen-contract table.cd-table .cd-addr-pre{color:var(--ink-3)}
#screen-contract table.cd-table input.bill-addr{width:200px}
/* 電話番号・担当者名（2026-10-17）：担当者名は番号の上に小さく。どちらも折り返さず、幅を超えたら「…」 */
#screen-contract table.cd-table td.cd-c-tel{max-width:120px;overflow:hidden;line-height:1.25}
#screen-contract table.cd-table .cd-tel-t{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px;font-variant-numeric:tabular-nums}
#screen-contract table.cd-table .cd-tanto{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--ink-2)}
/* 作業方法の札（2026-10-06）：訪問＝紺、WEB＝紫、委託＝えんじ（2026-11-01）、未定＝灰色の点線。HS の灰・黄・緑と紛らわしくない色 */
#screen-contract table.cd-table .cd-wm{display:inline-block;margin:0 6px 0 0;padding:0 6px;min-width:2.6em;box-sizing:border-box;font:inherit;font-size:11px;font-weight:700;line-height:1.7;text-align:center;border-radius:4px;border:1px solid;vertical-align:1px;white-space:nowrap}
#screen-contract table.cd-table button.cd-wm{cursor:pointer}
#screen-contract table.cd-table button.cd-wm:hover{filter:brightness(.94)}
#screen-contract table.cd-table .cd-wm-visit{background:#E3EAF6;border-color:#2C4F8A;color:#1F3B6B}
#screen-contract table.cd-table .cd-wm-web{background:#EFE7F8;border-color:#6B48A3;color:#4E2F84}
#screen-contract table.cd-table .cd-wm-none{background:var(--surface);border:1px dashed var(--line-strong);color:var(--ink-3);font-weight:400}
.cd-pop .cd-wm-sep{border-top:1px solid var(--line);margin:4px 2px}
.cd-pop .cd-wm-all{font-size:12.5px;color:var(--accent-deep)}
#screen-contract table.cd-table .cd-wm-itaku{background:#F8E6EE;border-color:#9C3D66;color:#74203F}
/* 委託先・委託金額の列（2026-11-01）：1行に収める（長い委託先名は「…」）。金額が空なら灰色の「金額未入力」。押すと入力欄 */
#screen-contract table.cd-table td.cd-c-itk{max-width:270px}
#screen-contract table.cd-table button.cd-itk{display:inline-flex;align-items:center;gap:8px;max-width:100%;padding:1px 4px;margin:0 -4px;border:0;border-radius:4px;background:transparent;font:inherit;font-size:12.5px;color:var(--ink);cursor:pointer;text-align:left;white-space:nowrap}
#screen-contract table.cd-table button.cd-itk:hover{background:var(--grey-bg)}
#screen-contract table.cd-table .cd-itk-n{min-width:0;max-width:14em;overflow:hidden;text-overflow:ellipsis}
#screen-contract table.cd-table .cd-itk-a{font-weight:700;font-variant-numeric:tabular-nums}
#screen-contract table.cd-table .cd-itk-none{display:inline-block;padding:0 6px;font-size:11px;line-height:1.7;border-radius:4px;background:var(--grey-bg);color:var(--ink-2)}
.cd-pop .itk-in-name{width:210px}
.cd-pop .itk-amt{display:inline-flex;align-items:center;gap:4px}
.cd-pop .itk-in-amt{width:96px;text-align:right;font-variant-numeric:tabular-nums}
.cd-pop .wd-itk{margin-top:8px}
/* 委託の変更履歴（2026-11-01）：1行に収める。長い事業所名・委託先名は「…」（title で全部） */
#screen-contract .rm-hist.rm-hist-itk{max-width:none;width:auto}
#screen-contract .rm-hist.rm-hist-itk td,#screen-contract .rm-hist.rm-hist-itk th{white-space:nowrap}
#screen-contract .rm-hist.rm-hist-itk td:nth-child(2),#screen-contract .rm-hist.rm-hist-itk td:nth-child(4),#screen-contract .rm-hist.rm-hist-itk td:nth-child(5){max-width:240px;overflow:hidden;text-overflow:ellipsis}
.cd-pop .wd-itk[hidden]{display:none}
/* 端末の新規／既存の印（2026-10-06）：台数の横に小さく。新＝茶、既＝灰 */
#screen-contract table.cd-table .cd-kind{display:inline-block;margin-left:4px;padding:0 3px;font-size:10.5px;font-weight:700;line-height:1.5;border:1px solid;border-radius:3px;vertical-align:1px;cursor:help}
#screen-contract table.cd-table .cd-kind-new{background:#FBEFE3;border-color:#C98A55;color:#7A3E0E}
#screen-contract table.cd-table .cd-kind-existing{background:var(--grey-bg);border-color:var(--line-strong);color:var(--ink-2)}
#screen-contract table.cd-table select.bill-kind{width:58px;margin-left:3px;padding:3px 2px;font-size:11.5px}
/* 行の印（警告＝黄・エラー＝赤・お知らせ＝青。要フォローの印と同じ色。内容は、マウスを乗せると出る） */
#screen-contract .cd-ind{display:inline-flex;gap:3px;margin-left:6px;vertical-align:middle}
#screen-contract .cd-ind-dot{width:9px;height:9px;border-radius:50%;display:inline-block;border:1.5px solid;cursor:help}
#screen-contract .cd-ind-dot.w{background:#EDB53F;border-color:#B8860B}
#screen-contract .cd-ind-dot.e{background:#F1B09E;border-color:#8E2A12}
#screen-contract .cd-ind-dot.i{background:#E4EDF8;border-color:#1F4E80}
/* サービス種類ごとの明細（2026-10-23）：事業所名の横の「▸ ○サービス」と、開いた明細の行（少し引っ込め、薄い地の色。事業所の行の台数・金額は明細の合計） */
#screen-contract .cd-svc-tg{margin-left:6px;padding:1px 7px;font:inherit;font-size:11px;font-weight:700;line-height:1.5;border:1px solid var(--line-strong);border-radius:999px;background:var(--surface-2);color:var(--ink-2);cursor:pointer;vertical-align:middle}
#screen-contract .cd-svc-tg:disabled{cursor:default;opacity:.8}
/* 明細のある事業所は、名前を短めに省略して、ボタンがいつも見えるようにする（全文はマウスを乗せると見える） */
#screen-contract table.cd-table tr.cd-has-svc td.cd-name{text-overflow:clip}   /* 欄全体の「…」は使わない（はみ出すと、ボタンと印まで隠れるため） */
#screen-contract table.cd-table tr.cd-has-svc td.cd-name .cd-name-t{display:inline-block;max-width:130px;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}
#screen-contract table.cd-table tr.cd-svc-row td{background:#F7F4EC;font-size:12.5px;border-bottom-style:dashed}
#screen-contract table.cd-table tr.cd-svc-row.editing td{background:#FDF5DE}
#screen-contract table.cd-table tr.cd-svc-row.has-err td{background:#FDF0EE}
#screen-contract table.cd-table tr.cd-svc-row td.cd-svc-name{padding-left:14px;font-weight:400}
#screen-contract .cd-svc-mark{color:var(--ink-3);margin-right:4px}
#screen-contract .cd-svc-code{display:inline-block;min-width:1.9em;margin-right:4px;padding:0 4px;border-radius:4px;background:var(--surface);border:1px solid var(--line-strong);font-size:11px;text-align:center;font-variant-numeric:tabular-nums}
#screen-contract table.cd-table td.cd-svc-from{max-width:300px;overflow:hidden;text-overflow:ellipsis;font-size:12px}
#screen-contract table.cd-table .bill-sum{display:inline-block;min-width:22px}
/* ポップアップ（作業日の確定・変更／申し送り）。中の入力欄は、今の作業日の入力（.wd-editor）をそのまま使う */
.cd-pop{position:absolute;z-index:60;width:340px;max-width:calc(100vw - 16px);box-sizing:border-box;background:var(--surface);border:2px solid var(--outline);border-radius:12px;box-shadow:var(--shadow);padding:10px 12px}
.cd-pop[hidden]{display:none}
.cd-pop .cd-pop-h{margin:0 0 8px;font-size:13.5px;font-family:"Zen Maru Gothic",sans-serif}
.cd-pop .wd-editor{border:0;padding:0;max-width:none;background:transparent}
.cd-pop .wd-ed-row{display:flex;gap:8px;flex-wrap:wrap;align-items:flex-end}
.cd-pop .wd-ed-row label{display:flex;flex-direction:column;font-size:11.5px;font-weight:700;color:var(--ink-2);gap:2px}
.cd-pop .wd-ed-row input,.cd-pop .wd-ed-row select{font:inherit;font-size:13px;padding:4px 6px;border:1.5px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--ink)}
.cd-pop .wd-ed-btns{display:flex;gap:6px;margin-top:10px;align-items:center}
.cd-pop .wd-ed-btns .cd-sp{flex:1}
.cd-pop .wd-by{font-size:11.5px;color:var(--ink-2);margin-top:6px}
.cd-pop textarea.cd-note-in{width:100%;min-height:110px;box-sizing:border-box;font:inherit;font-size:13px;line-height:1.5;padding:6px 8px;border:1.5px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--ink);resize:vertical}

/* ---- 一括支払いのご案内（画面の部分。印刷しない） ---- */
/* 請求月（type=month）：既存の入力欄（.field の date など）と同じ見た目にする */
.bl-controls .field input[type=month]{font-family:"Noto Sans JP",sans-serif;font-size:15px;color:var(--ink);background:var(--surface);border:1.5px solid var(--line-strong);border-radius:8px;padding:10px 12px;width:100%;box-sizing:border-box}
.bl-controls .field input[type=month]:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 3px var(--accent-soft)}

/* 案件進捗管理：スマホ幅（820px以下）は「見る用」に絞る（2026-10-03）。
   ・法人の行：法人名・ヒアリングシートの進み具合・作業日（確定）の進み具合だけを、縦に並べたカードにする（行を押すと開く）
   ・展開部：1事業所＝1枚のカード（事業所名・HS・作業日（予定／確定）・SE担当）。作業日の「確定」はそのまま押せる
   ・台数・金額、申し送り、「台数を変更」、上の行の「Excel」「一括支払いのご案内」は出さない（PCで行う） */
@media (max-width:820px){
  html body #screen-contract .tablewrap{max-height:none;overflow:visible;border:0;background:transparent;border-radius:0}
  html body #screen-contract .tablewrap > table{min-width:0;width:100%;display:block}
  html body #screen-contract .tablewrap > table > thead{display:none}
  html body #screen-contract .tablewrap > table > tbody{display:block}
  html body #contractRows > tr{display:block}
  html body #contractRows > tr.contract-parent{display:grid;grid-template-columns:28px 1fr;gap:6px 6px;align-items:start;background:var(--surface);border:2px solid var(--outline);border-radius:12px;padding:10px 12px;margin:0 0 10px;cursor:pointer}
  html body #contractRows > tr.contract-parent > td{display:block;padding:0;border:0;background:transparent}
  html body #contractRows > tr.contract-parent > td:nth-child(3){position:static;box-shadow:none;background:transparent;font-weight:700;grid-column:2}
  html body #contractRows > tr.contract-parent:hover > td:nth-child(3){background:transparent}
  html body #contractRows > tr.contract-parent > td:nth-child(1){grid-row:1 / span 3;grid-column:1}
  html body #contractRows > tr.contract-parent > td:nth-child(5),
  html body #contractRows > tr.contract-parent > td:nth-child(7){grid-column:2}
  html body #contractRows > tr.contract-parent > td:nth-child(5)::before{content:"ヒアリングシート";display:block;font-size:11px;font-weight:700;color:var(--ink-2)}
  html body #contractRows > tr.contract-parent > td:nth-child(7)::before{content:"作業日（確定）";display:block;font-size:11px;font-weight:700;color:var(--ink-2)}
  html body #contractRows > tr.contract-parent > td:nth-child(2),
  html body #contractRows > tr.contract-parent > td:nth-child(4),
  html body #contractRows > tr.contract-parent > td:nth-child(6),
  html body #contractRows > tr.contract-parent > td:nth-child(8){display:none}
  html body #contractRows > tr.contract-parent .cd-bar{max-width:none}
  html body #contractRows > tr.contract-detail{margin:-6px 0 12px}
  html body #contractRows > tr.contract-detail > td{display:block;padding:0;border:0;background:transparent}
  html body #screen-contract .contract-detail-cell > .contract-detail-inner{position:static;width:auto;overflow:visible;padding:0 0 0 12px}
  html body #screen-contract .cd-top .cd-pc-only,
  html body #screen-contract .cd-top [data-cd="bill-edit"],html body #screen-contract .cd-top [data-cd="bill-save"],html body #screen-contract .cd-top [data-cd="bill-cancel"]{display:none}
  html body #screen-contract .cd-scroll{overflow:visible;border:0;background:transparent;border-radius:0}
  html body #screen-contract table.contract-detail-table.cd-table{display:block;width:100%;min-width:0}
  html body #screen-contract table.cd-table thead,html body #screen-contract table.cd-table tfoot{display:none}
  html body #screen-contract table.cd-table tbody{display:block}
  html body #screen-contract table.cd-table tbody tr{display:block;background:var(--surface);border:1.5px solid var(--line-strong);border-radius:10px;padding:8px 12px;margin:0 0 8px}
  html body #screen-contract table.cd-table tbody tr td{display:none;border:0;padding:2px 0;background:transparent;white-space:normal}
  html body #screen-contract table.cd-table tbody tr td.cd-name{display:block;position:static;max-width:none;overflow:visible;border:0;box-shadow:none;clip-path:none;white-space:normal;padding-bottom:4px}
  html body #screen-contract table.cd-table tbody tr td.cd-c-hs,
  html body #screen-contract table.cd-table tbody tr td.cd-wd,
  html body #screen-contract table.cd-table tbody tr td.cd-c-se{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;min-height:32px}
  html body #screen-contract table.cd-table tbody tr td[data-label]::before{content:attr(data-label);flex:0 0 52px;font-size:11px;font-weight:700;color:var(--ink-2)}
  html body #screen-contract table.cd-table tbody tr td.cd-c-se select{min-height:36px}
  html body #screen-contract table.cd-table tbody tr td.cd-wd .btn{min-height:32px;padding:2px 14px}
  html body #screen-contract table.cd-table tbody tr:hover td{background:transparent}
  html body #screen-contract .contract-detail-inner table.cd-table tbody tr td{white-space:normal}
  html body #screen-contract table.cd-table tbody tr td.muted:only-child{display:block}
  html body #screen-contract table.cd-table tbody tr.cd-svc-row,html body #screen-contract .cd-svc-tg{display:none}   /* スマホの「見る用」は台数・金額を出さないので、明細の行も出さない（2026-10-23） */
}

/* ---- 案件進捗管理：HS未登録の絞り込み（2026-10-04。HS未登録リストを統合） ----
   「HS未登録 ○件」のボタンは、左メニューの「HS未登録リスト」をなくしたので、ほかのボタンより目立つ形（ブランド色の枠・件数の丸）にする */
#screen-contract .ct-hs-btn{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:6px 16px;border:2px solid var(--accent-deep);border-radius:999px;background:var(--surface);color:var(--accent-deep);font:700 14.5px "Zen Maru Gothic",sans-serif;cursor:pointer;white-space:nowrap}
#screen-contract .ct-hs-btn .ct-hs-n{display:inline-block;min-width:26px;padding:1px 10px;border-radius:999px;background:var(--accent-deep);color:#fff;font-size:12.5px;text-align:center}
#screen-contract .ct-hs-btn[aria-pressed="true"]{background:var(--accent-deep);color:#fff}
#screen-contract .ct-hs-btn[aria-pressed="true"] .ct-hs-n{background:#fff;color:var(--accent-deep)}
#screen-contract .ct-hs-btn:focus-visible{outline:3px solid var(--accent-soft);outline-offset:2px}
/* 上部の3つのボタン（HS未登録・条件絞り込み・担当別実績サマリー）。2026-10-04：HS未登録も、ほかの2つと同じ角丸の四角（楕円はやめた。色はそのまま）。
   縦幅は今までの約80％（47px → 38px。上下の余白を詰める。文字の大きさは変えない）。スマホでも同じ高さにそろえる */
html body #screen-contract .ct-hs-btn,
html body #screen-contract .contract-toolbar-btn{box-sizing:border-box;height:38px;min-height:0;padding-top:0;padding-bottom:0;border-radius:10px}
#screen-contract .ct-hsbar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;width:100%;margin-top:6px;padding:8px 10px;border:2px solid var(--accent-deep);border-radius:10px;background:var(--surface)}
#screen-contract .ct-hsbar[hidden]{display:none}
#screen-contract .ct-chip{min-height:32px;padding:3px 12px;border:1.5px solid var(--line-strong);border-radius:999px;background:var(--surface);color:var(--ink);font:700 12.5px "Zen Maru Gothic",sans-serif;cursor:pointer;white-space:nowrap}
#screen-contract .ct-chip b{margin-left:5px;font-family:"Noto Sans JP",sans-serif}
#screen-contract .ct-chip[aria-pressed="true"]{background:#FBEECB;border-color:#B8860B;color:#5A3D05}
#screen-contract .ct-chip.urge[aria-pressed="true"]{background:#FDF0EE;border-color:#8E2A12;color:#8E2A12}
#screen-contract .ct-hs-sort{width:auto;font-size:12.5px;padding:4px 8px}
#screen-contract .ct-hs-cnt{margin-left:auto;font-size:12.5px;font-weight:700;color:var(--ink-2);white-space:nowrap}
#screen-contract .ct-hs-alert{margin:8px 0 0;padding:8px 12px;border:1.5px solid #8E2A12;border-radius:8px;background:#FDF0EE;color:#8E2A12;font-size:13px;font-weight:700}
#screen-contract .ct-hs-alert[hidden]{display:none}
#screen-contract .ct-hs-legend{display:flex;flex-wrap:wrap;gap:6px 18px;margin-top:8px;font-size:12px;color:var(--ink-2)}
#screen-contract .ct-hs-legend[hidden]{display:none}
#screen-contract .ct-hs-legend .flag{margin-right:4px}
#screen-contract .ct-sub{margin-top:3px;font-size:12px;font-weight:400;color:var(--ink-2);white-space:normal}   /* 折り返してよい（表が広がって、PC幅で右端のリマインダーの列が切れないように） */
#screen-contract .ct-sub .mono,#screen-contract .ct-sub a,#screen-contract .ct-sub .ct-missing{white-space:nowrap}
#screen-contract .ct-missing{color:#8E2A12;font-weight:700}
#screen-contract .ct-days{margin-top:2px;font-size:12.5px;font-weight:700;color:var(--ink)}
#screen-contract .ct-days.wc{color:#5B3E96}
#screen-contract .ct-days.over{color:#8E2A12}
#screen-contract .ct-rm .rm-last{margin-top:3px;font-size:11.5px;color:var(--ink-2);white-space:nowrap}
#screen-contract .ct-rm .btn{white-space:nowrap}
/* 未アクセスの札（送信失敗の赤い札と同じ扱い。色は黄。HS未登録リストの .mail-warn と同じ形） */
#screen-contract .mail-warn{display:inline-block;font-size:12.5px;font-weight:700;color:#5A3D05;background:#FBEECB;border:1.5px solid #B8860B;border-radius:5px;padding:0 8px;text-decoration:none}
/* スマホ（見る用のカード）：HS未登録で絞っているときだけ、カードの下にリマインダーボタンを出す */
@media (max-width:820px){
  html body #screen-contract.ct-hs #contractRows > tr.contract-parent > td:nth-child(8){display:block;grid-column:2}
  html body #screen-contract .ct-hs-btn{padding:0 14px;font-size:14px}   /* 高さは上の「上部の3つのボタン」（38px）にそろえる（2026-10-04） */
  html body #screen-contract .ct-hs-cnt{margin-left:0;width:100%}
  html body #screen-contract.ct-hs .ct-fix{position:static}   /* HS未登録の帯が入ると高くなるので、スマホでは上に固定しない（表を見る高さを残す） */
}

/* ---- 案件進捗管理：案件ステータスのプルダウン（2026-10-05：色分けをやめ、白地・黒文字のふつうのプルダウン。同じ画面の「SE担当」のプルダウンと同じ見た目）。
   選べない選択肢は disabled（ブラウザの標準の薄い表示） ---- */
#screen-contract .ct-st-cell{white-space:nowrap}
#screen-contract select.ct-st-select{font:inherit;font-size:13px;padding:5px 8px;border:1.5px solid var(--line-strong);border-radius:6px;background:var(--surface);color:var(--ink);cursor:pointer}
/* 営業担当（法人の行）：文字だけ。未割当は灰色（変更は、法人を開いた中の「その他」→「営業担当を変更」） */
#screen-contract .ct-rep-cell{white-space:nowrap;font-size:13.5px}
.ct-rep-none{color:var(--ink-3)}
#screen-contract .cd-rep-line .btn{margin-left:8px}
/* 営業担当の見出し「営業担当 ▼」（2026-10-05）：押すと選択肢（全員・各営業担当・未割当）。見出しの文字のまま（色は見出しと同じ） */
#screen-contract .ct-th-filter{border:0;background:none;padding:0;margin:0;font:inherit;color:inherit;cursor:pointer;white-space:nowrap}
#screen-contract .ct-th-filter:hover,#screen-contract .ct-th-filter[aria-expanded="true"]{text-decoration:underline;text-underline-offset:3px}
#screen-contract .ct-th-filter:focus-visible{outline:2px solid #fff;outline-offset:2px;border-radius:4px}
#screen-contract .ct-rf-sp{display:none}
/* 営業担当の絞り込み中（「全員」以外。2026-10-05）：「▼」を明るい黄色にし、横に小さな丸。見出しの文字は変えない（丸は ::after なので文字に入らない） */
#screen-contract .ct-th-filter.is-filtered .ct-rf-mark{color:#FFE14D}
#screen-contract .ct-th-filter.is-filtered::after{content:"";display:inline-block;width:8px;height:8px;margin-left:5px;border-radius:50%;background:#FFE14D;box-shadow:0 0 0 1.5px #5A2A10;vertical-align:middle}
#screen-contract .ct-rf-sp.is-filtered .ct-rf-mark{color:#C4510F}   /* スマホの一覧の上は明るい地なので、▼は濃いオレンジ（丸は同じ黄色に濃い縁） */
@media (max-width:820px){
  /* スマホ幅：見出しが無いので、一覧のすぐ上に同じ「営業担当 ▼」（見出しと同じこげ茶の文字） */
  html body #screen-contract .ct-rf-sp{display:inline-block;margin:0 0 8px;padding:4px 2px;color:var(--ink);font-weight:700;font-size:14px}
}
.cd-pop.ct-rf-pop{width:auto;min-width:150px;padding:6px}
.cd-pop .ct-rf-list{display:flex;flex-direction:column}
.cd-pop .ct-rf-opt{display:flex;align-items:center;gap:6px;width:100%;padding:7px 10px;border:0;border-radius:6px;background:none;font:inherit;font-size:13.5px;color:var(--ink);text-align:left;cursor:pointer;white-space:nowrap}
.cd-pop .ct-rf-opt:hover{background:var(--surface-2)}
.cd-pop .ct-rf-opt.is-cur{font-weight:700}
.cd-pop .ct-rf-ck{display:inline-block;width:1em;color:var(--accent-deep)}
/* ---- 案件進捗管理：事業所の表の横スクロールバーを、画面の下の端に出す（2026-10-04。動きは admin/contract.php の hBarUpdate） ----
   表が画面に見えていて、表の下の端（本来の横スクロールバー）が画面の外にある間だけ出す。表と同じ左右の位置・幅で、表の本体と連動して動く */
.cd-hscroll{position:fixed;bottom:0;z-index:55;height:17px;overflow-x:scroll;overflow-y:hidden;background:rgba(255,255,255,.94);border-top:1.5px solid var(--line-strong);box-shadow:0 -2px 6px rgba(58,42,32,.08)}
.cd-hscroll[hidden]{display:none}
.cd-hscroll-in{height:1px}
/* 下の端のバーは、OS の設定で細く隠れることがあるので、色と太さを決めて常に見えるようにする */
.cd-hscroll{scrollbar-width:auto;scrollbar-color:#A99C8E #F4EEE6}
.cd-hscroll::-webkit-scrollbar{height:13px}
.cd-hscroll::-webkit-scrollbar-track{background:#F4EEE6}
.cd-hscroll::-webkit-scrollbar-thumb{background:#A99C8E;border-radius:7px;border:3px solid #F4EEE6}
.cd-hscroll::-webkit-scrollbar-thumb:hover{background:#8C7F72}
