:root{
  --primary:#111111; --secondary:#5a5f66; --surface:#ffffff; --bg:#f7f8fa; --bg-inset:#eef0f3; --done-bg:#e3e5e9; --done-line:#8a9099;
  --border:#e6e8eb; --border-strong:#d7dbe0;
  --accent:#2b6cb0; --accent-bg:#eaf1fa; --accent-ink:#184e87;
  --ok:#2f855a; --ok-bg:#e6f4ec;
  --warn:#8a5a12; --warn-bg:#fbf1e2;
  --error:#b91c1c; --error-bg:#fbe9e9;
  --group-main:#2b6cb0; --group-main-bg:#eaf1fa;
  --group-loan:#8a5a12; --group-loan-bg:#fbf1e2;
  --group-save:#2f855a; --group-save-bg:#e6f4ec;
  --shadow: 0 1px 2px rgba(17,17,17,.04), 0 8px 24px rgba(17,17,17,.06);
  --focus: 0 0 0 3px rgba(43,108,176,.35);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --primary:#f0f1f3; --secondary:#a3aab3; --surface:#1a1d22; --bg:#101216; --bg-inset:#20242a; --done-bg:#2b3038; --done-line:#7d848e;
    --border:#2a2f36; --border-strong:#3a4048;
    --accent:#6fa8dc; --accent-bg:#1c2a38; --accent-ink:#bcdcfb;
    --ok:#5fbf8f; --ok-bg:#123425;
    --warn:#d9a54a; --warn-bg:#3a2c12;
    --error:#e5716a; --error-bg:#3a1616;
    --group-main:#6fa8dc; --group-main-bg:#1c2a38;
    --group-loan:#d9a54a; --group-loan-bg:#3a2c12;
    --group-save:#5fbf8f; --group-save-bg:#123425;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"]{
  --primary:#f0f1f3; --secondary:#a3aab3; --surface:#1a1d22; --bg:#101216; --bg-inset:#20242a; --done-bg:#2b3038; --done-line:#7d848e;
  --border:#2a2f36; --border-strong:#3a4048;
  --accent:#6fa8dc; --accent-bg:#1c2a38; --accent-ink:#bcdcfb;
  --ok:#5fbf8f; --ok-bg:#123425;
  --warn:#d9a54a; --warn-bg:#3a2c12;
  --error:#e5716a; --error-bg:#3a1616;
  --group-main:#6fa8dc; --group-main-bg:#1c2a38;
  --group-loan:#d9a54a; --group-loan-bg:#3a2c12;
  --group-save:#5fbf8f; --group-save-bg:#123425;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
}
*{box-sizing:border-box;}
body{
  margin:0; background:var(--bg); color:var(--primary);
  font-family:'Noto Sans JP','Hiragino Sans',sans-serif; font-size:14px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
}
::selection{background:var(--accent); color:#fff;}
a{color:var(--accent);}
button{font-family:inherit;}
.app{display:flex; min-height:100vh;}

/* ---------- sidebar ---------- */
.sidebar{
  width:216px; flex:none; background:var(--surface); border-right:1px solid var(--border);
  position:sticky; top:0; height:100vh; overflow:hidden;
  transition:width .2s ease;
}
.sidebar.dragging{transition:none;}
.sidebar.collapsed{width:0; border-right-color:transparent;}
.sidebar-inner{
  width:192px; height:100%; display:flex; flex-direction:column; padding:20px 12px; gap:4px; box-sizing:content-box;
}
.sidebar-handle{
  position:fixed; top:0; left:216px; width:20px; margin-left:-3px; height:100vh; z-index:20; cursor:ew-resize;
  display:flex; align-items:center; justify-content:center; touch-action:none; user-select:none;
  transition:left .2s ease;
}
body.sidebar-dragging{user-select:none;}
.sidebar-handle.dragging{transition:none;}
.sidebar-handle.collapsed{left:0;}
.sidebar-handle:hover .sidebar-handle-grip, .sidebar-handle.dragging .sidebar-handle-grip{color:var(--accent); background:var(--accent-bg);}
.sidebar-handle-grip{
  width:14px; height:44px; border-radius:7px; background:var(--bg-inset); color:var(--secondary);
  display:flex; align-items:center; justify-content:center; font-size:.85rem; letter-spacing:-1px;
  box-shadow:0 0 0 1px var(--border);
  transition:width .2s ease, height .2s ease, border-radius .2s ease, background .2s ease, box-shadow .2s ease;
}
/* メニューを非表示にした状態では、取っ手をはっきり分かるアイコンボタンにする */
.sidebar-handle.collapsed .sidebar-handle-grip{
  width:30px; height:30px; border-radius:8px; font-size:1.05rem; letter-spacing:0;
  background:var(--surface); color:var(--primary);
  box-shadow:0 0 0 1px var(--border-strong), 0 2px 6px rgba(0,0,0,.12);
}
.sidebar-handle.collapsed:hover .sidebar-handle-grip{background:var(--accent-bg); color:var(--accent);}
.brand{padding:4px 10px 18px; font-weight:800; font-size:1.05rem; letter-spacing:.01em;}
.brand small{display:block; font-weight:500; color:var(--secondary); font-size:.72rem; margin-top:2px; letter-spacing:.04em;}
.nav-item{
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px;
  color:var(--secondary); font-weight:600; font-size:.92rem; cursor:pointer; border:1px solid transparent;
  background:none; text-align:left; width:100%;
}
.nav-item .ic{width:18px; text-align:center; font-size:1rem;}
.nav-item:hover{background:var(--bg-inset); color:var(--primary);}
.nav-item.active{background:var(--primary); color:var(--surface);}
:root[data-theme="dark"] .nav-item.active, @media (prefers-color-scheme:dark){}
.nav-item.active .ic{filter:none;}
.sidebar-foot{padding:10px; font-size:.72rem; color:var(--secondary); border-top:1px solid var(--border); padding-top:14px; margin-top:14px;}
.user-switcher{margin-top:auto; padding:12px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:6px;}
.user-switcher label{font-size:.68rem; font-weight:700; color:var(--secondary); letter-spacing:.03em;}
.user-switcher select{width:100%;}
.view-switcher{padding:12px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:6px;}
.view-switcher label{font-size:.68rem; font-weight:700; color:var(--secondary); letter-spacing:.03em;}
.view-switcher .btn{width:100%; font-size:.78rem; padding:8px 10px;}
.user-chip{display:flex; align-items:center; gap:8px; font-size:.8rem; font-weight:700;}
.user-avatar{width:22px; height:22px; border-radius:50%; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-size:.7rem; flex:none;}

/* ---------- main ---------- */
.main{flex:1; min-width:0; display:flex; flex-direction:column;}
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:18px 28px; border-bottom:1px solid var(--border); background:var(--surface);
  position:sticky; top:0; z-index:5;
}
.topbar-left{display:flex; align-items:center; gap:14px;}
.topbar h1{font-size:1.15rem; margin:0; font-weight:800; text-wrap:balance;}
.topbar .sub{color:var(--secondary); font-size:.82rem; margin-top:2px;}
.topbar-actions{display:flex; align-items:center; gap:12px; flex-wrap:wrap; justify-content:flex-end;}
/* 上部が混み合っても、ボタンの文字は折り返さず、行ごと次の段に回す */
.topbar{flex-wrap:wrap;}
.topbar-actions .btn{white-space:nowrap;}
#topbarRight{flex:1 1 auto; display:flex; justify-content:flex-end; min-width:0;}
.sidebar-toggle{
  flex:none; display:flex; align-items:center; gap:7px; padding:8px 14px;
  border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--primary);
  font-size:.85rem; font-weight:700; cursor:pointer;
}
.sidebar-toggle:hover{background:var(--bg-inset);}
.sidebar-toggle .ic{font-size:1rem;}
.tabs{display:flex; gap:6px; background:var(--bg-inset); padding:4px; border-radius:10px;}
.tab{
  padding:7px 16px; border-radius:8px; border:none; background:none; cursor:pointer;
  font-weight:700; font-size:.86rem; color:var(--secondary);
}
.tab.active{background:var(--surface); color:var(--primary); box-shadow:var(--shadow);}
.content{padding:24px 28px 60px; overflow-x:auto;}

.pill-select{display:flex; gap:6px; flex-wrap:wrap;}
.month-pill{
  padding:6px 12px; border-radius:999px; border:1px solid var(--border-strong); background:var(--surface);
  font-size:.8rem; font-weight:700; color:var(--secondary); cursor:pointer;
}
.month-pill.active{background:var(--primary); color:var(--surface); border-color:var(--primary);}

/* ---------- badges ---------- */
.badge{display:inline-flex; align-items:center; gap:4px; padding:2px 10px; border-radius:999px; font-size:.74rem; font-weight:700; white-space:nowrap;}
.badge.auto{background:var(--accent-bg); color:var(--accent-ink);}
.badge.ok{background:var(--ok-bg); color:var(--ok);}
.badge.warn{background:var(--warn-bg); color:var(--warn);}
.badge.error{background:var(--error-bg); color:var(--error);}
.badge.neutral{background:var(--bg-inset); color:var(--secondary);}

/* ---------- board ---------- */
.board-wrap{display:flex; gap:14px; align-items:flex-start;}
.col{
  flex:0 0 250px; background:var(--bg-inset); border-radius:14px; padding:10px; max-height:calc(100vh - 220px); display:flex; flex-direction:column;
}
.col-head{display:flex; align-items:center; justify-content:space-between; padding:6px 6px 10px;}
.col-title{font-weight:700; font-size:.86rem;}
.col-count{font-size:.72rem; color:var(--secondary); background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:1px 8px;}
.col-body{display:flex; flex-direction:column; gap:8px; overflow-y:auto; padding-bottom:4px;}
/* 振込予約済みのカードに上長が付ける OK ボタン */
.ok-btn{font:inherit; font-size:.72rem; font-weight:700; padding:3px 10px; border-radius:999px; border:1px solid var(--ok); background:var(--surface); color:var(--ok); cursor:pointer;}
.ok-btn:hover{background:var(--ok-bg);}
.ok-btn:disabled{opacity:.5; cursor:wait;}
/* 承認済みの列：支払元銀行ごとの枠（振込を銀行ごとにまとめて行うため） */
.bank-group{display:flex; flex-direction:column; gap:6px; border:1px dashed var(--border-strong); border-radius:10px; padding:6px; background:var(--surface);}
.bank-group.drag-over, .col-banks .col-body.drag-over .bank-group:hover{border-style:solid; border-color:var(--accent);}
.bank-head{display:flex; justify-content:space-between; align-items:baseline; gap:6px; font-size:.76rem; font-weight:700; padding:2px 4px;}
.bank-sum{font-weight:600; color:var(--secondary); font-variant-numeric:tabular-nums;}
.card{
  position:relative; background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:12px 13px;
  cursor:grab; box-shadow:var(--shadow); transition:transform .12s ease, border-color .12s ease, opacity .12s ease;
}
.card.has-unread{border-color:var(--error);}
.unread-dot{
  position:absolute; top:-6px; right:-6px; width:13px; height:13px; border-radius:50%;
  background:var(--error); box-shadow:0 0 0 3px var(--surface); animation:unread-pulse 1.6s ease-in-out infinite;
}
@keyframes unread-pulse{0%,100%{transform:scale(1); opacity:1;} 50%{transform:scale(1.3); opacity:.7;}}
@media (prefers-reduced-motion: reduce){ .unread-dot{animation:none;} }
.card:hover{border-color:var(--accent); transform:translateY(-1px);}
.card:focus-visible{outline:none; box-shadow:var(--focus);}
.card.dragging{opacity:.4; cursor:grabbing;}
.col-body.drag-over{background:var(--accent-bg); outline:2px dashed var(--accent); outline-offset:-4px; border-radius:10px;}
.card-title-row{display:flex; align-items:flex-start; justify-content:space-between; gap:6px; margin-bottom:6px;}
.card-title{font-weight:700; font-size:.85rem; word-break:break-word;}
.comment-flag{
  flex:none; display:inline-flex; align-items:center; gap:3px; padding:2px 7px; border-radius:999px;
  background:var(--warn-bg); color:var(--warn); font-size:.7rem; font-weight:700; white-space:nowrap;
}
.comment-flag.new{background:var(--error-bg); color:var(--error);}
.card-meta{font-size:.74rem; color:var(--secondary); display:flex; flex-wrap:wrap; gap:5px; align-items:center;}
.card-amount{font-variant-numeric:tabular-nums; font-weight:700;}
.neg{color:var(--error);}
.pos{color:var(--ok);}

