/* 堀工務店 現場の進捗管理。日本の業務ソフト風・見やすさ優先（2026-10-14 本人の依頼）
   色はここ（:root）だけで決める。ほかに上書きする仕組みを置かない */
:root {
  --p: #1F3A68;      /* 紺（主ボタン・選択中・見出し） */
  --p-d: #14284A;
  --p-l: #E7EDF6;    /* うすい紺（表の見出し・選択中の背景） */
  --p-ll: #F3F6FB;
  --bg: #F4F6F9;
  --ok: #2E7D32; --ok-bg: #E6F4E7;
  --red: #C62828; --red-bg: #FDE7E5;
  --yel: #8A6200; --yel-bg: #FFF4C2;
  --gray: #5F6670; --gray-bg: #ECEEF1;
  --line: #D5DBE3; --txt: #1E232B; --sub: #59616D;
  --r: 6px;
  --fs: 17px;
}
* { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--txt); line-height: 1.6; font-variant-numeric: tabular-nums;
  font-family: "Hiragino Sans", "Meiryo UI", Meiryo, "Yu Gothic UI", "Noto Sans JP", sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 1.4rem; margin: 0 0 14px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; color: var(--p); }
h3 { font-size: 1.02rem; margin: 18px 0 8px; }
a { color: var(--p); }
.hint { color: var(--sub); font-size: .88rem; }
.center { text-align: center; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }

header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: 58px;
  background: var(--p); color: #fff; padding: 0 18px; }
