/* ==========================================================================
   bulkfoods_app 共通スタイル
   レスポンシブ前提。幅375px（iPhone基準）で横スクロールなしに操作できること。
   タップ対象は最小44px。表は横スクロール枠に入れる。
   ========================================================================== */

:root{
  --bg:#f4f6f8; --panel:#fff; --ink:#1c2733; --sub:#5b6b7c; --line:#dbe2ea;
  --accent:#1f6feb; --accent-d:#1656bb; --ok:#127a3d; --ok-bg:#e6f4ec;
  --warn:#9a6400; --warn-bg:#fff5e0; --bad:#b3261e; --bad-bg:#fdecea;
  --gray:#8b98a5; --gray-bg:#eef1f4;
  --radius:10px; --tap:44px;
  --shadow:0 1px 2px rgba(16,32,48,.06), 0 2px 8px rgba(16,32,48,.05);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg); color:var(--ink);
  font:15px/1.65 "Segoe UI","Yu Gothic UI","Hiragino Kaku Gothic ProN",Meiryo,sans-serif;
  -webkit-text-size-adjust:100%;
  overflow-x:hidden;
}
a{color:var(--accent); text-decoration:none}
a:hover{text-decoration:underline}
h1,h2,h3{line-height:1.35; margin:0 0 .5em}
h1{font-size:20px}
h2{font-size:17px; margin-top:0}
h3{font-size:15px}
p{margin:.4em 0}