/* ---------- drawer ---------- */
.scrim{position:fixed; inset:0; background:rgba(10,12,15,.36); opacity:0; pointer-events:none; transition:opacity .15s ease; z-index:20;}
.scrim.open{opacity:1; pointer-events:auto;}
.drawer{
  position:fixed; top:0; right:0; height:100vh; width:min(420px,92vw); background:var(--surface);
  border-left:1px solid var(--border); box-shadow:-12px 0 32px rgba(0,0,0,.14);
  transform:translateX(100%); transition:transform .18s ease; z-index:21; display:flex; flex-direction:column;
}
.drawer.open{transform:translateX(0);}
.drawer-head{padding:20px 22px 14px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; gap:10px;}
.drawer-head h2{font-size:1.02rem; margin:0 0 4px; text-wrap:balance;}
.drawer-close{background:none; border:none; color:var(--secondary); font-size:1.2rem; cursor:pointer; line-height:1; padding:4px;}
.drawer-body{padding:18px 22px; overflow-y:auto; flex:1; display:flex; flex-direction:column; gap:16px;}
.dl{display:grid; grid-template-columns:112px 1fr; gap:8px 12px; font-size:.85rem;}
.dl dt{color:var(--secondary);}
.dl dd{margin:0; font-variant-numeric:tabular-nums;}
.je-box{background:var(--bg-inset); border-radius:10px; padding:12px 14px; font-size:.82rem; line-height:1.7;}
.comments{display:flex; flex-direction:column; gap:10px;}
.comments h3{font-size:.82rem; margin:0; display:flex; align-items:center; gap:6px;}
.comment-list{display:flex; flex-direction:column; gap:8px; max-height:220px; overflow-y:auto;}
.comment-item{background:var(--bg-inset); border-radius:10px; padding:9px 12px; border-left:3px solid transparent;}
.comment-item.new{border-left-color:var(--error); background:var(--error-bg);}
.comment-item .c-new-tag{background:var(--error); color:#fff; font-size:.62rem; font-weight:700; padding:1px 6px; border-radius:999px; letter-spacing:.03em;}
.comment-item .c-head{display:flex; justify-content:space-between; align-items:center; margin-bottom:3px;}
.comment-item .c-author{font-size:.76rem; font-weight:700;}
.comment-item .c-time{font-size:.7rem; color:var(--secondary);}
.comment-item .c-text{font-size:.82rem; line-height:1.55; white-space:pre-wrap; word-break:break-word;}
.comment-empty{font-size:.8rem; color:var(--secondary); padding:6px 2px;}
.history{display:flex; flex-direction:column; gap:8px;}
.history h3{font-size:.82rem; margin:0;}
.history-list{display:flex; flex-direction:column; gap:0; max-height:220px; overflow-y:auto;}
.history-item{display:flex; gap:10px; padding:8px 2px; border-bottom:1px solid var(--border);}
.history-item:last-child{border-bottom:none;}
.history-dot{flex:none; width:8px; height:8px; border-radius:50%; background:var(--accent); margin-top:6px;}
.history-item .h-user{font-weight:700; font-size:.8rem;}
.history-item .h-time{font-size:.7rem; color:var(--secondary); margin-left:6px;}
.history-item .h-move{font-size:.78rem; color:var(--secondary); margin-top:2px;}
.history-item .h-move b{color:var(--primary); font-weight:600;}
.comment-form{display:flex; flex-direction:column; gap:8px;}
.comment-form textarea{
  font-family:inherit; font-size:.84rem; padding:9px 11px; border-radius:8px; border:1px solid var(--border-strong);
  background:var(--surface); color:var(--primary); resize:vertical; min-height:56px;
}
.comment-form textarea:focus{outline:none; box-shadow:var(--focus); border-color:var(--accent);}
.comment-form-row{display:flex; gap:8px; align-items:center;}
.comment-form-row select{width:auto; flex:none;}
.comment-form-row .btn{flex:none; margin-left:auto;}
.doc-viewer{background:var(--bg-inset); border-radius:12px; padding:14px; display:flex; flex-direction:column; gap:8px;}
.doc-viewer .dv-label{font-size:.76rem; font-weight:700; color:var(--secondary); display:flex; justify-content:space-between; align-items:center;}
.doc-thumb{background:var(--surface); border:1px solid var(--border-strong); border-radius:8px; overflow:hidden; cursor:zoom-in; box-shadow:var(--shadow); display:flex; justify-content:center;}
.doc-thumb svg, .doc-thumb img{display:block; width:100%; height:auto; max-height:260px; object-fit:contain;}
.doc-thumb iframe{display:block; width:100%; height:260px; border:none; pointer-events:none;}
.doc-viewer .dv-hint{font-size:.72rem; color:var(--secondary);}
.lightbox{position:fixed; inset:0; background:rgba(10,12,15,.8); z-index:200; display:none; align-items:center; justify-content:center; padding:12px 56px 12px 12px; cursor:zoom-out;}
.lightbox.open{display:flex;}
.lightbox svg, .lightbox img{width:min(1400px,94vw); height:auto; max-height:96vh; background:var(--surface); border-radius:10px; box-shadow:0 20px 60px rgba(0,0,0,.4); object-fit:contain;}
@media (max-height:720px){ .lightbox svg, .lightbox img{width:auto; height:96vh; max-width:94vw;} }
/* PDF は画面いっぱいに表示する（さらに拡大・縮小するときは PDF ビューアーの ＋／－） */
.lightbox iframe{width:min(1600px, calc(100vw - 80px)); flex:0 0 auto; height:calc(100vh - 24px); border:none; background:var(--surface); border-radius:10px; box-shadow:0 20px 60px rgba(0,0,0,.4);}
.lightbox .lb-close{position:absolute; top:14px; right:16px; z-index:1; background:none; border:none; color:#fff; font-size:1.6rem; cursor:pointer; line-height:1;}
.upload-modal{
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%) scale(.96); width:min(420px,92vw);
  background:var(--surface); border-radius:14px; box-shadow:0 20px 60px rgba(0,0,0,.35); z-index:41;
  opacity:0; pointer-events:none; transition:opacity .15s ease, transform .15s ease; max-height:88vh; overflow-y:auto;
}
.upload-modal.open{opacity:1; pointer-events:auto; transform:translate(-50%,-50%) scale(1);}
.upload-modal .um-head{padding:18px 20px 6px; display:flex; justify-content:space-between; align-items:flex-start; gap:10px;}
.upload-modal .um-head h2{font-size:1rem; margin:0;}
.upload-modal .um-head p{margin:4px 0 0; font-size:.78rem; color:var(--secondary);}
.upload-modal .um-body{padding:14px 20px 20px; display:flex; flex-direction:column; gap:12px;}
.um-preview{border:1px solid var(--border-strong); border-radius:10px; overflow:hidden; background:var(--bg-inset); display:flex; justify-content:center;}
.um-preview img{max-width:100%; max-height:220px; object-fit:contain; display:block;}
.um-preview iframe{width:100%; height:220px; border:none; display:block;}
.um-field{display:flex; flex-direction:column; gap:4px;}
.um-field label{font-size:.76rem; font-weight:700; color:var(--secondary);}
.drawer-actions{display:flex; flex-direction:column; gap:10px; padding:16px 22px 22px; border-top:1px solid var(--border);}
.field-row{display:flex; align-items:center; gap:10px;}
.field-row label{font-size:.82rem; color:var(--secondary); width:88px; flex:none;}
input[type="date"],input[type="month"],input[type="text"],input[type="number"],select{
  font-family:inherit; font-size:.85rem; padding:7px 10px; border-radius:8px; border:1px solid var(--border-strong);
  background:var(--surface); color:var(--primary); width:100%;
}
input:focus,select:focus{outline:none; box-shadow:var(--focus); border-color:var(--accent);}
.btn{
  border:none; border-radius:9px; padding:9px 16px; font-weight:700; font-size:.85rem; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
}
.btn-primary{background:var(--primary); color:var(--surface);}
.btn-primary:hover{opacity:.88;}
.btn-outline{background:none; border:1px solid var(--border-strong); color:var(--primary);}
.btn-outline:hover{background:var(--bg-inset);}
.btn-ghost{background:none; border:none; color:var(--accent); font-weight:700; padding:6px 4px;}
.btn:disabled{opacity:.4; cursor:not-allowed;}
.check-row{display:flex; align-items:center; gap:10px; padding:12px 14px; border:1px solid var(--border-strong); border-radius:10px; background:var(--bg-inset);}
.check-row input{width:auto;}

/* ---------- ledger ---------- */
.final-check{display:flex; align-items:center; gap:10px; margin-bottom:18px; padding:12px 16px; border:1px solid var(--border-strong); border-radius:12px; background:var(--surface); box-shadow:var(--shadow); max-width:420px;}
.final-check strong{font-size:.86rem;}
.final-check span{font-size:.76rem; color:var(--secondary);}
.ledger-scroll{overflow-x:auto; border:1px solid var(--border); border-radius:14px; background:var(--surface); box-shadow:var(--shadow);}
table.ledger{border-collapse:separate; border-spacing:0; width:100%; font-size:.82rem; min-width:1180px;}
table.ledger th, table.ledger td{padding:9px 12px; white-space:nowrap;}
table.ledger thead tr.acct th{font-size:.76rem; font-weight:700; text-align:center; border-bottom:1px solid var(--border-strong); background:var(--bg-inset);}
table.ledger thead tr.fieldrow th{font-size:.72rem; color:var(--secondary); font-weight:700; text-align:right; border-bottom:1px solid var(--border-strong); background:var(--bg-inset); padding-top:6px; padding-bottom:10px;}
table.ledger thead tr.fieldrow th.lbl{text-align:left;}
table.ledger tbody th{background:var(--surface); text-align:left; font-weight:600;}
table.ledger tbody tr.opening td, table.ledger tbody tr.opening th{background:var(--bg-inset); font-weight:700; color:var(--primary);}
table.ledger tbody tr:not(:last-child) td, table.ledger tbody tr:not(:last-child) th{border-bottom:1px solid var(--border);}
table.ledger td.num, table.ledger th.num{font-variant-numeric:tabular-nums; text-align:right;}
/* 数字は濃く・太めに（2026-10-29「数字が薄い」）。残高は黒、収支は赤・緑で太字 */
table.ledger td.num{font-size:.9rem; font-weight:600; color:var(--primary);}
table.ledger td.num .neg, table.ledger td.num .pos{font-weight:700;}
table.ledger td.bal{color:var(--primary);}
table.ledger .total-col-header{background:var(--bg-inset); border-right:2px solid var(--border-strong);}
/* 表の見出し（口座名・列名）は固定し、明細だけを表の枠の中でスクロールする（2026-10-29）。枠の高さは app.js の fitLedger で画面に合わせる */
.ledger-scroll.fit{overflow:auto; overscroll-behavior:contain;}
table.ledger thead{position:sticky; top:0; z-index:3;}
table.ledger thead th.total-col-header{position:sticky; left:0; z-index:4;}
table.ledger td.total-col{
  position:sticky; left:0; z-index:1;
  font-weight:700; color:var(--primary); background:var(--bg-inset); border-right:2px solid var(--border-strong);
}
/* ファイルを追加 */
.attach-choice{display:flex; flex-direction:column; gap:6px; padding:10px 0; border-bottom:1px solid var(--border);}
.attach-choice label{font-size:.86rem; font-weight:700;}
/* ページを分ける */
.split-grid{display:flex; flex-wrap:wrap; gap:12px;}
.split-page{display:flex; flex-direction:column; align-items:center; gap:6px; padding:8px; border:1px solid var(--border); border-radius:10px; cursor:pointer; background:var(--bg-inset);}
.split-page canvas{background:#fff; box-shadow:var(--shadow); width:180px; min-height:120px;}
.split-page:has(input:checked){border-color:var(--accent); outline:2px solid var(--accent);}
.split-page span{font-size:.82rem; font-weight:700;}
/* PDF.js で描いた請求書（ブラウザが PDF を表示しない設定のパソコン用） */
.pdfjs-view{width:100%; display:flex; flex-direction:column; min-height:0;}
.pdfjs-view.big{height:100%;}
.pdfjs-bar{display:flex; gap:6px; align-items:center; padding:4px 0 6px; flex:0 0 auto;}
.pdfjs-pages{flex:1 1 auto; overflow:auto; display:flex; flex-direction:column; align-items:center; gap:10px; background:var(--bg-inset); border-radius:8px; padding:8px; min-height:0;}
.pdfjs-page{background:#fff; box-shadow:var(--shadow); max-width:none;}
.doc-thumb .pdfjs-view{max-height:260px; overflow:hidden; pointer-events:none;}
.doc-thumb .pdfjs-pages{padding:0; background:var(--surface);}
.lightbox .pdfjs-view{width:min(1600px, calc(100vw - 80px)); height:calc(100vh - 24px); background:var(--surface); border-radius:10px; padding:8px; cursor:default;}
/* 詳細を入力するとき、請求書を画面の左側に大きく表示する（右側は詳細パネル） */
/* 左に請求書を出しているときは、入力欄（詳細パネル）を広くする。境目をドラッグすると幅を変えられる（--split-w） */
body.doc-side-open .drawer{width:var(--split-w, 50vw); max-width:calc(100vw - 320px);}
body.doc-side-open .doc-side{right:min(var(--split-w, 50vw), calc(100vw - 320px));}
.doc-split{position:absolute; top:0; bottom:0; right:-5px; width:10px; cursor:col-resize; z-index:2;}
.doc-split::after{content:''; position:absolute; top:50%; left:3px; width:4px; height:48px; margin-top:-24px; border-radius:4px; background:var(--border-strong);}
.doc-split:hover::after, .doc-split.dragging::after{background:var(--accent);}
body.splitting, body.splitting *{cursor:col-resize !important; user-select:none;}
body.splitting iframe{pointer-events:none;}
.doc-side{position:fixed; top:0; bottom:0; left:0; right:min(520px,96vw); z-index:21; display:none; flex-direction:column; background:var(--bg-inset); border-right:1px solid var(--border-strong); box-shadow:12px 0 32px rgba(0,0,0,.14);}
.doc-side.open{display:flex;}
.doc-side-head{display:flex; justify-content:space-between; align-items:center; gap:10px; padding:10px 14px; font-size:.82rem; font-weight:700; background:var(--surface); border-bottom:1px solid var(--border); min-width:0;}
.doc-side-head > span:first-child{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.doc-side-body{flex:1; min-height:0; display:flex; justify-content:center; align-items:flex-start; overflow:auto; padding:8px;}
.doc-side-body iframe{width:100%; height:100%; border:none; background:var(--surface); border-radius:8px;}
.doc-side-body img{max-width:100%; height:auto; background:var(--surface); border-radius:8px; box-shadow:var(--shadow);}
.doc-viewer-compact .dv-label{flex-wrap:wrap; gap:6px;}
@media (max-width:859px){ .doc-side{display:none !important;} }
/* 案件ボードの検索欄 */
.board-search{display:flex; align-items:center; gap:8px;}
.board-search input{width:min(340px, 46vw); padding:7px 12px; border:1px solid var(--border-strong); border-radius:999px; background:var(--surface); color:var(--primary); font:inherit; font-size:.82rem;}
.board-search input:focus{outline:2px solid var(--accent); outline-offset:1px;}
.board-search .hint{white-space:nowrap;}
/* 承認のときの工事予算との比較 */
.budget-box{border:1px solid var(--border); border-radius:12px; padding:10px 12px; background:var(--surface); display:flex; flex-direction:column; gap:8px;}
.budget-box.over{border-color:var(--error); background:var(--error-bg);}
.budget-proj{display:flex; flex-direction:column; gap:4px;}
.budget-table td, .budget-table th{font-size:.78rem; white-space:nowrap;}
.budget-table td.num{font-variant-numeric:tabular-nums;}
/* 工事別集計：予実 */
.pj-table th.grp-h{text-align:center; border-bottom:1px solid var(--border-strong);}
.pj-table td.num, .pj-table th.num{font-variant-numeric:tabular-nums; white-space:nowrap;}
.pj-kpi{display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:10px; margin:10px 0 4px;}
.pj-kpi > div{border:1px solid var(--border); border-radius:12px; padding:10px 14px; display:flex; flex-direction:column; gap:2px; background:var(--bg-inset);}
.pj-kpi span{font-size:.74rem; color:var(--secondary); font-weight:700;}
.pj-kpi b{font-size:1.15rem; font-variant-numeric:tabular-nums;}
.pj-kpi small{font-size:.74rem; color:var(--secondary); font-variant-numeric:tabular-nums;}
.bg-edit{margin:12px 0; border:1px dashed var(--border-strong); border-radius:12px; padding:10px 14px;}
.bg-edit summary{cursor:pointer; font-weight:700; font-size:.86rem;}
.bg-row{flex-wrap:wrap; gap:6px;}
.bg-row .bg-month-l{width:auto; display:flex; align-items:center; gap:4px; white-space:nowrap;}
/* 月の最終確認（台帳の一番下に小さく） */
.final-check.final-check-sm{display:flex; align-items:center; gap:8px; padding:8px 12px; margin-top:14px; font-size:.8rem; color:var(--secondary); width:fit-content; max-width:100%;}
.final-check.final-check-sm strong{color:var(--primary);}
/* キャッシュフロー：本日時点の残高 */
.today-panel{background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); padding:14px 16px; margin-bottom:14px; display:flex; flex-direction:column; gap:8px;}
.today-head{display:flex; align-items:baseline; gap:12px; flex-wrap:wrap;}
.today-head h2{margin:0; font-size:1rem;}
.today-table th{text-align:left; font-size:.78rem; white-space:nowrap;}
.today-table td.num{font-variant-numeric:tabular-nums; white-space:nowrap;}
.today-table tr.today-actual td{font-size:1.05rem; font-weight:800; color:var(--primary);}
.today-table td.total{border-left:2px solid var(--border-strong);}
.today-table td.muted{color:var(--primary); font-weight:600;}
/* ホーム（トップページ） */
.home-head{display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; margin:18px 0 10px;}
.home-head h2{margin:0; font-size:1.05rem;}
.home-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(340px, 1fr)); gap:14px; align-items:start;}
.home-task{background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); padding:12px 14px; display:flex; flex-direction:column; gap:8px;}
.home-task.tone-error{border-left:5px solid var(--error);}
.home-task.tone-boss{border-left:5px solid var(--accent);}
.ht-head{display:flex; justify-content:space-between; align-items:baseline; gap:8px;}
.ht-head h3{margin:0; font-size:.95rem;}
.ht-count{font-weight:800; font-size:1rem; font-variant-numeric:tabular-nums;}
.ht-list{display:flex; flex-direction:column; gap:4px;}
.home-item{display:grid; grid-template-columns:52px 1fr auto; gap:8px; align-items:center; text-align:left; width:100%; font:inherit; font-size:.82rem; padding:7px 10px; border:1px solid var(--border); border-radius:8px; background:var(--bg); color:var(--primary); cursor:pointer;}
.home-item:hover{border-color:var(--accent); background:var(--accent-bg);}
.home-item.due{border-color:var(--error); background:var(--error-bg);}
.hi-date{font-variant-numeric:tabular-nums; color:var(--secondary); font-size:.76rem;}
.home-item.due .hi-date{color:var(--error); font-weight:700;}
.hi-title{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.hi-amt{font-variant-numeric:tabular-nums; font-weight:700; white-space:nowrap;}
.home-empty{text-align:center; padding:28px; font-size:.95rem;}
/* 日ごとの区切り（日付が変わるところに入れるすき間の行） */
table.ledger tbody tr.day-gap td{height:24px; padding:0; background:var(--bg); border-bottom:1px solid var(--border-strong) !important; box-shadow:none;}
table.ledger tbody tr.day-gap:hover td{background:var(--bg);}
/* 進捗で行の色を分ける（実施＝グレー・確定＝青・予定＝黄）。色だけに頼らないよう、左端にも同じ色の線を引く */
table.ledger tbody tr.prog-done td:not(.total-col), table.ledger tbody tr.prog-done th{background:var(--done-bg); color:var(--primary);}
table.ledger tbody tr.prog-confirmed td:not(.total-col), table.ledger tbody tr.prog-confirmed th{background:var(--accent-bg);}
table.ledger tbody tr.prog-todo td:not(.total-col), table.ledger tbody tr.prog-todo th{background:var(--warn-bg);}
table.ledger tbody tr.prog-done td.total-col{box-shadow:inset 5px 0 0 var(--done-line);}
table.ledger tbody tr.prog-confirmed td.total-col{box-shadow:inset 5px 0 0 var(--accent);}
table.ledger tbody tr.prog-todo td.total-col{box-shadow:inset 5px 0 0 var(--warn);}
.prog-legend{display:flex; gap:8px; align-items:center; flex-wrap:wrap; font-size:.74rem; color:var(--secondary); margin:0 0 8px;}
.prog-key{padding:2px 10px 2px 8px; border-radius:6px; border-left:4px solid; color:var(--primary);}
.prog-key.prog-done{background:var(--done-bg); border-color:var(--done-line);}
.prog-key.prog-confirmed{background:var(--accent-bg); border-color:var(--accent);}
.prog-key.prog-todo{background:var(--warn-bg); border-color:var(--warn);}
.grp-main{background:var(--group-main-bg); color:var(--group-main);}
.grp-loan{background:var(--group-loan-bg); color:var(--group-loan);}
.grp-save{background:var(--group-save-bg); color:var(--group-save);}
.grp-none{background:var(--bg-inset); color:var(--secondary);}
.manual-tag{font-size:.68rem; color:var(--secondary); font-weight:600;}
.recur-tag{font-size:.68rem; color:var(--accent); font-weight:600;}
.ledger-foot{display:flex; justify-content:space-between; align-items:center; margin-top:14px; gap:12px; flex-wrap:wrap;}
.add-row-form{
  display:none; margin-top:14px; padding:16px; border:1px dashed var(--border-strong); border-radius:12px; background:var(--surface);
  grid-template-columns:repeat(6,1fr); gap:10px; align-items:end;
}
.add-row-form.open{display:grid;}
.add-row-form .field{display:flex; flex-direction:column; gap:4px;}
.add-row-form label{font-size:.72rem; color:var(--secondary); font-weight:700;}
.add-row-form .actions{grid-column:1/-1; display:flex; gap:8px; justify-content:flex-end;}
table.ledger tbody tr.editable-row:hover td, table.ledger tbody tr.editable-row:hover th{background:var(--bg-inset);}
.row-edit-btn{
  display:none; margin-left:6px; font-size:.68rem; font-weight:700; color:var(--accent);
  background:none; border:none; cursor:pointer; padding:0;
}
table.ledger tbody tr.editable-row:hover .row-edit-btn{display:inline;}
.mini-btn{
  font-size:.7rem; font-weight:700; padding:4px 10px; border-radius:6px; border:1px solid var(--border-strong);
  background:var(--surface); color:var(--primary); cursor:pointer;
}
.mini-btn.save{background:var(--primary); color:#fff; border-color:var(--primary);}
.mini-btn.danger{color:var(--error); border-color:var(--error);}
.note{background:var(--accent-bg); border-left:3px solid var(--accent); border-radius:8px; padding:10px 14px; font-size:.8rem; color:var(--primary); margin-bottom:18px;}
.note b{color:var(--accent-ink);}
.legend{display:flex; gap:14px; flex-wrap:wrap; margin-bottom:14px; font-size:.76rem; color:var(--secondary);}
.legend span{display:inline-flex; align-items:center; gap:6px;}
.legend i{width:10px; height:10px; border-radius:3px; display:inline-block;}

/* ---------- スマホ表示（実際に狭い画面／手動切り替えの両方でこのクラスが付く） ---------- */
body.compact-board .content{padding:14px 12px;}
body.compact-board .topbar{
  flex-direction:column; align-items:stretch; gap:10px; padding:14px 16px;
}
body.compact-board .topbar-left{justify-content:space-between;}
body.compact-board .topbar-actions{width:100%; flex-wrap:wrap; gap:8px;}
body.compact-board .topbar-actions .btn{flex:1 1 auto; white-space:nowrap;}
body.compact-board .tabs{width:100%;}
body.compact-board .tabs .tab{flex:1; text-align:center;}
body.compact-board .board-wrap{
  overflow-x:auto; scroll-snap-type:x mandatory; -webkit-overflow-scrolling:touch; padding-bottom:8px; gap:10px;
}
body.compact-board .col{
  flex:0 0 86vw; scroll-snap-align:center; max-height:none;
}
body.compact-board .col-body{max-height:calc(100vh - 320px);}
body.compact-board .card{padding:13px 14px;}
body.compact-board .sidebar:not(.collapsed){width:min(78vw,280px);}
body.compact-board .sidebar-inner{width:calc(min(78vw,280px) - 24px);}

/* ===================== 本番版で追加したスタイル ===================== */
@media (max-width:700px){
  .content{padding:14px 12px;}
  .topbar{flex-direction:column; align-items:stretch; gap:10px; padding:14px 16px;}
  .topbar-actions{width:100%; flex-wrap:wrap; gap:8px;}
  .board-wrap{overflow-x:auto; scroll-snap-type:x mandatory; padding-bottom:8px; gap:10px;}
  .col{flex:0 0 86vw; scroll-snap-align:center; max-height:none;}
  .sidebar:not(.collapsed){position:fixed; z-index:30; height:100vh; box-shadow:var(--shadow);}
}
.user-box{margin-top:auto; padding:12px 10px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:8px;}
.user-box .who{font-weight:700; font-size:.86rem;}
.user-box .role{font-size:.72rem; color:var(--secondary);}
.ocr-state{font-size:.72rem; color:var(--secondary); padding:8px 10px;}
.ocr-state b{color:var(--primary);}
.page-note{margin-bottom:16px;}
.warn-note{background:var(--warn-bg); border-left:3px solid var(--warn); border-radius:8px; padding:10px 14px; font-size:.8rem; margin-bottom:14px;}
.error-note{background:var(--error-bg); border-left:3px solid var(--error); border-radius:8px; padding:10px 14px; font-size:.8rem; color:var(--primary);}
.toast{position:fixed; left:50%; bottom:28px; transform:translateX(-50%); background:var(--primary); color:var(--surface); padding:10px 18px;
  border-radius:10px; font-size:.84rem; font-weight:600; z-index:60; box-shadow:0 10px 30px rgba(0,0,0,.25); max-width:90vw;}
.toast.error{background:var(--error); color:#fff;}
.col-empty{font-size:.76rem; color:var(--secondary); padding:6px 8px;}
.drawer{width:min(520px,96vw);}
.form-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px 12px;}
.form-grid .full{grid-column:1/-1;}
.fld{display:flex; flex-direction:column; gap:4px;}
.fld label{font-size:.72rem; font-weight:700; color:var(--secondary);}
.fld .hint{font-size:.7rem; color:var(--secondary);}
.section-title{font-size:.84rem; font-weight:800; margin:0;}
.btn-row{display:flex; gap:8px; flex-wrap:wrap;}
.btn-danger{background:none; border:1px solid var(--error); color:var(--error);}
.diff-table, table.simple{width:100%; border-collapse:collapse; font-size:.8rem;}
.diff-table th, .diff-table td, table.simple th, table.simple td{padding:6px 8px; border-bottom:1px solid var(--border); text-align:left; vertical-align:top;}
table.simple th{font-size:.72rem; color:var(--secondary); background:var(--bg-inset);}
table.simple td.num, table.simple th.num{text-align:right; font-variant-numeric:tabular-nums;}
.panel{background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); padding:18px 20px; margin-bottom:18px;}
.panel h2{font-size:.98rem; margin:0 0 12px;}
.je-table{width:100%; border-collapse:collapse; font-size:.78rem;}
.je-table th, .je-table td{padding:5px 6px; border-bottom:1px solid var(--border); text-align:left; vertical-align:top;}
.je-table th{color:var(--secondary); font-size:.7rem;}
.je-table input, .je-table select{font-size:.76rem; padding:4px 6px;}
.je-table td.num{text-align:right; font-variant-numeric:tabular-nums;}
.modal-back{position:fixed; inset:0; background:rgba(10,12,15,.4); z-index:40; display:flex; align-items:center; justify-content:center; padding:20px;}
.modal{background:var(--surface); border-radius:14px; box-shadow:0 20px 60px rgba(0,0,0,.35); width:min(560px,96vw); max-height:92vh; overflow-y:auto;}
.modal-head{padding:18px 20px 8px; display:flex; justify-content:space-between; align-items:flex-start; gap:10px;}
.modal-head h2{font-size:1rem; margin:0;}
.modal-head p{margin:4px 0 0; font-size:.78rem; color:var(--secondary);}
.modal-body{padding:10px 20px 20px; display:flex; flex-direction:column; gap:12px;}
.card-link{background:none; border:none; padding:0; color:var(--accent); cursor:pointer; font:inherit; text-align:left;}
.case-tag{font-size:.68rem; color:var(--ok); font-weight:700;}
textarea.reason{font-family:inherit; font-size:.82rem; padding:8px 10px; border-radius:8px; border:1px solid var(--border-strong); background:var(--surface); color:var(--primary); width:100%; min-height:48px;}
.login-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px;}
.login-box{background:var(--surface); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow); padding:28px 28px 24px; width:min(380px,94vw); display:flex; flex-direction:column; gap:14px;}
.login-box h1{font-size:1.1rem; margin:0;}
.login-box p{margin:0; font-size:.8rem; color:var(--secondary);}
.login-box[hidden], .login-box [hidden]{display:none;}
.login-box .login-switch{text-align:center;}
.login-box .login-switch a{color:var(--accent, var(--primary)); font-weight:600;}
.ok-note{background:var(--ok-bg); border-left:3px solid var(--ok); border-radius:8px; padding:10px 14px; font-size:.8rem; color:var(--primary);}
.nav-count{margin-left:auto; background:var(--error); color:#fff; border-radius:999px; font-size:.65rem; padding:1px 7px; font-weight:700;}
.month-nav{display:flex; align-items:center; gap:6px;}
.month-nav input{width:auto;}
.hint{font-size:.72rem; color:var(--secondary);}
#toast[hidden]{display:none;}
.nav-item[hidden], .nav-count[hidden]{display:none;}
.user-box .btn-row{display:flex; gap:6px; flex-wrap:wrap;}
.drawer-actions{max-height:46vh; overflow-y:auto;}
/* ページを変更 */
.pg-item{cursor:default;}
.pg-thumb{width:170px; height:170px; display:flex; align-items:center; justify-content:center; overflow:hidden; color:var(--secondary);}
.pg-thumb canvas{background:#fff; box-shadow:var(--shadow); max-width:150px; max-height:150px; object-fit:contain; transition:transform .15s;}
.pg-off{opacity:.45;}
.pg-off .pg-thumb canvas{outline:3px solid var(--error);}
.mini-btn:disabled{opacity:.35; cursor:default;}
/* LINE受付 */
.line-table select[data-vendor]{min-width:150px;}
.line-table select[data-mode]{min-width:260px;}
.line-table input[data-name]{min-width:180px;}
.line-table .mini-btn, .line-table td:first-child{white-space:nowrap;}

/* 資金繰り予測（2026-10-28） */
.fc-table th:first-child{text-align:left; white-space:nowrap;}
.fc-table td{min-width:9em;}
.fc-table .fc-total th,.fc-table .fc-total td{border-top:2px solid var(--border); font-size:1.02rem;}
.fc-month summary{cursor:pointer;}
.fc-month[open] summary{margin-bottom:8px;}

/* 工事別集計：進行中・完了の区分（2026-10-28） */
.pj-table tr.pj-sec th{text-align:left; background:var(--bg-inset); font-size:.86rem; padding-top:10px;}
.pj-table tr.pj-subtotal td{border-top:1px solid var(--border-strong); font-weight:700;}
.pj-table tr.pj-done td:first-child a{color:var(--secondary);}

/* 台帳の行のドラッグ（2026-10-28） */
table.ledger tr[draggable="true"] { cursor: grab; }
table.ledger tr.dragging { opacity: .4; }
table.ledger tr.drop-before > * { box-shadow: inset 0 3px 0 var(--accent); }
table.ledger tr.drop-after > * { box-shadow: inset 0 -3px 0 var(--accent); }

/* 案件ボードのカードの並べ替え（2026-10-28） */
.card.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.card.drop-after { box-shadow: 0 3px 0 var(--accent); }

/* 承認待ちの列の「✉ 承認依頼」ボタン（2026-10-29） */
.col-mail { margin-left: auto; margin-right: 6px; font-size: .74rem; padding: 2px 8px; border: 1px solid var(--accent); color: var(--accent-ink); background: var(--accent-bg); border-radius: 999px; cursor: pointer; }
.col-mail:disabled { opacity: .45; cursor: default; }
.am-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.am-list .check-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--border); }
.am-list .check-row:last-child { border-bottom: 0; }
.am-list { overflow-x: hidden; }
.am-list .check-row { width: auto; box-sizing: border-box; margin: 0; background: none; border-radius: 0; }
.am-list .check-row > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* 承認依頼メール：送る前に件名・本文を確認・修正（2026-10-29） */
#amStep1[hidden], #amStep2[hidden] { display: none; }
.am-text { width: 100%; font-family: inherit; font-size: .85rem; line-height: 1.6; resize: vertical; box-sizing: border-box; }
#amSubject { width: 100%; box-sizing: border-box; }

