/* ==========================================================================
   kitasando_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)}

/* ---------- 表のカード化（スマホ幅） ----------
   列が多い表は幅375pxでは1列あたり1〜4文字まで潰れ、長文の列が読めなくなる。
   700px 以下では「1行＝1カード」の縦積みに切り替える（PC幅は表のまま）。
   印（data-label / main / long / acts / empty）は app.js の cardifyTables() が付ける */
@media (max-width:700px){
  /* 表として横スクロールさせる必要が無くなるので、枠の食い込みも戻す */
  .tablewrap.cardtwrap{overflow-x:visible; margin:0; padding:0}

  table.cardt, table.cardt tbody, table.cardt td{display:block; width:auto}
  table.cardt thead{display:none}
  table.cardt{font-size:14px}

  table.cardt tbody tr{
    display:flex; flex-direction:column; min-width:0;
    border:1px solid var(--line); border-radius:var(--radius); background:#fff;
    padding:11px 12px; margin:0 0 10px;
  }
  table.cardt tbody tr:last-child{margin-bottom:0}
  table.cardt tbody tr:hover{background:#fff}
  table.cardt tbody tr.over{background:#fdf2f1; border-color:#f0b7b2}

  table.cardt td{
    border:0; padding:2px 0; min-width:0; vertical-align:top;
    font-size:13.5px; line-height:1.6;
  }
  /* 折り返さない指定だけを解く。改行を保つ .pre はそのまま（本文の改行が消えるため） */
  table.cardt td.nowrap{white-space:normal}
  table.cardt td.num{text-align:left}
  /* 行全体タップの最小高さは、セルごとではなくカード全体で確保する */
  table.cardt tr.rowlink td{min-height:0}

  /* メタ情報（日付・記録者など）は列名を小さく前置きして1行にまとめる */
  table.cardt td[data-label]::before{
    content:attr(data-label) '：'; color:var(--sub); font-size:11.5px; font-weight:600;
  }
  /* 長文は列名を上に置き、値は全幅で折り返す */
  table.cardt td.long{padding:5px 0 2px}
  table.cardt td.long::before{content:attr(data-label); display:block; line-height:1.5}
  table.cardt td.long{word-break:break-word}

  /* 主情報はカードの先頭に大きく太く（列名は付けない） */
  table.cardt td.main{
    order:-1; font-size:15px; font-weight:600; line-height:1.5;
    padding:0 0 4px; word-break:break-word;
  }
  table.cardt td.main::before{content:none}

  /* 値が空の列はカードに行を作らない */
  table.cardt td.empty{display:none}

  /* 操作ボタンはカードの一番下にまとめる */
  table.cardt td.acts{
    order:99; display:flex; gap:7px; flex-wrap:wrap; margin-top:9px; padding:0;
  }
  table.cardt td.acts::before{content:none}
  table.cardt td.acts:empty{display:none}
}

/* ---------- バッジ・状態 ---------- */
.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:var(--ok-bg); color:var(--ok)}
.b-対象外{background:var(--gray-bg); color:var(--sub)}
.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}
.bar .s-対象外{background:#b5bfc9}
.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}
/* 一覧カードの中の「No＋内容」は縦積みにする。
   カードの幅は 100〜160px しかなく、横並びにすると内容の列が数文字幅まで
   潰れて「1文字ずつ縦に落ちる」状態になるため（表・工程表の .dref は横並びのまま） */
.gal .it .cap .dref{
  display:block; min-height:0; padding:0; margin:6px 0 0; border-radius:0;
}
.gal .it .cap .dref:hover{background:none}
.gal .it .cap .dref:hover .bd{text-decoration:underline}
.gal .it .cap .dref .no{
  display:inline-flex; align-items:center; min-height:26px; margin:0 0 3px;
}
.gal .it .cap .dref .bd{
  /* 全幅で横書きに折り返し、長い説明は3行で省略（全文はライトボックスで読める） */
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3;
  overflow:hidden; width:100%; font-size:12px; line-height:1.5;
}

.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}

/* ---------- ライトボックス（画像を画面の中で開く） ----------
   画像を別タブで開くと、スマホでは閉じる手段がブラウザバックしかなくなる。
   同じ画面に重ねて出し、✕ボタン・背景タップ・Esc・戻る のどれでも閉じられるようにする */
#lb{
  position:fixed; inset:0; z-index:400; background:rgba(0,0,0,.93);
  display:flex; flex-direction:column;
}
#lb.hide{display:none}
#lb .lb-bar{display:flex; align-items:center; gap:10px; padding:8px 10px; flex:0 0 auto}
#lb .lb-pos{color:#cfd9e4; font-size:13px; font-variant-numeric:tabular-nums}
#lb .lb-x{
  margin-left:auto; min-height:var(--tap); min-width:var(--tap); padding:8px 15px;
  border:0; border-radius:9px; background:rgba(255,255,255,.18); color:#fff;
  font-size:15px; font-family:inherit; font-weight:600; cursor:pointer;
}
#lb .lb-x:hover{background:rgba(255,255,255,.3)}
#lb .lb-stage{
  flex:1; min-height:0; position:relative;
  display:flex; align-items:center; justify-content:center; padding:0 4px;
}
#lb .lb-stage img{max-width:100%; max-height:100%; object-fit:contain; display:block}
#lb .lb-nav{
  position:absolute; top:50%; transform:translateY(-50%);
  min-width:var(--tap); min-height:var(--tap); border:0; border-radius:50%;
  background:rgba(255,255,255,.2); color:#fff; font-size:20px; line-height:1;
  font-family:inherit; cursor:pointer;
}
#lb .lb-nav:hover{background:rgba(255,255,255,.34)}
#lb .lb-nav.prev{left:6px}
#lb .lb-nav.next{right:6px}
#lb .lb-nav[disabled]{opacity:.2; cursor:default}
#lb .lb-meta{
  flex:0 0 auto; color:#e8eef4; background:rgba(0,0,0,.5);
  padding:10px 12px 14px; font-size:13px; line-height:1.6;
  max-height:40dvh; overflow-y:auto;
}
#lb .lb-meta .fn{font-weight:700; word-break:break-all}
#lb .lb-meta .sub{color:#a9c0d8; font-size:12.5px}
#lb .lb-meta .desc{margin-top:5px; white-space:pre-wrap; word-break:break-word}
#lb .lb-meta a{color:#8fc0ff}
#lb .lb-meta .dno{
  display:inline-flex; align-items:center; min-height:32px; margin-top:6px;
  padding:2px 11px; border-radius:11px;
  background:rgba(143,192,255,.18); color:#8fc0ff; font-weight:700;
}
#lb .lb-meta .acts{display:flex; gap:8px; flex-wrap:wrap; margin-top:8px}
#lb .lb-meta .acts a{
  display:inline-flex; align-items:center; min-height:38px; padding:4px 12px;
  border-radius:8px; background:rgba(255,255,255,.14); color:#fff; font-size:13px;
}
#lb .lb-meta .acts a:hover{background:rgba(255,255,255,.26); text-decoration:none}

/* ---------- モーダル ---------- */
.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} }

/* ---------- 通知・エラー ---------- */
#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 14px; border-radius:9px; font-size:14px;
  box-shadow:0 4px 20px rgba(0,0,0,.2); pointer-events:auto; word-break:break-word;
}
.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}