/* ---------- ヘッダー・ナビ ---------- */
.hd{
  position:sticky; top:0; z-index:50;
  background:#16283c; color:#fff; box-shadow:var(--shadow);
}
.hd-top{
  display:flex; align-items:center; gap:10px;
  padding:8px 12px; min-height:var(--tap);
}
.hd-title{font-weight:700; font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.hd-title a{color:#fff}
.hd-title a:hover{text-decoration:none}
.hd-me{margin-left:auto; display:flex; align-items:center; gap:8px; font-size:12.5px; white-space:nowrap}
.hd-me .nm{font-weight:600}
.hd-me .ttl{color:#a9c0d8}
.pb{
  display:inline-flex; align-items:center; border-radius:12px; padding:3px 8px;
  font-size:11.5px; font-weight:700; white-space:nowrap; min-height:24px;
}
.pb:hover{text-decoration:none; filter:brightness(1.1)}
.pb.on{background:#1d6b45; color:#c9f0da}
.pb.off{background:rgba(255,255,255,.14); color:#c9d8e6}
.pb.ng{background:#6b4a00; color:#ffe6a8}
.hd-out{
  background:rgba(255,255,255,.14); color:#fff; border:0; border-radius:6px;
  padding:7px 10px; font-size:12.5px; cursor:pointer; min-height:34px;
}
.hd-out:hover{background:rgba(255,255,255,.24)}
.nav{
  display:flex; gap:2px; overflow-x:auto; padding:0 6px 6px;
  scrollbar-width:thin; -webkit-overflow-scrolling:touch;
}
.nav a{
  color:#c9d8e6; padding:9px 11px; border-radius:7px; white-space:nowrap;
  font-size:13.5px; min-height:38px; display:flex; align-items:center;
}
.nav a:hover{background:rgba(255,255,255,.10); text-decoration:none; color:#fff}
.nav a.on{background:#2f5f8f; color:#fff; font-weight:600}

/* ---------- レイアウト ---------- */
/* width:100% を明示しないと、チャット画面（body が flex）で中身の最小幅に
   引っ張られて版面が広がることがある */
.wrap{width:100%; max-width:1180px; margin:0 auto; padding:14px 12px 60px}
.card{
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius);
  padding:14px; margin:0 0 14px; box-shadow:var(--shadow);
}
.card>h2:first-child,.card>h1:first-child{margin-top:0}
.row{display:flex; flex-wrap:wrap; gap:10px}
.row>*{min-width:0}
.grid2{display:grid; grid-template-columns:1fr; gap:14px}
@media(min-width:820px){ .grid2{grid-template-columns:1fr 1fr} }
.spread{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap}
.muted{color:var(--sub); font-size:13px}
.small{font-size:12.5px}
.right{text-align:right}
.nowrap{white-space:nowrap}
.pre{white-space:pre-wrap; word-break:break-word}
.hide{display:none !important}

/* ---------- ボタン ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  min-height:var(--tap); padding:10px 15px; border-radius:8px;
  border:1px solid var(--line); background:#fff; color:var(--ink);
  font-size:14px; font-family:inherit; cursor:pointer; text-decoration:none;
}
.btn:hover{background:#f2f5f8; text-decoration:none}
.btn:active{transform:translateY(1px)}
.btn[disabled]{opacity:.5; cursor:not-allowed}
.btn.pri{background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600}
.btn.pri:hover{background:var(--accent-d)}
.btn.danger{background:#fff; border-color:#e3b4b0; color:var(--bad)}
.btn.danger:hover{background:var(--bad-bg)}
.btn.sm{min-height:34px; padding:6px 10px; font-size:13px; border-radius:7px}
.btn.wide{width:100%}

/* ---------- フォーム ---------- */
label{display:block; font-size:13px; color:var(--sub); margin:0 0 3px; font-weight:600}
input[type=text],input[type=date],input[type=email],input[type=number],input[type=search],
select,textarea{
  width:100%; padding:10px 11px; min-height:var(--tap);
  border:1px solid var(--line); border-radius:8px; background:#fff;
  font:inherit; font-size:15px; color:var(--ink);
}
textarea{min-height:96px; resize:vertical; line-height:1.6}
input:focus,select:focus,textarea:focus{
  outline:2px solid rgba(31,111,235,.35); outline-offset:-1px; border-color:var(--accent);
}
.field{margin:0 0 11px}
.fields{display:grid; grid-template-columns:1fr; gap:0 12px}
@media(min-width:640px){ .fields.c2{grid-template-columns:1fr 1fr} .fields.c3{grid-template-columns:1fr 1fr 1fr} }
.checks{display:flex; flex-wrap:wrap; gap:6px}
.checks label{
  display:flex; align-items:center; gap:6px; margin:0; font-weight:400; color:var(--ink);
  border:1px solid var(--line); border-radius:20px; padding:8px 12px; min-height:38px;
  background:#fff; cursor:pointer; font-size:13.5px;
}
.checks input{width:auto; min-height:auto; margin:0}
.checks label:has(input:checked){background:#e8f0fe; border-color:var(--accent); font-weight:600}
.filters{display:flex; flex-wrap:wrap; gap:8px; align-items:flex-end}
.filters .field{margin:0; flex:1 1 150px; min-width:130px}
.filters .field.sm{flex:0 1 110px}

/* ---------- 表 ---------- */
.tablewrap{overflow-x:auto; -webkit-overflow-scrolling:touch; margin:0 -14px; padding:0 14px}
table{border-collapse:collapse; width:100%; font-size:13.5px}
th,td{border-bottom:1px solid var(--line); padding:9px 8px; text-align:left; vertical-align:top}
th{background:#f7f9fb; color:var(--sub); font-size:12.5px; font-weight:700; white-space:nowrap;
   position:sticky; top:0; z-index:1}
tbody tr:hover{background:#f8fbff}
tr.clickable{cursor:pointer}
td.num,th.num{text-align:right; white-space:nowrap}
.emptynote{padding:22px 8px; text-align:center; color:var(--sub)}

/* ---------- バッジ・状態 ---------- */
.badge{
  display:inline-block; padding:2px 8px; border-radius:11px; font-size:11.5px;
  font-weight:700; white-space:nowrap; line-height:1.7;
}
.b-未着手{background:var(--warn-bg); color:var(--warn)}
.b-対応中{background:#e6f0fd; color:var(--accent-d)}
.b-提出済み{background:#efe7fb; color:#6b3fb0}
.b-完了{background:var(--ok-bg); color:var(--ok)}
/* フェーズの状態 */
.b-進行中{background:#e6f0fd; color:var(--accent-d)}
.b-未確定{background:var(--warn-bg); color:var(--warn)}
.b-確定済{background:var(--ok-bg); color:var(--ok)}
.b-取り下げ{background:var(--gray-bg); color:var(--sub)}
.b-有効{background:var(--ok-bg); color:var(--ok)}
.b-取消{background:var(--gray-bg); color:var(--sub)}
.b-over{background:var(--bad-bg); color:var(--bad)}
.b-soon{background:var(--warn-bg); color:var(--warn)}
.b-dev{background:#fde7a9; color:#7a5200}
tr.over,li.over{background:#fdf2f1}
.overtext{color:var(--bad); font-weight:700}
.struck{text-decoration:line-through; color:var(--sub)}
.lv{color:#c98a00; letter-spacing:-1px; white-space:nowrap}

/* ---------- 数字タイル ---------- */
.tiles{display:grid; grid-template-columns:repeat(2,1fr); gap:10px}
@media(min-width:700px){ .tiles{grid-template-columns:repeat(4,1fr)} }
.tile{
  display:block; background:#fff; border:1px solid var(--line); border-radius:var(--radius);
  padding:12px; min-height:var(--tap); color:inherit;
}
.tile:hover{background:#f6f9ff; border-color:#bcd3f5; text-decoration:none}
.tile .k{font-size:12.5px; color:var(--sub); font-weight:600}
.tile .v{font-size:26px; font-weight:700; line-height:1.25}
.tile .u{font-size:12.5px; color:var(--sub); font-weight:400}
.tile.bad .v{color:var(--bad)}
.tile.warn .v{color:var(--warn)}

/* 進捗の帯グラフ */
.bar{display:flex; height:16px; border-radius:8px; overflow:hidden; background:var(--gray-bg); margin:8px 0 6px}
.bar i{display:block; height:100%}
.bar .s-完了{background:#2f9e5e}
.bar .s-進行中{background:#4a8fe0}
.bar .s-未着手{background:#e8b23a}
.legend{display:flex; flex-wrap:wrap; gap:4px}
.legend a{
  display:inline-flex; align-items:center; gap:5px; font-size:12.5px; color:var(--ink);
  border:1px solid var(--line); border-radius:16px; padding:5px 10px; min-height:32px; background:#fff;
}
.legend a:hover{background:#f2f5f8; text-decoration:none}
.legend i{width:9px; height:9px; border-radius:50%; display:inline-block}

/* ---------- チャット ---------- */
.chatpage{display:flex; flex-direction:column; height:100dvh}
.chatpage .wrap{flex:1; display:flex; flex-direction:column; min-height:0; min-width:0;
  padding-bottom:0}
.chatpage .wrap > *{min-width:0; max-width:100%}
/* チャット上部の導線。狭い画面では折り返して、版面を押し広げないようにする */
.linkline{display:flex; gap:8px; align-items:center; flex-wrap:wrap;
  justify-content:space-between; padding:4px 0; max-width:100%; min-width:0}
.linkline .btn{white-space:normal; text-align:left; max-width:100%; min-width:0}
.linkline > *{min-width:0; max-width:100%}
#feed{
  flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch;
  background:#eef2f6; border:1px solid var(--line); border-radius:var(--radius);
  padding:12px; min-height:0;
}
.daysep{text-align:center; margin:14px 0 10px}
.daysep span{background:#dde5ed; color:var(--sub); font-size:12px; padding:3px 12px; border-radius:12px}
.msg{display:flex; margin:0 0 10px; gap:8px; min-width:0; max-width:100%}
.msg .bub{
  max-width:min(78%,560px); background:#fff; border-radius:12px; padding:8px 11px;
  box-shadow:0 1px 1px rgba(16,32,48,.08);
  /* flex アイテムの最小幅は既定で min-content になる。折り返さないバッジが
     入ると版面を押し広げてしまうので、明示的に 0 にして縮められるようにする */
  min-width:0;
}
.msg .who{font-size:12px; color:var(--sub); margin:0 0 2px; font-weight:600}
.msg .who .ttl{font-weight:400; color:#8b98a5}
.msg .tx{white-space:pre-wrap; word-break:break-word}
.msg .mt{font-size:11px; color:var(--gray); margin-top:3px}
.msg.mine{flex-direction:row-reverse}
.msg.mine .bub{background:#dcefff}
.msg.mine .mt{text-align:right}
.msg .bub{overflow:hidden}          /* 長いバッジが吹き出しからはみ出さないように */
.msg .tags{margin-top:4px; display:flex; gap:4px; flex-wrap:wrap; align-items:center;
  max-width:100%; min-width:0}
.msg .tags a{font-size:11.5px; background:var(--gray-bg); border-radius:10px; padding:1px 8px; color:var(--sub)}
.msg .tags a.dbadge{
  background:#e6f0fd; color:var(--accent-d); font-weight:700;
  min-height:32px; display:inline-flex; align-items:center; padding:2px 10px; border-radius:11px;
  max-width:100%; min-width:0; flex:0 1 auto;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.msg .tags a.dbadge:hover{background:#d6e6fc; text-decoration:none}
.msg .tags .rtag{font-size:11.5px; background:var(--gray-bg); border-radius:10px;
  padding:1px 8px; color:var(--sub)}
.msg .atts{margin-top:6px; display:flex; flex-wrap:wrap; gap:6px}
.msg .atts img{max-width:150px; max-height:150px; border-radius:8px; display:block; border:1px solid var(--line)}
.msg .atts .fl{font-size:12.5px; background:var(--gray-bg); border-radius:7px; padding:6px 9px; display:inline-block}
.msg .pin{font-size:11px; color:var(--warn); font-weight:700}
.composer{
  border-top:1px solid var(--line); background:var(--panel); padding:9px 0 12px;
  position:sticky; bottom:0;
}
.composer textarea{min-height:46px; max-height:130px}
.composer .line{display:flex; gap:7px; align-items:flex-end; margin-top:7px; flex-wrap:wrap}

/* ---------- タスクへのリンク ---------- */
/* No＋内容のブロック。押せる範囲を広くとる */
.dref{
  display:flex; align-items:flex-start; gap:9px; min-height:var(--tap);
  padding:7px 9px; margin:-7px -9px; border-radius:9px;
  color:inherit; text-decoration:none;
}
.dref:hover{background:#eef4ff; text-decoration:none}
.dref:focus-visible{outline:2px solid var(--accent); outline-offset:-2px}
.dref .no{
  flex:0 0 auto; font-weight:700; color:var(--accent-d); font-size:13px;
  background:#e6f0fd; border-radius:11px; padding:2px 9px; white-space:nowrap; line-height:1.7;
}
.dref .bd{flex:1 1 auto; min-width:0; font-size:13.5px; line-height:1.5}
.dref:hover .bd{text-decoration:underline}
.dref .sub{display:block; font-size:12px; color:var(--sub); margin-top:2px;
  text-decoration:none}
.dref:hover .sub{text-decoration:none}

/* 小さいバッジ型（本文の中に置く用）。押せる高さは確保する */
.dref-in{
  display:inline-flex; align-items:center; min-height:32px; padding:2px 10px;
  background:#e6f0fd; color:var(--accent-d); border-radius:11px;
  font-size:12.5px; font-weight:700; white-space:nowrap;
}
.dref-in:hover{background:#d6e6fc; text-decoration:none}

/* 行全体をタップで移動できる表 */
tr.rowlink{cursor:pointer}
tr.rowlink:hover{background:#eef4ff}
tr.rowlink:focus-visible{outline:2px solid var(--accent); outline-offset:-2px}
tr.rowlink td{min-height:var(--tap)}
.rowhint{font-size:11.5px; color:var(--gray); white-space:nowrap}
tr.rowlink:hover .rowhint{color:var(--accent)}

/* ---------- リアクション ---------- */
.rx{display:flex; gap:5px; margin-top:5px; flex-wrap:wrap}
.rxb{
  display:inline-flex; align-items:center; gap:4px; min-height:30px; padding:2px 9px;
  border:1px solid var(--line); border-radius:15px; background:#fff; cursor:pointer;
  font-size:14px; line-height:1.4; font-family:inherit;
}
.rxb:hover{background:#f2f5f8}
.rxb b{font-size:12px; font-weight:700; color:var(--sub)}
.rxb.on{background:#e8f0fe; border-color:var(--accent)}
.rxb.on b{color:var(--accent-d)}

/* ---------- チャットの返信（引用） ---------- */
.quote{
  display:block; border-left:3px solid var(--accent); background:rgba(31,111,235,.07);
  border-radius:0 7px 7px 0; padding:4px 9px; margin:0 0 5px; font-size:12px;
  color:var(--sub); text-decoration:none; max-width:100%; overflow:hidden;
}
.quote:hover{background:rgba(31,111,235,.13); text-decoration:none}
.quote b{color:var(--accent-d); font-weight:700}
.msg.flash .bub{animation:flash 1.4s ease-out}
@keyframes flash{
  0%{box-shadow:0 0 0 3px rgba(31,111,235,.55)}
  100%{box-shadow:0 0 0 3px rgba(31,111,235,0)}
}
#replyBar{
  display:flex; align-items:center; gap:8px; background:#eef3fb; border:1px solid #c7dafa;
  border-left:4px solid var(--accent); border-radius:0 8px 8px 0; padding:7px 10px;
  margin:0 0 7px; font-size:12.5px; color:var(--sub);
}
#replyBar .t{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
#replyBar b{color:var(--accent-d)}
#replyBar button{
  border:0; background:rgba(0,0,0,.08); border-radius:6px; min-height:30px; padding:4px 10px;
  cursor:pointer; font-family:inherit; font-size:12.5px;
}
#replyBar button:hover{background:rgba(0,0,0,.15)}

/* ---------- タスクの経過履歴（タイムライン） ---------- */
.tl{position:relative; margin:6px 0 0; padding-left:26px}
.tl::before{content:''; position:absolute; left:8px; top:6px; bottom:6px; width:2px;
  background:var(--line)}
.tli{position:relative; margin:0 0 14px}
.tli::before{content:''; position:absolute; left:-22px; top:7px; width:11px; height:11px;
  border-radius:50%; background:#fff; border:2px solid var(--gray)}
.tli.c-comment::before{border-color:var(--accent); background:var(--accent)}
.tli.c-post::before{border-color:#2f9e5e; background:#2f9e5e}
.tli.c-photo::before{border-color:#c98a00; background:#c98a00}
.tli .when{font-size:12px; color:var(--gray)}
.tli .who{font-size:13px; font-weight:700; color:var(--ink)}
.tli .who .ttl{font-weight:400; color:var(--sub); font-size:12px}
.tli .bd{background:#fff; border:1px solid var(--line); border-radius:9px; padding:9px 11px;
  margin-top:4px; white-space:pre-wrap; word-break:break-word}
.tli.c-log .bd{background:var(--gray-bg); border-color:#e3e8ed; color:var(--sub);
  font-size:12.5px; padding:6px 10px}
.tli.c-post .bd{background:#f4fbf6; border-color:#cdeadb}
.tli .src{font-size:11.5px; color:var(--sub); margin-bottom:3px}
.tli .src a{font-weight:700}
.commentbox{background:#f7f9fb; border:1px solid var(--line); border-radius:10px;
  padding:12px; margin-top:12px}

/* ---------- 写真 ---------- */
.gal{display:grid; grid-template-columns:repeat(auto-fill,minmax(104px,1fr)); gap:9px}
.gal .it{
  border:1px solid var(--line); border-radius:9px; overflow:hidden; background:#fff;
  display:flex; flex-direction:column;
}
.gal .it .ph{
  display:block; width:100%; aspect-ratio:1/1; object-fit:cover; background:var(--gray-bg);
}
.gal .it .noimg{
  display:flex; align-items:center; justify-content:center; text-align:center;
  font-size:11.5px; color:var(--sub); padding:6px; aspect-ratio:1/1; background:var(--gray-bg);
}
.gal .it .cap{padding:5px 7px; font-size:11.5px; color:var(--sub); line-height:1.45}
.gal .it .cap b{color:var(--ink); font-weight:600; display:block; font-size:12px;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.thumbrow{display:flex; gap:6px; flex-wrap:wrap}
.thumbrow a{display:block}
.thumbrow img{width:78px; height:78px; object-fit:cover; border-radius:7px; border:1px solid var(--line)}
.thumbrow .noimg{
  width:78px; height:78px; border-radius:7px; border:1px solid var(--line); background:var(--gray-bg);
  display:flex; align-items:center; justify-content:center; font-size:10.5px; color:var(--sub);
  text-align:center; padding:4px;
}

/* ---------- 工程表（ガント） ---------- */
.gantt{overflow-x:auto; -webkit-overflow-scrolling:touch; border:1px solid var(--line);
       border-radius:var(--radius); background:#fff}
.gantt-in{position:relative}

/* 目盛り: 上段=月、下段=日 */
.g-head{position:relative; height:46px; border-bottom:2px solid #cfd9e4; background:#f7f9fb}
.g-month{position:absolute; top:3px; height:19px; line-height:19px; font-size:11.5px;
  font-weight:700; color:#33465a; padding-left:5px; white-space:nowrap; z-index:2}
.g-day{position:absolute; top:23px; height:23px; font-size:11px; color:var(--sub);
       border-left:1px solid #eef2f6; padding:3px 0 0 3px; overflow:hidden; box-sizing:border-box}
.g-day.wk{border-left-color:#b9c6d4}
.g-day.sun{background:#fdf1f1; color:#b3554d}
.g-day.sat{background:#f1f5fd; color:#4a6c9c}

/* マイルストーンの帯（ラベルが重なるときは段違いに置く） */
.g-msband{position:relative; background:#faf7ff; border-bottom:1px solid #ddd3f2}
.g-ms-lb{position:absolute; height:20px; line-height:20px; font-size:11.5px; color:#4c2ba8;
  font-weight:700; z-index:5; background:#efe8ff; border:1px solid #d3c4f5;
  padding:0 7px; border-radius:10px; white-space:nowrap}
.g-ms-lb:hover{background:#e5daff}

.g-rows{position:relative}
.g-row{position:relative; height:40px; border-bottom:1px solid #eef2f6}
.g-row:nth-child(even){background:#fbfcfe}
.g-row:hover{background:#f4f9ff}
.g-grid{position:absolute; top:0; bottom:0; width:1px; background:#f2f5f8}
.g-grid.wk{background:#dde4ec}
.g-empty{padding:20px 14px; color:var(--sub); font-size:13.5px; position:relative; z-index:6}

.g-today{position:absolute; top:0; bottom:0; width:2px; background:#e04a3f; z-index:4}
.g-today-lb{position:absolute; top:3px; font-size:11px; color:#fff; font-weight:700; z-index:6;
  background:#e04a3f; padding:1px 6px; border-radius:9px; white-space:nowrap}
.g-ms{position:absolute; top:0; bottom:0; width:2px; background:#7a4fd6; z-index:3}

.g-bar{
  position:absolute; top:8px; height:24px; border-radius:5px; color:#fff; font-size:12.5px;
  line-height:24px; padding:0 8px; overflow:hidden; white-space:nowrap; cursor:pointer;
  text-decoration:none; z-index:2; box-shadow:0 1px 2px rgba(16,32,48,.18);
}
.g-bar:hover{text-decoration:none; filter:brightness(1.08)}
.g-bar.done{background:#8d99a6}
.g-bar.run{background:#1f6feb}
.g-bar.late{background:#c8372c}
.g-bar.plan{background:#5f7d9c}
/* 棒が短くて文字が入らないときは、棒の右隣にラベルを出す */
.g-blabel{position:absolute; top:8px; height:24px; line-height:24px; font-size:12.5px;
  color:var(--ink); white-space:nowrap; z-index:2; text-decoration:none}
.g-blabel:hover{text-decoration:underline}
.g-legend{display:flex; flex-wrap:wrap; gap:10px; align-items:center; font-size:12.5px;
  color:var(--sub); margin-top:10px}
.g-legend i{display:inline-block; width:16px; height:10px; border-radius:3px;
  vertical-align:middle; margin-right:4px}

/* ---------- モーダル ---------- */
.modal{
  position:fixed; inset:0; background:rgba(14,24,35,.5); z-index:100;
  display:flex; align-items:flex-end; justify-content:center; padding:0;
}
@media(min-width:640px){ .modal{align-items:center; padding:20px} }
.modal .box{
  background:#fff; border-radius:14px 14px 0 0; width:100%; max-width:620px;
  max-height:92dvh; overflow-y:auto; padding:16px; box-shadow:0 8px 40px rgba(0,0,0,.3);
}
@media(min-width:640px){ .modal .box{border-radius:14px} }
.modal .box h2{margin-top:0}
.modal .acts{display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap; margin-top:14px}
.modal .acts .btn{flex:1 1 auto}
@media(min-width:640px){ .modal .acts .btn{flex:0 0 auto} }

/* ---------- 通知・エラー ---------- */
/* トーストは画面下端に重なるため、出ている間もその裏のボタンを押せるようにする。
   タップを受けるのは「×」だけ（rev29）。本文は pointer-events:none で背面へ透過。 */
#toasts{position:fixed; left:0; right:0; bottom:0; z-index:200; padding:10px; pointer-events:none}
.toast{
  max-width:620px; margin:0 auto 8px; padding:11px 44px 11px 14px; border-radius:9px;
  font-size:14px; box-shadow:0 4px 20px rgba(0,0,0,.2); word-break:break-word;
  pointer-events:none; position:relative;
}
/* 「×」だけが反応する。指で押しやすい大きさ（44px）を確保する */
.toast .tx{
  position:absolute; top:0; right:0; width:44px; height:100%; min-height:44px;
  display:flex; align-items:center; justify-content:center;
  border:none; background:none; color:inherit; opacity:.65;
  font:inherit; font-size:19px; line-height:1; cursor:pointer;
  pointer-events:auto; border-radius:0 9px 9px 0;
}
.toast .tx:hover{opacity:1; background:rgba(0,0,0,.06)}
.toast.err{background:#fdecea; color:#8a1c15; border:1px solid #f0b7b2}
.toast.ok{background:#e6f4ec; color:#0f5c30; border:1px solid #a8d8bd}
.toast.info{background:#e8f0fe; color:#1a4a9c; border:1px solid #b7cdf3}
#updbar{
  position:fixed; left:0; right:0; top:0; z-index:300; background:#7a5200; color:#fff;
  padding:11px 14px; font-size:14px; text-align:center;
}
#updbar button{margin-left:10px; min-height:32px; padding:5px 12px; border-radius:6px;
  border:0; background:#fff; color:#7a5200; font-weight:700; cursor:pointer}
.devbar{background:#fff4d2; border:1px solid #e8cf8a; color:#6b4a00; border-radius:9px;
  padding:9px 12px; font-size:13px; margin:0 0 12px}
.errbox{background:var(--bad-bg); border:1px solid #f0b7b2; color:#8a1c15;
  border-radius:9px; padding:11px 13px; margin:0 0 12px; font-size:14px}
.loading{padding:22px; text-align:center; color:var(--sub)}

/* ---------- 通知の案内（iPhone のホーム画面追加手順） ---------- */
.iossteps{display:grid; gap:10px; margin-top:10px}
.iostep{display:flex; gap:10px; align-items:flex-start; background:#f7f9fb;
  border:1px solid var(--line); border-radius:9px; padding:10px 12px}
.iostep .n{flex:0 0 26px; height:26px; border-radius:50%; background:var(--accent);
  color:#fff; font-weight:700; font-size:13px; display:flex; align-items:center;
  justify-content:center}
.iostep .fig{font-size:12.5px; color:var(--sub); margin-top:3px; display:flex;
  align-items:center; gap:6px; flex-wrap:wrap}
.iostep .ic{display:inline-flex; align-items:center; justify-content:center;
  width:26px; height:26px; border:1px solid var(--line); border-radius:6px; background:#fff}
.appicon{width:22px; height:22px; border-radius:5px; vertical-align:middle}

/* ---------- ログイン ---------- */
.loginwrap{max-width:420px; margin:0 auto; padding:34px 16px}
.loginwrap .card{padding:20px}
.step{display:none}
.step.on{display:block}

/* ---------- 印刷・細部 ---------- */
.linkrow{display:flex; flex-wrap:wrap; gap:6px}
.linkrow a{font-size:12.5px; background:var(--gray-bg); border-radius:7px; padding:5px 9px;
  color:var(--sub); min-height:32px; display:inline-flex; align-items:center}
.linkrow a:hover{background:#e2e7ec; text-decoration:none}
ul.plain{list-style:none; margin:0; padding:0}
ul.plain li{padding:9px 0; border-bottom:1px solid var(--line)}
ul.plain li:last-child{border-bottom:0}
.kv{display:grid; grid-template-columns:auto 1fr; gap:4px 12px; font-size:13.5px}
.kv dt{color:var(--sub); font-weight:600; white-space:nowrap}
.kv dd{margin:0}
hr{border:0; border-top:1px solid var(--line); margin:14px 0}
code{background:var(--gray-bg); padding:1px 5px; border-radius:4px; font-size:13px}

/* ---------- 概況（ゴール・今の焦点・フェーズ） ---------- */
.ov .lbl{
  display:inline-block; font-size:11.5px; font-weight:700; color:var(--sub);
  background:var(--gray-bg); border-radius:4px; padding:2px 7px; margin-right:8px;
}
.ov-goal{margin-top:12px}
.ov-goal .val{font-size:17px; font-weight:700}
.ov-focus{
  margin-top:10px; padding:10px 12px; border-radius:8px;
  background:#fffbef; border:1px solid #f0e0b6;
}
.ov-focus .val{font-weight:700}
.ov-focus .small{display:block; margin-top:4px}
.ov-phase{margin-top:14px}
.phases{list-style:none; margin:6px 0 0; padding:0; display:flex; flex-wrap:wrap; gap:6px}
.phases .ph{
  display:inline-flex; align-items:center; gap:6px; font-size:12.5px;
  border:1px solid var(--line); border-radius:16px; padding:5px 11px; background:#fff;
}
.phases .dot{width:9px; height:9px; border-radius:50%; background:#d3dae1; flex:none}
.phases .st{font-size:11px; color:var(--sub)}
.phases .done .dot{background:#2f9e5e}
.phases .done .nm{color:var(--sub)}
.phases .now{border-color:#8bb6ec; background:#f2f7ff}
.phases .now .dot{background:#4a8fe0}
.phases .now .nm{font-weight:700}
@media (max-width:420px){
  .phases{flex-direction:column; align-items:stretch}
  .phases .ph{justify-content:space-between}
}

/* ==========================================================================
   タスク実行ページ（shinro_app の mission.html から移植）
   配色は bulkfoods の変数体系（--accent / --ok / --warn / --bad …）に読み替えてある。
   ========================================================================== */
.stbtn{font:inherit;font-size:13px;padding:5px 14px;border:1px solid var(--line);background:#fff;color:var(--sub);border-radius:16px;cursor:pointer;margin-right:6px}
.stbtn:hover:not(:disabled){border-color:var(--accent);color:var(--accent-d)}
.stbtn:disabled{opacity:.55;cursor:not-allowed}
.stbtn.on{border-color:transparent;font-weight:600}
.stbtn.on[data-s="未着手"]{background:var(--gray-bg);color:var(--gray)}
.stbtn.on[data-s="対応中"]{background:var(--warn-bg);color:var(--warn)}
.stbtn.on[data-s="提出済み"]{background:#efe7fb;color:#6b3fb0}
.stbtn.on[data-s="完了"]{background:var(--ok-bg);color:var(--ok)}
.stbtn.on[data-s="取り下げ"]{background:var(--gray-bg);color:var(--sub)}
.head{display:grid;grid-template-columns:110px 1fr;gap:8px 14px;align-items:center;font-size:13px}
.head .k{color:var(--sub);font-size:12px}
.steps{counter-reset:st;padding:0;margin:0;list-style:none}
.steps li{counter-increment:st;position:relative;padding:8px 0 8px 34px;border-bottom:1px dotted var(--line);font-size:13px}
.steps li:last-child{border-bottom:none}
.steps li::before{content:counter(st);position:absolute;left:0;top:7px;width:22px;height:22px;border-radius:50%;
  background:var(--accent);color:#fff;font-size:12px;font-weight:600;display:flex;align-items:center;justify-content:center}
.chk li{display:flex;align-items:flex-start;gap:9px;padding:8px 0;border-bottom:1px dotted var(--line);font-size:13px}
.chk li:last-child{border-bottom:none}
.chk input{width:17px;height:17px;margin:1px 0 0;flex:none}
.chk .who{font-size:11px;color:var(--sub);margin-left:auto;white-space:nowrap}
.chk li.done span.t{color:var(--sub);text-decoration:line-through}
/* 操作の結果は押したボタンのすぐ下に出す。ページ上部のflashだけだと、
   下のフォームを操作している人の視界に入らない。 */
.actmsg{margin-top:10px;padding:10px 14px;border-radius:10px;font-size:13px;font-weight:600;line-height:1.6}
.actmsg.ok{background:var(--ok-bg);color:var(--ok);border:1px solid #b6dfc6}
.actmsg.ng{background:#fdecec;color:var(--bad);border:1px solid #f0bcbc}
.actmsg .sub{display:block;font-weight:400;font-size:12px;margin-top:3px;opacity:.85}
.act{border:2px solid var(--accent);border-radius:12px;padding:18px 20px;margin-bottom:14px;background:var(--panel)}
.act h3{margin:0 0 10px;font-size:15px;color:var(--accent-d);display:flex;align-items:center;gap:8px}
.act h3 .ic{font-size:19px}
.act .btn{font-size:15px;padding:11px 22px}
.act input[type=file]{font:inherit;font-size:14px;padding:9px;border:2px dashed var(--accent);
  border-radius:10px;background:#f8fafc;cursor:pointer;max-width:100%}
.act .how{background:#fff8e6;border:1px solid #e7d493;border-radius:8px;padding:9px 12px;
  font-size:12px;color:#6b4a00;margin-bottom:10px}
.doguide{background:var(--ok-bg);border:1px solid #b9dcc6;border-radius:12px;padding:12px 16px;
  font-size:13px;color:var(--ok);font-weight:600;margin-bottom:12px}
.waitbar{background:var(--bad-bg);border:1px solid #f0bcc8;border-radius:12px;padding:12px 16px;
  font-size:13px;color:var(--bad);margin-bottom:14px}
.remand{background:var(--warn-bg);border:2px solid #e0c56a;border-radius:12px;padding:14px 18px;
  font-size:13px;color:#6b4a00;margin-bottom:14px}
/* 確認の画面であることの目印。見出しと一覧の動線で同じ緑を使う */
.vflag{display:inline-block;background:var(--ok);color:#fff;font-size:13px;font-weight:600;
  border-radius:8px;padding:2px 10px;margin-right:10px;vertical-align:middle}
/* 提出済みの元タスク側から、確認画面へ迷わず行けるようにする */
.waitverify{border:2px solid var(--ok);background:#f6fbf8;border-radius:12px;padding:14px 18px;
  margin-bottom:14px;font-size:13px;display:flex;gap:14px;align-items:center;flex-wrap:wrap}
.waitverify .btn{white-space:nowrap}
.vbox{border:2px solid var(--ok);border-radius:12px;padding:18px 20px;margin-bottom:14px;background:#f6fbf8}
.vbox h3{margin:0 0 10px;font-size:15px;color:var(--ok)}
.vbox .sub{border:1px solid var(--line);background:#fff;border-radius:10px;padding:12px 14px;margin-bottom:12px}
.vbox textarea{width:100%;min-height:70px;font:inherit;font-size:13px;padding:8px 10px;
  border:1px solid var(--line);border-radius:8px}
.vbox .btn{font-size:15px;padding:11px 22px}
.rel{font-size:12px;margin-top:4px}
.rel a{color:var(--accent);text-decoration:none;border-bottom:1px dotted var(--accent)}
/* 終わった相手は、まだ終わっていない相手より目立たせない */
.rel a.donelink{color:var(--sub);border-bottom-color:var(--line)}
.donefold{display:inline-block;vertical-align:top}
.donefold summary{cursor:pointer;color:var(--sub);font-size:11px;list-style:none}
.donefold summary::-webkit-details-marker{display:none}
.donefold summary::before{content:'▸ ';font-size:10px}
.donefold[open] summary::before{content:'▾ '}
.donefold summary:hover{color:var(--accent)}
.act textarea{width:100%;min-height:90px;font:inherit;font-size:13px;padding:8px 10px;border:1px solid var(--line);border-radius:8px}
.act .q{background:#f8fafc;border:1px solid var(--line);border-radius:8px;padding:8px 11px;font-size:12px;margin-bottom:8px}
.ans{border-left:3px solid var(--accent);padding:8px 0 8px 12px;margin-top:10px;font-size:13px}
/* タスクのやり取り（コメント）。
   経過履歴と並ぶので、ひと目で別物と分かるよう吹き出し寄りの見た目にしている。 */
.talkitem{border:1px solid var(--line);border-radius:10px;padding:10px 13px;margin-bottom:9px;
  background:#fff;font-size:13px}
.talkitem.mine{background:#f2f8ff;border-color:#cfe2f7}
.talkitem .hd{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px;margin-bottom:5px;font-size:12px}
.talkitem .hd b{font-size:13px}
.talkitem .hd .org{color:#8b98a5;font-size:11.5px}
.talkitem .hd .when{color:var(--gray);font-size:11.5px}
.talkitem .hd .to{background:var(--accent);color:#fff;border-radius:10px;padding:1px 9px;font-size:11px}
.talkform{margin-top:14px;border-top:1px dashed var(--line);padding-top:14px}
.talkform textarea{width:100%;min-height:80px;font:inherit;font-size:13px;padding:8px 10px;
  border:1px solid var(--line);border-radius:8px}
.talkform .towrap{margin-top:9px}
.talkform .tolist{display:flex;flex-wrap:wrap;gap:6px;margin:5px 0}
.talkform .tochk{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;
  border:1px solid var(--line);border-radius:16px;padding:5px 12px;background:#fff;cursor:pointer}
.talkform .tochk:has(input:checked){border-color:var(--accent);background:#eaf3fd;color:var(--accent-d)}
.talkform .tochk input{width:15px;height:15px;margin:0}
.linkbtn{display:inline-block;margin:0 8px 8px 0;padding:8px 14px;border:1px solid var(--accent);border-radius:8px;
  color:var(--accent-d);text-decoration:none;font-size:13px;font-weight:600;background:#fff}
.linkbtn:hover{background:#f0f3f7}

/* ==========================================================================
   画像のサムネイルとライトボックス
   原本は変換しない。一覧に出すのはブラウザ側で作った縮小画像か、
   原本を CSS で縮めたもの（object-fit: cover）。
   ========================================================================== */
.thumb{
  display:inline-flex; align-items:center; justify-content:center;
  width:56px; height:56px; padding:0; flex:none;
  border:1px solid var(--line); border-radius:8px; background:#fff;
  overflow:hidden; cursor:zoom-in;
}
.thumb:hover{border-color:var(--accent)}
.thumb img{width:100%; height:100%; object-fit:cover; display:block}
.thumb.noimg{
  flex-direction:column; gap:1px; cursor:pointer;
  background:var(--gray-bg); color:var(--sub); border-style:dashed;
}
.thumb.noimg .ic{font-size:17px; line-height:1}
.thumb.noimg .tx{font-size:8.5px; line-height:1.15; text-align:center}

/* 一覧の「画像」列。行が縦に伸びすぎないようにする */
td.thumbcell{width:70px; padding-top:6px; padding-bottom:6px}

/* ---------- ライトボックス ---------- */
body.lb-open{overflow:hidden}          /* 背面がスクロールしないように */
.lightbox{
  position:fixed; inset:0; z-index:1000;
  background:rgba(12,18,26,.94);
  display:flex; flex-direction:column;
}
.lightbox .lb-bar{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 12px; background:rgba(0,0,0,.35); color:#fff;
  /* iPhone のノッチ・ホームバーを避ける */
  padding-top:calc(10px + env(safe-area-inset-top));
  flex:none;
}
.lightbox .lb-name{
  font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  min-width:0;
}
.lightbox .lb-acts{display:flex; gap:8px; flex:none}
.lightbox .lb-body{
  flex:1; min-height:0; display:flex; align-items:center; justify-content:center;
  padding:10px; padding-bottom:calc(10px + env(safe-area-inset-bottom));
  overflow:auto;
}
.lightbox .lb-body img{
  max-width:100%; max-height:100%; object-fit:contain;
  border-radius:6px; background:#fff;
}
.lightbox .lb-noimg{
  color:#e8eef4; font-size:14px; line-height:1.9; text-align:center;
  background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.18);
  border-radius:10px; padding:22px 20px; max-width:min(520px, 92vw);
}
@media (max-width:420px){
  .thumb{width:48px; height:48px}
  td.thumbcell{width:60px}
  .lightbox .lb-name{font-size:12px}
}

/* 見た目はリンク、実体はボタン（画面遷移させたくないもの） */
.linklike{
  border:0; background:none; padding:0; font:inherit; color:var(--accent);
  cursor:pointer; text-align:left;
}
.linklike:hover{text-decoration:underline}

/* チャットの添付画像。見た目は従来どおりで、押すとライトボックスが開く */
.atts .imgbtn{
  border:0; padding:0; background:none; cursor:zoom-in; display:inline-block; line-height:0;
}
.atts .imgbtn img{border-radius:8px; max-width:180px; max-height:180px; object-fit:cover}
.atts button.fl{
  border:1px solid var(--line); background:#fff; font:inherit; font-size:12.5px;
  cursor:pointer; text-align:left;
}