/* ===== スマホ（2026-10-29）：上長の承認とコメントを外出先から ===== */
.col-jump{display:none;}
@media (max-width:700px){
  /* メニューは常に画面の上に重ねて出す（本文を押し縮めない） */
  .sidebar{position:fixed; left:0; top:0; z-index:30; height:100vh; transition:none;}
  .topbar .sub{display:none;}
  .topbar h1{font-size:1.05rem;}
  .board-search input{width:100%;}
  .board-search{flex:1 1 150px; min-width:0;}
  .board-search .hint{display:none;}
  .topbar{position:static;}
  /* 列へ飛ぶボタン（横にスクロール） */
  .col-jump{display:flex; gap:6px; overflow-x:auto; padding:0 2px 10px; scrollbar-width:none;}
  .col-jump::-webkit-scrollbar{display:none;}
  .col-jump button{flex:none; display:inline-flex; align-items:center; gap:5px; font:inherit; font-size:.76rem; font-weight:700; padding:6px 11px; border-radius:999px; border:1px solid var(--border-strong); background:var(--surface); color:var(--primary);}
  .col-jump button span{font-weight:600; color:var(--secondary);}
  .col-jump button.empty{opacity:.55;}
  .col-body{max-height:none;}
  /* カードの詳細は画面いっぱい */
  .drawer{width:100vw; border-left:0;}
  .drawer:not(.open){box-shadow:none;}
  .drawer-head{padding:14px 16px 10px;}
  .drawer-body{padding:14px 16px; gap:14px;}
  .dl{grid-template-columns:92px 1fr;}
  .drawer-actions{max-height:38vh; overflow-y:auto;}
  .comment-list{max-height:none;}
  /* iPhone で入力欄を押したときに画面が拡大されないよう、文字は16px以上 */
  input, select, textarea{font-size:16px !important;}
  .btn{min-height:40px;}
  .modal-back{padding:10px; align-items:flex-end;}
  .modal{width:100%; max-height:88vh;}
}