header .logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.mk { width: 34px; height: 34px; border-radius: var(--r); background: #fff; color: var(--p); display: grid; place-items: center; font-weight: 800; }
header .ttl { font-weight: 700; font-size: 1.05rem; }
header .sp { flex: 1; }
header .who { font-size: .9rem; opacity: .9; }
header button.q { color: #fff; border-color: rgba(255,255,255,.4); }
header button.q:hover { background: rgba(255,255,255,.12); }

nav#nav { display: flex; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 58px; z-index: 29; overflow-x: auto; padding: 0 12px; }
nav#nav button { border: 0; border-bottom: 4px solid transparent; background: none; padding: 12px 16px 9px; font-size: 1rem; color: var(--sub); white-space: nowrap; cursor: pointer; border-radius: 0; min-height: 0; }
nav#nav button b { display: inline-block; width: 1.5em; height: 1.5em; line-height: 1.5em; border-radius: var(--r); background: var(--p-l); color: var(--p); margin-right: 6px; font-size: .82rem; text-align: center; }
nav#nav button.on { color: var(--p); font-weight: 700; border-bottom-color: var(--p); }
nav#nav button.on b { background: var(--p); color: #fff; }

main { max-width: 1280px; margin: 0 auto; padding: 18px 18px 120px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(20,40,74,.05); animation: fin .3s ease-out; }
@keyframes fin { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }
.card.red { border-color: #E9A6A0; background: var(--red-bg); color: var(--red); }
.card.okc { border-color: #A9D3AB; background: var(--ok-bg); color: var(--ok); }

/* 部品 */
button, .btn { font: inherit; font-size: 1rem; min-height: 44px; padding: 8px 18px; border-radius: var(--r); border: 1px solid var(--line); background: #fff; color: var(--txt); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:hover { border-color: var(--p); }
button.p { background: var(--p); border-color: var(--p); color: #fff; font-weight: 700; }
button.p:hover { background: var(--p-d); }
button.q { background: transparent; border-color: transparent; color: var(--p); }
button.danger { color: var(--red); border-color: #E9A6A0; }
button.small { min-height: 36px; padding: 4px 12px; font-size: .9rem; }
button.wide { width: 100%; margin-top: 16px; }
button:disabled { opacity: .5; cursor: default; }
label { display: block; font-size: .88rem; color: var(--sub); margin: 10px 0 4px; }
input, select, textarea { font: inherit; font-size: 1rem; min-height: 44px; padding: 8px 10px; border: 1px solid #B7C1CE; border-radius: var(--r); background: #fff; color: var(--txt); width: 100%; }
input[type=checkbox] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--p); vertical-align: middle; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(31,58,104,.25); border-color: var(--p); }
input.num, td input.num { text-align: right; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bar .sp { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0 16px; }

/* 集計カード */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi .k { color: var(--sub); font-size: .88rem; }
.kpi .v { font-size: 1.7rem; font-weight: 700; line-height: 1.3; }
.kpi .v small { font-size: .9rem; font-weight: 400; color: var(--sub); margin-left: 4px; }
.kpi.red .v { color: var(--red); } .kpi.yel .v { color: var(--yel); } .kpi.ok .v { color: var(--ok); }

/* 表 */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 12px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--p-l); color: var(--p-d); font-size: .9rem; font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--p-ll); }
tr.late td:first-child { box-shadow: inset 5px 0 0 var(--red); }
tr.over td:first-child { box-shadow: inset 5px 0 0 #E0A800; }

/* 状態バッジ */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .86rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-late { background: var(--red-bg); color: var(--red); border-color: #E9A6A0; }
.b-over { background: var(--yel-bg); color: var(--yel); border-color: #E8D27A; }
.b-closed, .b-done { background: var(--gray-bg); color: var(--gray); }

/* 進み具合の棒（実施＝紺、予定＝縦線） */
.prog { position: relative; height: 14px; background: var(--gray-bg); border-radius: 99px; min-width: 120px; }
.prog i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--p); }
.prog.late i { background: var(--red); }
.prog u { position: absolute; top: -4px; bottom: -4px; width: 3px; background: #E0A800; border-radius: 2px; }
.progtxt { display: flex; justify-content: space-between; font-size: .86rem; color: var(--sub); margin-top: 3px; gap: 8px; }
.progtxt b { color: var(--txt); font-size: 1rem; }

/* 0件・読み込み中 */
.empty { text-align: center; padding: 36px 16px; color: var(--sub); }
.empty .ic { font-size: 2.2rem; color: var(--p); opacity: .5; }
.empty p { margin: 8px 0 16px; }
.skel { height: 52px; border-radius: var(--r); background: linear-gradient(90deg, #E9EDF2, #F4F6F9, #E9EDF2); background-size: 200% 100%; animation: sk 1.2s infinite; margin-bottom: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* 日報の入力 */
.sec { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 14px; background: #fff; }
.sec > summary { list-style: none; cursor: pointer; padding: 12px 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; background: var(--p-ll); border-radius: var(--r); }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary .cnt { margin-left: auto; font-weight: 400; color: var(--sub); font-size: .9rem; }
.sec[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--r) var(--r) 0 0; }
.sec .body { padding: 12px 16px; }
.line { border: 1px solid var(--line); border-radius: var(--r); padding: 38px 12px 12px; margin-bottom: 10px; position: relative; }
.line .rm { position: absolute; top: 6px; right: 6px; }
.line .amt { text-align: right; font-weight: 700; margin-top: 8px; }
.line .g { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 0 10px; }
.line .g .c2 { grid-column: span 2; } .line .g .c3 { grid-column: span 3; } .line .g .c6 { grid-column: span 6; }
.line .g label { margin-top: 6px; }
.photo-thumb { max-width: 160px; max-height: 120px; border-radius: var(--r); border: 1px solid var(--line); display: block; margin-top: 6px; }
.sticky-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: #fff; border-top: 2px solid var(--p); padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; box-shadow: 0 -4px 12px rgba(20,40,74,.08); }
.sticky-foot .total { font-size: 1.25rem; font-weight: 700; }
.sticky-foot .sp { flex: 1; }

/* ログイン */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 420px; }
.logo-big { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.logo-big .mk { background: var(--p); color: #fff; width: 44px; height: 44px; font-size: 1.2rem; }
.logo-big b { display: block; font-size: 1.2rem; color: var(--p); } .logo-big small { color: var(--sub); }
.msg { color: var(--red); min-height: 1.2em; margin: 10px 0 0; }

/* ダイアログ・お知らせ */
.dlg { position: fixed; inset: 0; background: rgba(15,25,40,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.dlg-in { background: #fff; border-radius: 10px; width: 100%; max-width: 620px; max-height: 90vh; overflow: auto; padding: 22px 24px; }
.dlg-in .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ok); color: #fff; padding: 12px 22px; border-radius: var(--r); z-index: 60; font-weight: 700; max-width: 92vw; }
.toast.err { background: var(--red); }
.busy { position: fixed; inset: 0; background: rgba(255,255,255,.6); z-index: 70; display: grid; place-items: center; font-weight: 700; color: var(--p); }

/* スマホ */
@media (max-width: 760px) {
  :root { --fs: 17px; }
  header { padding: 0 12px; height: 54px; } nav#nav { top: 54px; padding: 0 4px; }
  header .ttl { display: none; }
  .hamb { display: inline-flex; }
  nav#nav, .umenu { display: none !important; }
  .crumbs { padding: 8px 12px 0; }
  main { padding: 12px 10px 120px; }
  .card { padding: 14px 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kpi .v { font-size: 1.4rem; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .line .g { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .line .g .c2, .line .g .c3 { grid-column: span 1; } .line .g .c6 { grid-column: span 2; }
  th, td { padding: 10px 8px; }
  .hide-sp { display: none; }
  button.small, .btn.small { min-height: 44px; }   /* スマホは指で押せる高さ */
}
@media print { header, nav, .sticky-foot, button { display: none !important; } body { background: #fff; } }

/* 工種の一覧（カード。スマホでも崩れない） */
.klist { display: grid; gap: 10px; }
.krow { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; background: #fff; }
.krow:hover { background: var(--p-ll); }
.krow.late { border-left: 6px solid var(--red); }
.khead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.khead b { font-size: 1.05rem; }
.khead .sp { flex: 1; }
.kmeta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; }

/* 前の日と同じで始める（2026-10-14 堀さん） */
.copybox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; background: var(--p-ll); border: 1px dashed var(--p); border-radius: var(--r); padding: 12px 14px; margin: 10px 0 4px; }
textarea { line-height: 1.6; }

/* ===== 2026-10-17 部品を足す（ハンバーガー・プルダウン・パンくず・カルーセル・ラジオ・アコーディオン・写真のモーダル） ===== */
body.noscroll { overflow: hidden; }

/* ハンバーガー（スマホだけ出す） */
.hamb { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 44px; height: 44px; min-height: 44px; padding: 0 10px; background: transparent; border: 1px solid rgba(255,255,255,.35); border-radius: var(--r); cursor: pointer; }
.hamb span { display: block; height: 2px; background: #fff; border-radius: 2px; }

/* 右上の名前のプルダウン（パソコン） */
.umenu { position: relative; }
.ubtn { color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.35); min-height: 40px; padding: 4px 14px; font-size: .92rem; }
.ubtn:hover { background: rgba(255,255,255,.12); border-color: #fff; }
.ubtn .caret { font-size: .8rem; opacity: .9; }
.ulist { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(20,40,74,.18); min-width: 220px; padding: 6px; z-index: 40; animation: fin .15s ease-out; }
.ulist button { display: flex; width: 100%; justify-content: flex-start; border: 0; background: none; color: var(--txt); min-height: 44px; padding: 8px 12px; border-radius: 6px; }
.ulist button:hover, .ulist button:focus { background: var(--p-ll); outline: none; }

/* スマホのメニュー（横から出る） */
.drawer { position: fixed; inset: 0; z-index: 45; }
.drawer-bg { position: absolute; inset: 0; background: rgba(15,25,40,.45); opacity: 0; transition: opacity .2s; }
.drawer-in { position: absolute; top: 0; bottom: 0; left: 0; width: min(84vw, 320px); background: #fff; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .2s ease-out; padding-bottom: env(safe-area-inset-bottom); }
.drawer.open .drawer-bg { opacity: 1; }
.drawer.open .drawer-in { transform: none; }
@media (prefers-reduced-motion: reduce) { .drawer-bg, .drawer-in { transition: none; } }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 12px 14px 16px; background: var(--p); color: #fff; }
.drawer-head b { display: block; } .drawer-head small { opacity: .85; font-size: .82rem; }
.drawer-head .drawer-x { margin-left: auto; color: #fff; font-size: 1.2rem; flex: 0 0 auto; }
.drawer-nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; overflow-y: auto; }
.drawer-nav button { justify-content: flex-start; border: 0; background: none; min-height: 52px; font-size: 1.05rem; color: var(--txt); border-radius: 8px; }
.drawer-nav button b { display: inline-block; width: 1.6em; height: 1.6em; line-height: 1.6em; border-radius: var(--r); background: var(--p-l); color: var(--p); font-size: .82rem; text-align: center; margin-right: 10px; }
.drawer-nav button.on { background: var(--p-l); color: var(--p); font-weight: 700; }
.drawer-nav button.on b { background: var(--p); color: #fff; }
.drawer-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.drawer-foot button { justify-content: flex-start; border: 0; background: none; color: var(--sub); }

/* パンくずリスト */
.crumbs { max-width: 1280px; margin: 0 auto; padding: 12px 18px 0; font-size: .9rem; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; }
.crumbs li { display: flex; align-items: center; color: var(--sub); }
.crumbs li + li::before { content: '›'; margin: 0 8px; color: #9AA3AF; }
.crumbs a { color: var(--p); text-decoration: none; padding: 4px 0; }
.crumbs a:hover { text-decoration: underline; }
.crumbs li[aria-current] { color: var(--txt); font-weight: 700; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* カルーセル（スマホでは横にめくる。パソコンでは4つ並び） */
.carousel-dots { display: none; justify-content: center; gap: 8px; margin: 8px 0 0; }
.carousel-dots button { width: 10px; height: 10px; min-height: 10px; padding: 0; border-radius: 50%; border: 0; background: #C9D1DB; }
.carousel-dots button.on { background: var(--p); width: 22px; border-radius: 5px; }
@media (max-width: 760px) {
  .kpis.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .kpis.carousel::-webkit-scrollbar { display: none; }
  .kpis.carousel .kpi { flex: 0 0 82%; scroll-snap-align: center; }
  .kpis.carousel + .carousel-dots { display: flex; }
}

/* ラジオボタン（ボタンの形。指で押しやすい） */
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid #B7C1CE; border-radius: var(--r); overflow: hidden; background: #fff; }
.seg label { margin: 0; position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px 16px; color: var(--txt); cursor: pointer; border-right: 1px solid #D5DBE3; font-size: .95rem; white-space: nowrap; }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--p); color: #fff; font-weight: 700; }
.seg input:focus-visible + span { outline: 3px solid rgba(31,58,104,.35); outline-offset: -3px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { margin: 0; position: relative; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips span { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 18px; border: 1px solid #B7C1CE; border-radius: 99px; background: #fff; cursor: pointer; }
.chips input:checked + span { background: var(--p); border-color: var(--p); color: #fff; font-weight: 700; }
.chips input:focus-visible + span { outline: 3px solid rgba(31,58,104,.35); }

/* アコーディオン（カード） */
details.acc { padding: 0; }
details.acc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 16px 20px; font-weight: 700; color: var(--p); font-size: 1.1rem; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: ''; margin-left: auto; width: 10px; height: 10px; border-right: 2px solid var(--p); border-bottom: 2px solid var(--p); transform: rotate(45deg); transition: transform .2s; }
details.acc[open] > summary::after { transform: rotate(-135deg); }
details.acc > summary .hint { font-weight: 400; }
details.acc > .acc-body { padding: 0 20px 18px; }
.sec > summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--p); border-bottom: 2px solid var(--p); transform: rotate(45deg); transition: transform .2s; margin-left: 4px; }
.sec[open] > summary::after { transform: rotate(-135deg); }

/* 並び替え・絞り込みの帯 */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.toolbar label.inline { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--sub); }
.toolbar select { width: auto; min-width: 180px; }

/* 写真のモーダル */
.photo-thumb { cursor: zoom-in; }
.imgdlg img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; border-radius: 6px; }
@media (max-width: 760px) { .toolbar select { min-width: 0; flex: 1; } .seg { width: 100%; } .seg label { flex: 1; } .seg span { width: 100%; padding: 6px 8px; } }
/* スマホの指定は最後に置く（上の共通の指定に打ち消されないように） */
@media (max-width: 760px) {
  .hamb { display: inline-flex; }
  .crumbs { padding: 10px 12px 0; font-size: .86rem; }
  .crumbs li[aria-current] { max-width: 52vw; }
}
.hamb { align-items: stretch; }   /* 三本線の幅を出す（ボタン共通の align-items:center で幅0になっていた） */
/* スマホでは表を1件ずつのカードに組み替える（現場一覧） */
@media (max-width: 760px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--line); padding: 12px 14px; }
  table.stack td { border: 0; padding: 3px 0; }
  table.stack td.num { text-align: left; }
  table.stack td.num b { font-size: 1rem !important; }
  table.stack tr.late td:first-child, table.stack tr.over td:first-child { box-shadow: none; }
  table.stack tr.late { border-left: 6px solid var(--red); }
  table.stack tr.over { border-left: 6px solid #E0A800; }
}
@media (max-width: 760px) {
  table.stack td.hide-sp { display: block; }
  table.stack td[data-label]::before { content: attr(data-label) '：'; color: var(--sub); font-size: .85rem; margin-right: 4px; }
  table.stack td.num[data-label] { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
  table.stack td.num[data-label] .hint { width: 100%; }
}