/* 台帳の追加フォーム：通常の行と社内間資金移動で欄を切り替える（2026-10-29） */
.add-row-form[data-mode="normal"] .only-xfer, .add-row-form[data-mode="xfer"] .only-normal{display:none;}
.add-row-form .add-mode{grid-column:1/-1; justify-self:start;}
/* 工事・取引先別集計の切り替えと、取引先別の月ごとの棒（2026-10-29） */
.pj-view-tabs{display:inline-flex; margin-bottom:14px;}
.party-months td.party-bar-cell{width:50%; min-width:160px;}
.party-bar{display:block; height:10px; border-radius:5px; background:var(--accent); min-width:0;}
/* カード詳細を見出し付きの枠に分ける（2026-10-30「情報が多くて見にくい」） */
.dsec-stack{display:flex; flex-direction:column; gap:12px;}
.dsec{border:1px solid var(--border); border-radius:12px; background:var(--surface); padding:12px 14px 14px; display:flex; flex-direction:column; gap:10px;}
.dsec-h{margin:0; font-size:.88rem; font-weight:800; display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  padding-bottom:8px; border-bottom:1px solid var(--border);}
.dsec-ic{width:26px; height:26px; flex:none; border-radius:8px; background:var(--accent-bg); display:inline-flex; align-items:center; justify-content:center; font-size:.9rem;}
.dsec-extra{margin-left:auto; font-weight:500; font-size:.74rem; color:var(--secondary);}
.dsec-b{display:flex; flex-direction:column; gap:10px;}
.dsec-fold > summary{cursor:pointer; list-style:none;}
.dsec-fold > summary::-webkit-details-marker{display:none;}
.dsec-fold > summary::after{content:'▾'; color:var(--secondary); margin-left:6px; transition:transform .15s;}
.dsec-fold:not([open]) > summary{border-bottom:none; padding-bottom:0;}
.dsec-fold:not([open]) > summary::after{transform:rotate(-90deg);}
.dsec-warn{border-color:var(--warn); background:var(--warn-bg);}
.dsec-amount{font-size:1.35rem; font-weight:800; font-variant-numeric:tabular-nums;}
.dsec-amount small{font-size:.72rem; font-weight:600; color:var(--secondary); margin-left:6px;}
/* 枠の中の箱は枠線・背景を消して二重にしない */
.dsec-plain .alloc-box, .dsec-plain .je-box{background:none; padding:0; border:none;}
.dsec-plain .budget-box:not(.over){border:none; padding:0;}
.dsec .history{gap:0;}
.dsec.comments{gap:10px;}
/* 下の操作欄：主な操作だけ見せ、列の移動・要確認・対象外は「ほかの操作」に畳む（2026-10-30） */
.act-more{border-top:1px dashed var(--border-strong); padding-top:8px;}
.act-more > summary{cursor:pointer; font-size:.8rem; font-weight:700; color:var(--secondary);}
.act-more > summary:hover{color:var(--primary);}
.act-more-b{display:flex; flex-direction:column; gap:8px; margin-top:8px;}
/* 請求書のまとめてアップロード・ドラッグ（2026-10-30） */
.up-drop{display:flex; flex-direction:column; align-items:center; gap:4px; padding:22px 16px; border:2px dashed var(--border-strong); border-radius:12px;
  background:var(--bg-inset); cursor:pointer; text-align:center; transition:background .15s, border-color .15s;}
.up-drop:hover, .up-drop.over{border-color:var(--accent); background:var(--accent-bg);}
.up-drop-ic{font-size:1.6rem;}
.up-list{display:flex; flex-direction:column; gap:4px; max-height:260px; overflow-y:auto;}
.up-list:empty{display:none;}
.up-item{display:flex; align-items:center; gap:10px; padding:6px 10px; border:1px solid var(--border); border-radius:8px; font-size:.84rem;}
.up-item.error{border-color:var(--error); background:var(--error-bg);}
.up-name{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.up-state{font-size:.78rem; font-weight:700; white-space:nowrap;}
.up-item.error .up-state{color:var(--error); white-space:normal;}
/* ボードにファイルをドラッグしている間は、落とせることを示す */
body.file-dragging #content{outline:3px dashed var(--accent); outline-offset:-6px; border-radius:12px; position:relative;}
body.file-dragging #content::after{content:'ここに落とすと請求書をアップロードします'; position:fixed; left:50%; top:50%; transform:translate(-50%,-50%);
  background:var(--accent); color:#fff; padding:14px 22px; border-radius:12px; font-weight:800; box-shadow:0 6px 20px rgba(0,0,0,.2); pointer-events:none; z-index:50;}
.je-mode{display:inline-flex; margin-bottom:10px;} /* 仕訳：自動で作る／自分で入力する（2026-11-02） */
/* ===== 不正アクセスの見守りキャラクター（2026-11-05）。オリジナルの絵（Anthropic のロゴではない） ===== */
.watch-buddy{--wb:#d97757; --wb-dark:#b85c3e; --wb-state:var(--ok);
  display:flex; align-items:center; gap:6px; padding:2px 10px 2px 4px; border:1px solid var(--border); border-radius:999px;
  background:var(--surface); color:var(--primary); cursor:pointer; font-size:.78rem; font-weight:700; flex:none;}
.watch-buddy:hover{background:var(--bg-inset);}
.watch-buddy[data-level="warning"]{--wb-state:var(--warn); border-color:var(--warn); background:var(--warn-bg);}
.watch-buddy[data-level="danger"]{--wb-state:var(--error); border-color:var(--error); background:var(--error-bg); color:var(--error);}
.wb-svg{width:38px; height:38px; overflow:visible; animation:wb-float 3.2s ease-in-out infinite;}
.wb-body{fill:var(--wb);}
.wb-face{fill:#fff6f1;}
.wb-eyes ellipse{fill:#3b2a22; transform-box:fill-box; transform-origin:center; animation:wb-blink 4.5s infinite;}
.wb-mouth{fill:none; stroke:#3b2a22; stroke-width:1.6; stroke-linecap:round;}
.wb-antenna{stroke:var(--wb-dark); stroke-width:2; stroke-linecap:round;}
.wb-light{fill:var(--wb-state); animation:wb-pulse 1.8s ease-in-out infinite;}
.wb-badge circle{fill:var(--wb-state); stroke:var(--surface); stroke-width:2;}
.wb-mark{fill:none; stroke:#fff; stroke-width:2; stroke-linecap:round; stroke-linejoin:round;}
.wb-bang{display:none; fill:#fff; font-size:10px; font-weight:900; font-family:sans-serif;}
.watch-buddy[data-level="warning"] .wb-mark, .watch-buddy[data-level="danger"] .wb-mark{display:none;}
.watch-buddy[data-level="warning"] .wb-bang, .watch-buddy[data-level="danger"] .wb-bang{display:inline;}
/* 心配なときは目を大きく、危険なときは小さく揺れる */
.watch-buddy[data-level="warning"] .wb-eyes ellipse{transform:scale(1.15);}
.watch-buddy[data-level="danger"] .wb-svg{animation:wb-shake .5s ease-in-out infinite;}
.watch-buddy[data-level="danger"] .wb-mouth{d:path("M21 29 q3 -2.2 6 0");}
@keyframes wb-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-2px)}}
@keyframes wb-blink{0%,92%,100%{transform:scaleY(1)}95%{transform:scaleY(.1)}}
@keyframes wb-pulse{0%,100%{opacity:1}50%{opacity:.35}}
@keyframes wb-shake{0%,100%{transform:rotate(0)}25%{transform:rotate(-6deg)}75%{transform:rotate(6deg)}}
@media (prefers-reduced-motion:reduce){.wb-svg,.wb-eyes ellipse,.wb-light{animation:none !important;}}
@media (max-width:700px){.wb-label{display:none;} .watch-buddy{padding:2px;}}
/* 見守りの画面 */
.wb-hero{display:flex; align-items:center; gap:14px;}
.wb-hero .watch-buddy{pointer-events:none; border:none; background:none; padding:0;}
.wb-hero .wb-svg{width:72px; height:72px;}
.wb-hero .wb-label{display:none;}
.wb-msg{font-size:1rem; font-weight:800;}
.wb-list{display:flex; flex-direction:column; gap:6px; margin:0; padding:0; list-style:none;}
.wb-list li{border:1px solid var(--border); border-left-width:4px; border-radius:8px; padding:8px 10px; font-size:.84rem;}
.wb-list li.lv-notice{border-left-color:var(--accent);}
.wb-list li.lv-warning{border-left-color:var(--warn); background:var(--warn-bg);}
.wb-list li.lv-danger{border-left-color:var(--error); background:var(--error-bg);}
.wb-list .wb-advice{margin-top:4px; font-weight:700;}
.wb-recent{max-height:240px; overflow:auto; font-size:.76rem;}
/* 見守りキャラクターは左のメニューの下に置く（2026-11-05 久嶋の指示） */
.sidebar .watch-buddy{margin-top:auto; width:100%; border-radius:12px; padding:8px 10px; gap:10px; justify-content:flex-start; text-align:left; font-size:.8rem;}
.sidebar .watch-buddy .wb-svg{width:44px; height:44px;}
.sidebar .watch-buddy ~ .user-box{margin-top:0;}
@media (max-width:700px){.sidebar .wb-label{display:inline;} .sidebar .watch-buddy{padding:8px 10px;}}
/* メニューが画面の高さに収まらないとき（管理者はメニューが多い）は、メニューの中だけスクロールする */
.sidebar-inner{height:calc(100% - 40px); overflow-y:auto; overflow-x:hidden;}
.sidebar .watch-buddy{padding:6px 10px;}
.sidebar .watch-buddy .wb-svg{width:38px; height:38px;}
.sidebar-inner{scrollbar-width:none;} /* スクロールバーで幅が狭くならないように（ホイールではスクロールできる） */
.sidebar-inner::-webkit-scrollbar{display:none;}
/* 見守りキャラクターを黒猫に（2026-11-05 久嶋の指示）。上の .wb-* の指定を上書きする */
.wb-body{fill:#1f1f24; stroke:#4a4a52; stroke-width:1; stroke-linejoin:round;}
.wb-ear{fill:#e8a3b0; opacity:.85;}
.wb-eyes{transform-box:fill-box; transform-origin:center; animation:wb-blink 4.5s infinite;}
.wb-eyes ellipse{animation:none;}
.wb-eyes .wb-eye{fill:#f2c94c;}
.wb-eyes .wb-pupil{fill:#111;}
.wb-nose{fill:#e8a3b0;}
.wb-mouth{stroke:#c9c9d1; stroke-width:1.1; fill:none;}
.wb-whisker{stroke:#c9c9d1; stroke-width:.8; stroke-linecap:round; opacity:.8;}
.wb-collar{fill:none; stroke:var(--wb-state); stroke-width:2.2; stroke-linecap:round;}
.wb-light{stroke:#1f1f24; stroke-width:.8;}
.watch-buddy[data-level="warning"] .wb-eyes ellipse{transform:none;}
.watch-buddy[data-level="warning"] .wb-pupil, .watch-buddy[data-level="danger"] .wb-pupil{rx:2.2px;} /* 心配なときは瞳が丸くなる */
.watch-buddy[data-level="danger"] .wb-eyes .wb-eye{fill:#ff9b6a;}
.watch-buddy[data-level="danger"] .wb-mouth{d:none;}
/* アーカイブの日付ごとの枠（2026-11-09）。見出しを押すと開く・閉じる */
.date-group > summary{cursor:pointer; list-style:none;}
.date-group > summary::-webkit-details-marker{display:none;}
.date-group > summary span:first-child::before{content:'▾ '; color:var(--secondary);}
.date-group:not([open]) > summary span:first-child::before{content:'▸ ';}
.date-group:not([open]){gap:0;}
/* 支払と売上の相殺（2026-11-09） */
.off-sum{font-size:.9rem; padding:8px 10px; border-radius:8px; background:var(--accent-bg);}
.off-cancelled td{color:var(--secondary); text-decoration:line-through;}
.off-form > summary{cursor:pointer; font-weight:700; font-size:.84rem; color:var(--accent);}
.off-form .form-grid{margin-top:8px;}
.confirm-missing{color:var(--error); font-weight:700;} /* 確定に必要な項目の不足（2026-11-09） */
.fld[hidden]{display:none;} /* 台帳の修正画面：資金移動でないときは手数料の欄を隠す（2026-11-12） */
/* 台帳の拡大・縮小（2026-11-12） */
.page-zoom{display:inline-flex; align-items:center; gap:2px; flex:none;}
.page-zoom .btn{padding:6px 10px; min-width:0;}
#pzLabel{min-width:52px;}
@media (max-width:700px){ .page-zoom{display:none;} } /* スマホは指で拡大できるので出さない */
#lzLabel{min-width:56px; font-variant-numeric:tabular-nums;}
/* 台帳のエクセルのような入力（2026-11-12）：日付・摘要・金額だけ。残高予測は入力できない */
table.ledger .xl{cursor:text;}
table.ledger .xl-editing{background:var(--surface) !important;} /* 入力中は背景を白に（青い枠は付けない。2026-11-12）。余白は元のセルのまま */
table.ledger .xl-input{display:block; box-sizing:border-box; width:100%; min-width:0; height:auto; margin:0; padding:0; font:inherit; font-weight:inherit; line-height:inherit; letter-spacing:inherit; border:none; outline:none; background:transparent; color:var(--primary);}
table.ledger td.num .xl-input{text-align:right;}
table.ledger select.xl-input{appearance:none; -webkit-appearance:none; cursor:pointer;} /* 選ぶ欄も文字と同じ幅（▼の分で広がらないように） */
/* 「＋ 手動で行を追加」と最終確認を上部へ（2026-11-12） */
.ledger-tools{display:inline-flex; align-items:center; gap:8px; margin-right:12px;}
.ledger-tools .final-check{margin:0; padding:6px 10px;}
.ledger-tools .final-check span{white-space:nowrap;}
.add-row-form.open{margin-bottom:12px;}
/* 台帳の行の色（2026-11-12）：🎨 は行にマウスを乗せたときだけ。色見本 */
.row-color-btn{display:none; background:none; border:none; cursor:pointer; padding:0 2px; font-size:.85rem;}
table.ledger tbody tr.editable-row:hover .row-color-btn{display:inline;}
.color-pop{position:absolute; z-index:60; display:flex; gap:6px; padding:8px; background:var(--surface); border:1px solid var(--border-strong); border-radius:10px; box-shadow:0 6px 20px rgba(0,0,0,.15);}
.color-pop button{width:26px; height:26px; border-radius:6px; border:1px solid var(--border-strong); cursor:pointer; padding:0;}
.color-pop button.on{outline:2px solid var(--accent); outline-offset:1px;}
.color-pop button.none{background:var(--surface); color:var(--secondary); font-size:.75rem;}
/* 手動で行を追加：色の選択（2026-11-12） */
.color-choice{display:flex; gap:6px; align-items:center; min-height:38px;}
.color-choice button{width:26px; height:26px; border-radius:6px; border:1px solid var(--border-strong); cursor:pointer; padding:0;}
.color-choice button.on{outline:2px solid var(--accent); outline-offset:1px;}
.color-choice button.none{background:var(--surface); color:var(--secondary); font-size:.75rem;}
/* 台帳の行の間の横線を濃く（2026-11-12「もう少し濃く」） */
:root{--ledger-line:#b3b8c0;}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--ledger-line:#525a65;}}
:root[data-theme="dark"]{--ledger-line:#525a65;}
table.ledger tbody tr:not(:last-child) td, table.ledger tbody tr:not(:last-child) th{border-bottom-color:var(--ledger-line);}
/* エクセルのような列のアルファベットと行の番号（2026-11-12）。行の番号の列は左端に固定し、合計の列はその右に固定 */
table.ledger .rn{position:sticky; left:0; z-index:2; box-sizing:border-box; width:40px; min-width:40px; max-width:40px; padding:4px 2px; text-align:center;
  background:var(--bg-inset) !important; color:var(--secondary) !important; font-size:.7rem; font-weight:600; font-variant-numeric:tabular-nums; border-right:1px solid var(--border-strong); box-shadow:none !important;}
table.ledger thead .rn{z-index:6;}
table.ledger td.total-col, table.ledger thead th.total-col-header{left:40px;}
table.ledger thead tr.xl-letters th{font-size:.68rem; font-weight:600; color:var(--secondary); text-align:center; padding:3px 4px; background:var(--bg-inset); border-bottom:1px solid var(--border-strong); border-right:1px solid var(--border);}
table.ledger tbody tr.day-gap td.rn{background:var(--bg) !important; border-right-color:transparent;}
/* 台帳の行の挿入・削除（2026-11-12） */
table.ledger tbody tr.draft-row td, table.ledger tbody tr.draft-row th{background:var(--accent-bg) !important;}
table.ledger tbody tr.draft-row .xl-input{box-shadow:inset 0 -1px 0 var(--border-strong);} /* 挿入の行：枠線で幅を広げない */
table.ledger .draft-actions{display:inline-flex; gap:4px; margin-left:6px; vertical-align:middle;}
table.ledger td.rn{cursor:pointer;}
table.ledger tbody tr.row-selected td, table.ledger tbody tr.row-selected th{box-shadow:inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent) !important;}
table.ledger tbody tr.row-selected td.rn{background:var(--accent) !important; color:#fff !important;}
.ctx-menu{position:absolute; z-index:70; min-width:200px; background:var(--surface); border:1px solid var(--border-strong); border-radius:10px; box-shadow:0 8px 24px rgba(0,0,0,.18); padding:6px; display:flex; flex-direction:column;}
.ctx-menu button{background:none; border:none; text-align:left; padding:8px 10px; border-radius:6px; font:inherit; font-size:.84rem; cursor:pointer; color:var(--primary);}
.ctx-menu button:hover:not([disabled]){background:var(--accent-bg);}
.ctx-menu button[disabled]{color:var(--secondary); cursor:not-allowed;}
.ctx-menu hr{border:none; border-top:1px solid var(--border); margin:4px 0;}
.ctx-menu .ctx-hint{font-size:.72rem; color:var(--secondary); padding:0 10px 6px;}
/* 残高予測がマイナスなら赤（2026-11-13） */
table.ledger td.bal-neg{color:var(--error) !important; font-weight:700;}
/* 支払日入力待ちのカードの合体：相手のカードの真ん中に重ねると緑の枠（2026-11-13） */
.card.drop-merge{outline:3px solid var(--ok); outline-offset:2px; background:var(--ok-bg);}
.card.drop-merge::after{content:"ここに落とすと1枚にまとめます"; display:block; margin-top:6px; font-size:.72rem; font-weight:700; color:var(--ok);}
/* マウスを乗せても表が動かないように（2026-11-13）：✎ 修正・🎨 は最初から場所をとっておき、乗せたときに見えるだけにする */
table.ledger .row-edit-btn, table.ledger .row-color-btn{display:inline; visibility:hidden;}
table.ledger tbody tr.editable-row:hover .row-edit-btn, table.ledger tbody tr.editable-row:hover .row-color-btn{visibility:visible;}
table.ledger tr.draft-row select.xl-input{appearance:auto; -webkit-appearance:auto;} /* 挿入の行の選ぶ欄（方法・繰返・進捗）は ▼ を出して選べることが分かるように（2026-11-13） */
/* 毎月の行を休日でずらした印（2026-11-13） */
.shift-tag{font-size:.68rem; font-weight:700; color:var(--warn); background:var(--warn-bg); border-radius:4px; padding:1px 5px; white-space:nowrap;}
table.ledger tr.draft-row select[data-draft="shift"]{margin-top:4px; font-size:.72rem;}

/* 台帳の金額をドラッグして口座を変える（2026-11-13） */
table.ledger .amt-drag { cursor: grab; }
table.ledger .amt-drag:active { cursor: grabbing; }
table.ledger td.amt-over { background: #dcfce7 !important; box-shadow: inset 0 0 0 2px #16a34a; }
table.ledger tr.amt-moving td[data-acct-col] .amt-drag { opacity: .45; }

/* スマホで請求書の全体を見る（2026-11-17）：カード詳細の中に全ページを幅に合わせて表示、＋・－で拡大して指で動かす */
.doc-thumb.doc-phone{cursor:default; display:block;}
.doc-thumb.doc-phone img{max-height:none;}
.doc-thumb.doc-phone .pdfjs-view{max-height:none; overflow:visible; pointer-events:auto;}
.doc-thumb.doc-phone .pdfjs-pages{max-height:75vh; padding:6px; background:var(--bg-inset); align-items:flex-start; -webkit-overflow-scrolling:touch;}
.doc-thumb.doc-phone .pdfjs-bar{position:sticky; top:0; z-index:1; background:var(--surface); padding:6px; display:flex; gap:6px; align-items:center;}

/* スマホのカード詳細は承認に必要な項目だけ（2026-11-17）：工事・予算、仕訳、請求書の内訳、AIの食い違い、移動履歴は隠す */
.m-more{display:none;}
@media (max-width:700px){
  #drawer:not(.m-all) .m-hide{display:none !important;}
  .m-more{display:block; width:100%; text-align:center; padding:8px;}
}

/* スマホの拡大表示（2026-11-17）：画面いっぱい、✕は押しやすく */
@media (max-width:700px){
  .lightbox{padding:0; align-items:stretch;}
  .lightbox .pdfjs-view{width:100vw; height:100vh; height:100dvh; border-radius:0; padding:0;}
  .lightbox .pdfjs-bar{padding:8px 60px 8px 8px; background:var(--surface);}
  .lightbox .pdfjs-pages{border-radius:0; align-items:flex-start;}
  .lightbox img{width:100vw; max-height:100dvh; border-radius:0;}
  .lightbox .lb-close{top:6px; right:8px; width:44px; height:44px; border-radius:50%; background:rgba(0,0,0,.65); font-size:1.4rem;}
  .doc-thumb.doc-phone .pdfjs-pages{cursor:zoom-in;}
}

/* 工事の業者ごとの仕入：表の中で直接入力（2026-11-19） */
table.simple td.pe{cursor:text;}
table.simple td.pe:hover{background:var(--bg-inset);}
table.simple .pe-input{width:100%; min-width:0; font:inherit; padding:3px 6px; border:1px solid var(--border-strong); border-radius:4px; background:var(--surface);}
table.simple td.num .pe-input{text-align:right;}
table.simple tr.pe-add input{width:100%; min-width:0; font:inherit; padding:3px 6px; border:1px dashed var(--border-strong); border-radius:4px; background:var(--surface);}
table.simple tr.pe-add td.num input{text-align:right;}

/* 2段階認証の画面（2026-11-19） */
.mfa-remember{display:flex; gap:8px; align-items:flex-start; font-size:.85rem; margin:4px 0 10px; line-height:1.5;}
.mfa-remember input{margin-top:3px;}
#mfaCode{font-size:1.3rem; letter-spacing:.3em; text-align:center;}

/* ===== 工事・取引先別集計を見やすく（2026-11-24、「見づらい・入力するところがわかりにくい」） ===== */
/* 上部の期間の指定は1行に（入力欄が width:100% で縦に積み重なっていた） */
.period-bar{display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end;}
.period-bar input[type="month"]{width:auto; min-width:9.5em;}
.period-bar .hint{white-space:nowrap;}
/* 一覧：売上・仕入・粗利の区切り線、行を押すと開く、開いている工事に色 */
.pj-table .g-start{border-left:2px solid var(--border-strong);}
.pj-table th.g-sales{color:var(--ok);}
.pj-table th.g-purchase{color:var(--error);}
.pj-table th.g-profit{color:var(--accent);}
.pj-table tr.pj-row{cursor:pointer;}
.pj-table tr.pj-row:hover td{background:var(--accent-bg);}
.pj-table tr.pj-current td{background:var(--accent-bg); font-weight:700;}
.pj-table tr.pj-current td:first-child{box-shadow:inset 4px 0 0 var(--accent);}
.pj-open{font-weight:700; text-decoration:none; display:inline-flex; align-items:center; gap:6px;}
.pj-open-mark{font-size:.72rem; font-weight:700; color:var(--accent); border:1px solid var(--accent); border-radius:999px; padding:1px 8px; white-space:nowrap; opacity:.55;}
.pj-table tr.pj-row:hover .pj-open-mark, .pj-table tr.pj-current .pj-open-mark{opacity:1; background:var(--accent); color:#fff;}
.pj-guide{margin:4px 0 10px; padding:8px 12px; border-radius:8px; background:var(--accent-bg); color:var(--accent-ink); font-size:.86rem;}
.pj-help{margin:0 0 10px;}
.pj-help summary{cursor:pointer; font-size:.82rem; color:var(--secondary); font-weight:700;}
.pj-help p{margin:6px 0 0;}
/* 工事の詳細：入力の枠をはっきり、押せる欄は黄色＋✎ */
.pj-input-box{margin:16px 0; border:2px solid var(--accent); border-radius:14px; padding:12px 16px 14px; background:var(--surface);}
.pj-box-title{margin:0 0 6px; font-size:1rem; color:var(--accent-ink);}
.pj-input-box .section-title{margin-top:14px;}
table.simple td.pe{background:var(--warn-bg); cursor:pointer; position:relative; padding-right:22px;}
table.simple td.pe::after{content:"✎"; position:absolute; right:6px; top:50%; transform:translateY(-50%); font-size:.78rem; color:var(--warn); opacity:.7;}
table.simple td.pe:hover{background:var(--warn-bg); box-shadow:inset 0 0 0 2px var(--warn);}
table.simple td.pe:hover::after{opacity:1;}
table.simple td.pe:has(input)::after{content:none;}
table.simple tr.pe-add td{background:var(--bg-inset);}
.pj-plan .pj-del-cell{width:1%; white-space:nowrap;}
.pj-cards{margin-top:16px;}
.pj-cards summary{cursor:pointer; font-weight:700; font-size:.92rem; padding:6px 0;}
table.simple.pj-sales{width:auto; min-width:min(640px,100%);}
table.pj-sales td:first-child{min-width:16em;}
.pj-plan .mini-btn{white-space:nowrap;}

/* ===== 工事別集計のPDF（印刷→PDFに保存、2026-11-25） ===== */
.rp-opts{display:flex; flex-direction:column; gap:6px; margin:6px 0 0 8px;}
.radio-line{display:flex; align-items:center; gap:8px; font-size:.9rem; cursor:pointer;}
.radio-line input{width:auto;}
#printArea{display:none;}
@media print{
  @page{size:A4 landscape; margin:10mm;}
  body > *:not(#printArea){display:none !important;}
  html, body{background:#fff !important;}
  #printArea{display:block; color:#000; font-size:9pt; -webkit-print-color-adjust:exact; print-color-adjust:exact;}
  #printArea .rp-page{break-before:page;}
  #printArea .rp-first{break-before:auto;}
  #printArea .rp-head{display:flex; justify-content:space-between; align-items:flex-end; border-bottom:2px solid #000; padding-bottom:4px; margin-bottom:6px;}
  #printArea .rp-head div{font-size:8.5pt; text-align:right;}
  #printArea h1{font-size:15pt; margin:0;}
  #printArea h2{font-size:13pt; margin:0 0 6px; border-bottom:2px solid #000; padding-bottom:3px;}
  #printArea h3{font-size:10pt; margin:10px 0 4px;}
  #printArea .rp-note{font-size:7.5pt; color:#444; margin:2px 0 6px;}
  #printArea table{width:100%; border-collapse:collapse; break-inside:auto;}
  #printArea tr{break-inside:avoid;}
  #printArea th, #printArea td{border:1px solid #999; padding:2px 5px; font-size:8.5pt; background:#fff; color:#000;}
  #printArea th{background:#eef0f3 !important; font-weight:700;}
  #printArea td.num, #printArea th.num{text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap;}
  #printArea .neg{color:#b91c1c !important;}
  #printArea .pos{color:#2f855a !important;}
  #printArea .hint{color:#555;}
  #printArea tr.pj-sec th{background:#dfe3e8 !important; text-align:left;}
  #printArea tr.pj-subtotal td{font-weight:700; border-top:2px solid #000; background:#f6f7f9 !important;}
  #printArea .g-start{border-left:2px solid #000;}
  #printArea .rp-kpi td{font-size:12pt; font-weight:700; text-align:center;}
  #printArea .rp-kpi td small{display:block; font-size:8pt; font-weight:400; color:#444;}
}

/* ===== 工事別集計の毎晩の記録（2026-11-25）：日付の選択・比べる・増減・推移のグラフ ===== */
:root{--trend-sales:#2a78d6; --trend-purchase:#eb6834; --trend-profit:#1baf7a;}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){--trend-sales:#3987e5; --trend-purchase:#d95926; --trend-profit:#199e70;} }
:root[data-theme="dark"]{--trend-sales:#3987e5; --trend-purchase:#d95926; --trend-profit:#199e70;}
.pj-snapbar{display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; margin:4px 0 10px; padding:8px 12px; border:1px solid var(--border); border-radius:10px; background:var(--bg-inset); font-size:.84rem;}
.pj-snapbar label{display:flex; align-items:center; gap:6px; font-weight:700; color:var(--secondary); white-space:nowrap;}
.pj-snapbar select{width:auto; min-width:11em;}
.pj-snapbar.past{border-color:var(--warn); background:var(--warn-bg);}
.pj-snapnote{flex:1 1 280px; color:var(--primary);}
.pj-dlt{display:block; font-size:.72rem; font-weight:700; line-height:1.1;}
.pj-dlt.up{color:var(--ok);}
.pj-dlt.down{color:var(--error);}
.trend-legend{display:flex; flex-wrap:wrap; gap:6px 16px; align-items:center; font-size:.82rem; margin:2px 0 4px;}
.trend-legend i{display:inline-block; width:14px; height:3px; border-radius:2px; margin-right:6px; vertical-align:middle;}
.trend-wrap{max-width:760px;}
.trend-svg{width:100%; height:auto; display:block;}
.trend-svg .tr-grid{stroke:var(--border); stroke-width:1;}
.trend-svg .tr-zero{stroke:var(--border-strong); stroke-width:1.5;}
.trend-svg .tr-axis{fill:var(--secondary); font-size:11px;}
.trend-svg .tr-label{fill:var(--primary); font-size:12px; font-weight:700;}
.trend-svg .tr-cross, .trend-svg .tr-dot{opacity:0;}
.trend-svg .tr-cross{stroke:var(--secondary); stroke-width:1; stroke-dasharray:3 3;}
.trend-svg .tr-dot{stroke:var(--surface); stroke-width:2;}
.trend-svg .tr-hit:hover .tr-cross, .trend-svg .tr-hit:hover .tr-dot{opacity:1;}
@media print{ #printArea .pj-dlt{font-size:7pt;} #printArea .pj-dlt.up{color:#2f855a !important;} #printArea .pj-dlt.down{color:#b91c1c !important;} }
.rec-grid{display:grid; grid-template-columns:repeat(auto-fit, minmax(360px, 1fr)); gap:10px 24px; margin-bottom:6px;}
.rec-grid table th:first-child{text-align:left; font-weight:600;}
.rec-metric{display:flex; align-items:center; gap:6px; font-size:.84rem; font-weight:700; color:var(--secondary);}
.rec-metric select{width:auto;}
.rec-table td.num{white-space:nowrap;}
.rec-tabs{display:inline-flex; flex-wrap:wrap; margin-bottom:14px;}

/* 進捗「概算」（2026-11-26）：予定よりさらに見込みの段階。紫系で行と左端の線を分ける */
:root{--estimate-bg:#f1ebfa; --estimate-line:#7c5cc4; --estimate-ink:#5b3fa3;}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){--estimate-bg:#2a2238; --estimate-line:#a98be0; --estimate-ink:#d4c3f5;} }
:root[data-theme="dark"]{--estimate-bg:#2a2238; --estimate-line:#a98be0; --estimate-ink:#d4c3f5;}
table.ledger tbody tr.prog-estimate td:not(.total-col), table.ledger tbody tr.prog-estimate th{background:var(--estimate-bg);}
table.ledger tbody tr.prog-estimate td.total-col{box-shadow:inset 5px 0 0 var(--estimate-line);}
.prog-key.prog-estimate{background:var(--estimate-bg); border-color:var(--estimate-line);}
.badge.estimate{background:var(--estimate-bg); color:var(--estimate-ink);}

/* 届いたメール・返信（2026-12-02） */
.mail-meta{display:flex; flex-direction:column; gap:4px; font-size:.86rem; margin-bottom:8px;}
.mail-meta .hint{display:inline-block; min-width:3.5em; font-weight:700;}
.mail-actions{margin:6px 0 8px;}
.mail-actions a.btn{text-decoration:none;}
.mail-replied{font-size:.84rem; color:var(--ok); margin:4px 0 8px; display:flex; flex-direction:column; gap:2px;}
.mail-body summary{cursor:pointer; font-weight:700; font-size:.86rem;}
.mail-body pre{white-space:pre-wrap; word-break:break-word; font-family:inherit; font-size:.86rem; line-height:1.6; max-height:360px; overflow:auto; background:var(--bg-inset); border:1px solid var(--border); border-radius:8px; padding:10px 12px; margin:6px 0 0;}
textarea.mail-textarea{width:100%; font-family:inherit; font-size:.88rem; line-height:1.6; padding:8px 10px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--primary); resize:vertical;}
/* 元のメールを画面で見る（2026-12-02） */
.mail-frame-wrap{margin-top:6px; border:1px solid var(--border-strong); border-radius:8px; overflow:hidden; resize:vertical; height:420px; min-height:200px; background:#fff;}
.mail-frame{width:100%; height:100%; border:0; display:block; background:#fff;}
.mail-frame.big{height:min(72vh, 900px); border:1px solid var(--border-strong); border-radius:8px;}
.mail-foot{display:flex; justify-content:space-between; gap:8px; flex-wrap:wrap; font-size:.8rem; margin-top:6px;}
.modal.modal-wide{max-width:min(980px, 96vw); width:96vw;}
@media (max-width:700px){ .mail-frame-wrap{height:60vh;} }
/* 工事の見積書・資料（2026-12-02） */
.pf-table td{vertical-align:middle;}
.pf-table select, .pf-table input.pf-note{width:auto; min-width:8em; padding:4px 8px; font-size:.82rem;}
.pf-table input.pf-note{min-width:14em;}
.pf-drop{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:8px 0 4px; padding:12px 14px; border:2px dashed var(--border-strong); border-radius:10px; font-size:.85rem; color:var(--secondary);}
.pf-drop.over{border-color:var(--accent); background:var(--accent-bg);}
.pf-drop .btn{cursor:pointer;}
.pf-kind-new{display:flex; align-items:center; gap:6px; font-weight:700;}
.pf-kind-new select{width:auto;}
.pf-table .mini-btn{white-space:nowrap;}

/* ===== 売上請求書作成（2026-12-02） ===== */
.inv-top{display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:14px;}
.inv-seal{display:flex; align-items:center; gap:8px; margin-left:auto; font-size:.84rem;}
.inv-seal-img{width:34px; height:34px; object-fit:contain; border:1px solid var(--border); border-radius:6px; background:#fff;}
.inv-seal label.mini-btn{cursor:pointer;}
.inv-list tr.inv-row{cursor:pointer;}
.inv-list tr.inv-row:hover td{background:var(--bg-inset);}
.inv-head{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:12px;}
.inv-wrap{display:grid; grid-template-columns:minmax(380px, 1fr) minmax(320px, 520px); gap:18px; align-items:start;}
.inv-form{display:flex; flex-direction:column; gap:12px; min-width:0;}
.inv-box{border:1px solid var(--border); border-radius:12px; padding:12px 14px; background:var(--surface);}
.inv-box .section-title{margin-bottom:8px;}
.inv-grid{display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:10px 12px; align-items:end;}
.inv-span2{grid-column:span 2;}
.inv-span3{grid-column:1 / -1;}
.inv-check{display:flex; align-items:center; gap:6px; font-size:.84rem; grid-column:1 / -1;}
.inv-calc{padding:8px 0; font-weight:700;}
.inv-items{width:100%;}
.inv-items td{padding:4px 6px;}
.inv-items .ii-name{width:100%;}
.inv-items .ii-amt{width:9em; text-align:right;}
.inv-items + .mini-btn{margin-top:6px;}
.inv-sum{display:flex; flex-direction:column; align-items:flex-end; gap:3px; margin-top:10px; font-size:.88rem;}
.inv-grand{font-size:1.05rem; border-top:1px solid var(--border-strong); padding-top:4px; margin-top:2px;}
.inv-box textarea{width:100%; box-sizing:border-box;}
.inv-actions{display:flex; gap:8px; flex-wrap:wrap; position:sticky; bottom:0; background:var(--bg); padding:10px 0;}
.btn.danger{color:var(--error); border-color:var(--error);}
.inv-mails{margin:0; padding-left:18px; font-size:.84rem;}
.inv-preview{position:sticky; top:12px; border:1px solid var(--border); border-radius:12px; background:var(--bg-inset); padding:8px;}
.inv-preview-bar{display:flex; gap:8px; align-items:baseline; padding:2px 4px 8px; font-size:.84rem;}
.inv-preview-pages canvas{display:block; margin:0 auto; background:#fff; box-shadow:0 1px 4px rgba(0,0,0,.18);}
@media (max-width:1000px){ .inv-wrap{grid-template-columns:1fr;} .inv-preview{position:static;} }
@media (max-width:700px){ .inv-grid{grid-template-columns:1fr 1fr;} .inv-span2{grid-column:1 / -1;} .inv-seal{margin-left:0;} }

/* 工事の月ごとの表の内訳（2026-12-03） */
tr.pm-row{cursor:pointer;}
tr.pm-row:hover td{background:var(--bg-inset);}
tr.pm-row.open td{background:var(--bg-inset); font-weight:700;}
.pm-arrow{display:inline-block; width:1.1em; color:var(--secondary); font-size:.75rem;}
tr.pm-detail > td{background:var(--surface); padding:10px 14px 14px;}
.pm-box{display:grid; grid-template-columns:1fr 1.4fr; gap:18px;}
.pm-head{font-weight:800; font-size:.84rem; margin-bottom:4px;}
.pm-sub{font-size:.78rem; color:var(--secondary); margin:8px 0 2px; font-weight:700;}
.pm-line{display:flex; justify-content:space-between; gap:12px; padding:4px 0; border-bottom:1px dashed var(--border); font-size:.84rem;}
.pm-line b{white-space:nowrap;}
@media (max-width:900px){ .pm-box{grid-template-columns:1fr;} }
/* 予定と実績の表を分ける（2026-12-03）。広い画面は左右に並べ、狭い画面は上下に */
.pm-split{display:grid; grid-template-columns:1fr; gap:6px 24px; align-items:start;}
.pm-split .section-title{margin-top:10px;}
.pm-table{width:100%;}
tr.pm-total td{font-weight:800; border-top:2px solid var(--border-strong);}
.pm-box.pm-even{grid-template-columns:1fr 1fr;}
@media (min-width:1400px){ .pm-split{grid-template-columns:1fr 1fr;} .pm-split .pm-box.pm-even{grid-template-columns:1fr;} }
@media (max-width:900px){ .pm-box.pm-even{grid-template-columns:1fr;} }

/* 月ごとの表の累計残高（2026-12-03） */
td.pm-run{font-weight:700; background:var(--bg-inset);}

/* 工事別集計PDFの月ごとの表（2026-12-03、画面と同じく予定と実績に分ける） */
@media print{
  #printArea .rp-split{display:grid; grid-template-columns:1fr 1fr; gap:0 14px; align-items:start;}
  #printArea .rp-run{font-weight:700; background:#f6f7f9 !important;}
  #printArea tr.rp-total td{font-weight:700; border-top:2px solid #000; background:#f6f7f9 !important;}
  #printArea tr.rp-bd-row td{padding:1px 5px 3px 18px; font-size:7.5pt; color:#333;}
  #printArea .rp-bd{display:flex; justify-content:space-between; gap:8px; font-size:7.5pt; border-bottom:1px dotted #bbb; padding:1px 0;}
  #printArea .rp-bd:last-child{border-bottom:none;}
  #printArea .rp-bd b{white-space:nowrap; font-weight:600;}
  #printArea .rp-bd i{font-style:normal; color:#666;}
}

/* 工事別集計PDF：入れる項目のチェック（2026-12-03） */
.rp-checks{display:flex; flex-direction:column; gap:6px; margin:6px 0 0 8px;}
.rp-checks .rp-sub{margin-left:22px;}
@media print{ #printArea .rp-head + .rp-page{break-before:auto;} }

/* キャッシュフロー推移（2026-12-03） */
.pm-cf-title{margin-top:18px; font-size:1.05rem;}
.pm-table small.pm-rem{display:block; font-size:.72rem; color:var(--secondary); font-weight:400;}
.pm-line-rem{font-style:italic; color:var(--secondary);}
@media print{
  #printArea .rp-h4{font-size:9.5pt; margin:6px 0 3px;}
  #printArea .rp-bd-rem{font-style:italic; color:#555;}
  #printArea td small{font-size:7pt; color:#555;}
}

/* ===== 入口：会社を選ぶ（2026-12-04） ===== */
.company-list{display:flex; flex-direction:column; gap:10px;}
.company-btn{display:flex; justify-content:space-between; align-items:center; gap:12px; width:100%; padding:14px 16px; border:1px solid var(--border-strong); border-radius:12px; background:var(--surface); color:var(--primary); font:inherit; font-size:.98rem; cursor:pointer; text-align:left;}
.company-btn:hover, .company-btn:focus-visible{border-color:var(--accent); background:var(--accent-bg); outline:none;}
.company-btn span{font-size:.76rem; color:var(--secondary); white-space:nowrap;}
.company-btn:disabled{opacity:.6; cursor:wait;}
.company-foot{display:flex; justify-content:space-between; align-items:center; font-size:.8rem; color:var(--secondary); margin-top:4px;}
.switch-company{width:100%;}
.uc-cell select{width:auto; min-width:7em;}
