:root {
  /* ── ベースカラー ── */
  --bg:         #f0f4f8;
  --bg2:        #e8eef5;
  --surface:    #ffffff;
  --surface2:   #f5f8fc;

  /* ── ボーダー ── */
  --border:     #dce4ee;
  --border2:    #c8d4e4;

  /* ── テキスト ── */
  --ink:        #1a2535;
  --ink2:       #3a4d65;
  --ink3:       #6b7f96;
  --ink4:       #9aacbf;

  /* ── アクセント：水色系 ── */
  --blue:       #2b6cb0;
  --blue-mid:   #3a83c8;
  --blue-light: #63a8e8;
  --blue-pale:  #dbeafe;
  --blue-ghost: #f0f7ff;

  /* ── サイドバー ── */
  --side-bg:    #1e2d42;
  --side-bg2:   #253448;
  --side-text:  rgba(255,255,255,0.55);
  --side-act:   rgba(255,255,255,0.95);

  /* ── ステータスカラー ── */
  --red:        #dc3545;
  --red-pale:   #fdecea;
  --green:      #1a7a4a;
  --green-pale: #e6f4ec;
  --amber:      #b45309;
  --amber-pale: #fef3c7;

  --radius:     6px;
  --shadow-sm:  0 1px 4px rgba(30,45,66,0.07);
  --shadow:     0 2px 12px rgba(30,45,66,0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
/* 最小文字サイズ保証 */
.tbl td, .tbl th { font-size: 13px; }
.form-label { font-size: 13px; }
.form-input, .form-select { font-size: 14px; }
.btn { font-size: 13px; }
.nav-item { font-size: 14px; }
.badge { font-size: 11px; }
.desc { font-size: 13px !important; }
.gantt-row .g-name { font-size: 13px; }
.gantt-row .g-client { font-size: 12px; }
.card-title { font-size: 15px; }
.page-title { font-size: 20px; }
.kpi-value { font-size: 28px; }

/* ════ サイドバー ════ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 224px;
  background: var(--side-bg);
  display: flex; flex-direction: column;
  z-index: 100;
}
.sidebar-logo {
  padding: 28px 22px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.logo-mark {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.logo-icon {
  width: 34px; height: 34px;
  background: var(--blue-mid);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.logo-name { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.logo-en {
  font-size: 10px; letter-spacing: 2.5px; color: rgba(255,255,255,0.28);
  text-transform: uppercase; font-weight: 400;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-group {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  color: rgba(255,255,255,0.22); text-transform: uppercase;
  padding: 16px 22px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 22px; cursor: pointer;
  color: var(--side-text); font-size: 13px; font-weight: 400;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
  user-select: none;
}
.nav-item:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.04); }
.nav-item.active {
  color: var(--side-act); font-weight: 600;
  border-left-color: var(--blue-light);
  background: rgba(99,168,232,0.1);
}
.nav-icon { width: 18px; text-align: center; font-size: 13px; opacity: 0.75; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  border-radius: 10px; padding: 1px 7px; min-width: 20px; text-align: center;
  background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.7);
}
.nav-badge.red { background: var(--red); color: #fff; }

.sidebar-footer {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 10px; color: rgba(255,255,255,0.2); letter-spacing: 0.5px;
}

/* ════ メイン ════ */
.main { margin-left: 224px; min-height: 100vh; }
.topbar {
  height: 54px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.page-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.page-divider { color: var(--border2); }
.page-sub { font-size: 12px; color: var(--ink3); font-weight: 400; }
.date-chip {
  font-size: 11px; color: var(--ink3); font-family: 'DM Mono', monospace;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 4px; padding: 4px 11px;
}

.content { padding: 28px 32px; }

/* ════ KPIカード ════ */
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 24px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: box-shadow 0.15s;
}
.kpi-card:hover { box-shadow: var(--shadow); }
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.kpi-card.accent::before  { background: var(--blue-mid); }
.kpi-card.warn::before    { background: var(--amber); }
.kpi-card.danger::before  { background: var(--red); }
.kpi-card.ok::before      { background: var(--green); }
.kpi-card.neutral::before { background: var(--border2); }
.kpi-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--ink3); margin-bottom: 10px;
}
.kpi-value {
  font-family: 'DM Mono', monospace;
  font-size: 26px; font-weight: 500; color: var(--ink); line-height: 1;
}
.kpi-value .unit { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 12px; color: var(--ink3); margin-left: 3px; }
.kpi-sub { font-size: 11px; color: var(--ink4); margin-top: 7px; }

/* ════ レイアウト ════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ════ カード ════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.8px; color: var(--ink2);
  text-transform: uppercase;
}
.card-body { padding: 18px; }

/* ════ テーブル ════ */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 9px 16px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink3);
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  color: var(--ink2); vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--blue-ghost); }
.mono { font-family: 'DM Mono', monospace; font-size: 13px; }

/* ════ 案件管理: テーブルヘッダー固定 (sticky) ════
   案件一覧スクロール時、ヘッダー(番号/種別・案件名/顧客名・契約額・担当/次回入金・状態・報告)を
   .topbar の真下に貼り付けて、どの列が何の項目か常に見える状態にする。
   .topbar は position: sticky; top: 0; height: 54px なので、
   テーブルヘッダーは top: 54px でその真下に固定する。 */
.tbl-wrap-clients { overflow: visible; }
#tab-clients table.tbl thead th {
  position: sticky;
  top: 54px; /* = .topbar height */
  z-index: 5;
  background: var(--surface2);
  /* sticky時にborder-bottomが見えづらくなるのを box-shadow で補強 */
  box-shadow: 0 1px 0 var(--border);
}

/* ════ バッジ ════ */
.badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  letter-spacing: 0.5px; padding: 2px 8px; border-radius: 3px;
}
.b-gray   { background: var(--bg2); color: var(--ink3); }
.b-blue   { background: var(--blue-pale); color: var(--blue); }
.b-black  { background: var(--ink); color: #fff; }
.b-green  { background: var(--green-pale); color: var(--green); }
.b-amber  { background: var(--amber-pale); color: var(--amber); }
.b-red    { background: var(--red-pale); color: var(--red); }

/* ════ ボタン ════ */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.15s; border: none; font-family: inherit;
}
.btn-primary { background: var(--blue-mid); color: #fff; }
.btn-primary:hover { background: var(--blue); }
.btn-ghost { background: var(--surface); color: var(--ink3); border: 1px solid var(--border); }
.btn-ghost.selected { background: var(--blue-mid); color: #fff; border-color: var(--blue-mid); font-weight: 700; }
.btn-ghost:hover { border-color: var(--blue-light); color: var(--blue); background: var(--blue-ghost); }
.btn-danger { background: var(--surface); color: var(--red); border: 1px solid #f0c0bc; }
.btn-danger:hover { background: var(--red-pale); }

/* ════ フォーム ════ */
.form-row { display: flex; gap: 12px; margin-bottom: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.form-label { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--ink3); }
.form-input, .form-select {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--ink); border-radius: var(--radius);
  padding: 8px 11px; font-size: 13px; font-family: inherit; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus {
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(99,168,232,0.15);
}
.form-input::placeholder { color: var(--ink4); }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7f96'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}

/* ════ プログレスバー ════ */
.prog { height: 4px; background: var(--bg2); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.prog-fill { height: 100%; border-radius: 2px; transition: width 0.7s ease; background: var(--blue-mid); }
.prog-fill.green { background: var(--green); }
.prog-fill.amber { background: var(--amber); }
.prog-fill.red   { background: var(--red); }

/* ════ バーチャート ════ */
.bar-chart { display: flex; align-items: flex-end; gap: 7px; height: 80px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.bar-item {
  width: 100%; background: var(--blue-pale);
  border-top: 2px solid var(--blue-light);
  min-height: 3px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.bar-item:hover, .bar-item.cur { background: var(--blue-mid); border-top-color: var(--blue); }
.bar-lbl { font-size: 10px; color: var(--ink4); font-family: 'DM Mono', monospace; }

/* ════ ドーナツ ════ */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.donut-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* ════ ガント ════ */
.gantt-wrap { overflow-x: auto; }
.gantt { min-width: 780px; }
.gantt-head { display: flex; background: var(--surface2); border-bottom: 1px solid var(--border); }
.gantt-lw { width: 230px; flex-shrink: 0; padding: 8px 14px; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--ink3); }
.gantt-months { display: flex; flex: 1; }
.gantt-mh {
  flex: 1; text-align: center; padding: 8px 0; font-size: 10px;
  color: var(--ink3); border-left: 1px solid var(--border);
  font-family: 'DM Mono', monospace; letter-spacing: 0.5px;
}
.gantt-row { display: flex; align-items: center; border-bottom: 1px solid var(--border); min-height: 46px; }
.gantt-row:hover { background: var(--blue-ghost); }
.gantt-rl { width: 230px; flex-shrink: 0; padding: 8px 14px; }
.g-name { font-size: 12px; font-weight: 600; color: var(--ink); }
.g-client { font-size: 11px; color: var(--ink4); margin-top: 1px; }
.gantt-tl { flex: 1; position: relative; height: 46px; }

/* ══ 工程詳細ガント v2（印刷版と統一されたデザイン） ══ */

/* 横スクロール対応（タッチ対応）
   縦も内部スクロールにすることでヘッダーsticky topを効かせる */
.gantt-scroll-v2 {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 260px);  /* 画面内にほぼ収まる高さ、ヘッダー固定のため */
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  /* スクロールバー細く */
  scrollbar-width: thin;
  scrollbar-color: #bbb #f0f0f0;
}
.gantt-scroll-v2::-webkit-scrollbar { height: 10px; }
.gantt-scroll-v2::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 5px; }
.gantt-scroll-v2::-webkit-scrollbar-thumb { background: #bbb; border-radius: 5px; }
.gantt-scroll-v2::-webkit-scrollbar-thumb:hover { background: #999; }

.gantt-v2 {
  /* width は JS で px 指定される（スクロール用） */
  position: relative;
}

.gantt-head-v2,
.gantt-row-v2 {
  display: flex;
}
.gantt-head-v2 .gantt-months {
  /* 詳細ガントのみ3段ヘッダー対応：縦積み構造 */
  display: block;
  flex: 1;
  min-width: 0;
}
.gantt-row-v2 .gantt-tl-v2 {
  display: flex;
  flex: 1;
  min-width: 0;
}
.gantt-head-v2 .gantt-mh {
  flex: 1;
  min-width: 0;
}

/* 左列を固定幅に（gantt-v2のpx指定の前提） */
.gantt-head-v2 .gantt-lw,
.gantt-row-v2 .gantt-rl-v2 {
  flex-shrink: 0;
}

/* ドラッグ中のフロートツールチップ */
.gantt-drag-tooltip {
  position: fixed;
  background: #1a2a3a;
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.02em;
  white-space: nowrap;
  z-index: 10000;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  transform: translateY(-50%);
}
.gantt-drag-tooltip .dur {
  opacity: 0.7;
  margin-left: 8px;
  font-weight: 400;
}
.gantt-drag-tooltip::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  border-right: 5px solid #1a2a3a;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

/* ヘッダー */
.gantt-head-v2 {
  background: #eef1f5;
  border-bottom: 1px solid rgba(60, 70, 90, 0.25);
  border-top: 1px solid rgba(60, 70, 90, 0.18);
  font-size: 11px;
  /* 垂直スクロール時にヘッダーを上部固定 */
  position: sticky;
  top: 0;
  z-index: 20;
}
.gantt-head-v2 .gantt-lw {
  width: 180px;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: #333;
  letter-spacing: 0.04em;
  text-transform: none;
  background: #e9edf2;
  border-right: 1px solid rgba(60, 70, 90, 0.22);
  /* 水平スクロール時に左端固定（ヘッダー左上の角） */
  position: sticky;
  left: 0;
  z-index: 22;
}
.gantt-head-v2 .gantt-mh {
  font-size: 12px;
  font-weight: 700;
  color: #1a2a3a;
  letter-spacing: 0.04em;
  /* 月境界線は全段共通の縦線(.gantt-grid-line)が担当 */
  top: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}

/* 工種行（全行同じ高さに統一 + ゼブラ柄で視覚分離） */
/* Ver1.60〜：予定/現状/実績の3段バー対応のため 44px → 50px に拡張 */
.gantt-row-v2 {
  height: 50px;
  min-height: 50px;
  max-height: 50px;
  cursor: pointer;
  /* 罫線は子要素(.gantt-rl-v2, .gantt-tl-v2)に付けて右端まで確実に描画 */
  border-bottom: none !important;
  transition: background 0.12s;
  background: #ffffff;
}
/* 左カラム・タイムライン両方に同じ罫線を描くことで左端から右端まで一直線 */
.gantt-row-v2 .gantt-rl-v2,
.gantt-row-v2 .gantt-tl-v2 {
  border-bottom: 1px solid rgba(30, 40, 60, 0.35);
}
/* ゼブラ柄：偶数行に薄いグレー */
.gantt-row-v2:nth-child(even) {
  background: #fafbfc;
}
/* ゼブラ柄の左カラムも連動 */
.gantt-row-v2:nth-child(even) .gantt-rl-v2,
.gantt-row-v2:nth-child(even) .gantt-tl-v2 {
  background: #fafbfc;
}
.gantt-row-v2:hover {
  background: rgba(44, 110, 138, 0.08);
}
.gantt-row-v2:hover .gantt-rl-v2,
.gantt-row-v2:hover .gantt-tl-v2 {
  background: rgba(44, 110, 138, 0.08);
}
.gantt-row-v2:hover {
  background: rgba(44, 110, 138, 0.04);
}
.gantt-rl-v2 {
  width: 180px;
  flex-shrink: 0;
  padding: 8px 14px;
  border-right: 1px solid rgba(60, 70, 90, 0.22);  /* 濃くして左カラムをはっきり分離 */
  /* 背景はgantt-row-v2側(ゼブラ)から継承、sticky時の透け防止のためは下で上書き */
  background: inherit;
  /* 水平スクロール時に左端固定 */
  position: sticky;
  left: 0;
  z-index: 10;
  display: flex;
  align-items: center;  /* 縦中央寄せ */
}
.gantt-rl-v2 .phase-info-line {
  /* 1行に統一してellipsisで省略（行高44px固定のため） */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.gantt-rl-v2 .phase-name-pc {
  font-size: 13px;
  font-weight: 700;
}
.gantt-rl-v2 .phase-vendor-pc {
  font-size: 11px;
  color: #888;
  font-weight: 400;
  margin-left: 6px;
}

/* タイムライン */
.gantt-tl-v2 {
  flex: 1;
  position: relative;
  min-height: 50px;
  height: auto;  /* 左列が2行になっても白帯が出ないよう自動高 */
  background: inherit;  /* 行のゼブラ背景を継承 */
  /* 月境界の背景グリッド（CSS変数で月数を受け取る想定だが、シンプルに） */
}

/* ══════════════════════════════════════════════════════════════
   ガントバー3段構成（Ver1.60〜）
   予定（グレー・上段または中央）／ 現状（ブルー・中央メイン）／ 実績（赤・下段細）
   ══════════════════════════════════════════════════════════════ */

/* 予定バー（グレー） — 現状バー無し時は中央、現状バー有り時は is-compact で上段に */
.gantt-plan-bar-v2 {
  position: absolute;
  top: 50%;
  transform: translateY(calc(-50% - 4px));  /* 通常時：中央やや上（実績バーが下段にあるため） */
  height: 20px;
  border-radius: 3px;
  background: #9ca3af;  /* グレー */
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.15);
  cursor: grab;
  transition: box-shadow 0.12s, transform 0.12s;
  z-index: 2;
  user-select: none;
  touch-action: none;  /* ドラッグ時のブラウザ標準動作を抑制 */
}
.gantt-plan-bar-v2:hover:not(.is-locked):not(.is-dragging) {
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.25);
  transform: translateY(calc(-50% - 4.5px));
}
.gantt-plan-bar-v2 .bar-label {
  letter-spacing: 0.02em;
  pointer-events: none;  /* ラベルはクリック透過 */
}

/* 現状バーが存在する場合の予定バー：上段にコンパクト表示 */
.gantt-plan-bar-v2.is-compact {
  height: 12px;
  line-height: 12px;
  font-size: 9.5px;
  padding: 0 6px;
  transform: translateY(calc(-50% - 14px));
  background: #cbd5e1;  /* やや薄いグレー（控えめに） */
  opacity: 0.95;
}
.gantt-plan-bar-v2.is-compact:hover:not(.is-locked):not(.is-dragging) {
  transform: translateY(calc(-50% - 14.5px));
  background: #94a3b8;
}

/* ドラッグ中 */
.gantt-plan-bar-v2.is-dragging {
  cursor: grabbing !important;
  opacity: 0.88;
  z-index: 100;
  transition: none;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25), 0 4px 14px rgba(0,0,0,0.35);
}

/* ロック済：ドラッグ不可の視覚表現 */
.gantt-plan-bar-v2.is-locked {
  cursor: not-allowed !important;
  opacity: 0.78;
  box-shadow: inset 0 0 0 1.5px rgba(0,0,0,0.35), inset 0 -2px 0 rgba(0,0,0,0.2);
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0,
    transparent 5px,
    rgba(0,0,0,0.08) 5px,
    rgba(0,0,0,0.08) 7px
  );
}
.gantt-plan-bar-v2.is-locked:hover {
  transform: translateY(calc(-50% - 4px));
}
.gantt-plan-bar-v2.is-compact.is-locked:hover {
  transform: translateY(calc(-50% - 14px));
}

/* 現状バー（ブルー・中央メイン / Ver1.60〜） */
.gantt-current-bar-v2 {
  position: absolute;
  top: 50%;
  transform: translateY(calc(-50% + 2px));  /* 中央やや下（予定バーは上段に追いやられている） */
  height: 18px;
  border-radius: 3px;
  background: #3b82f6;  /* ブルー */
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18), 0 1px 3px rgba(59, 130, 246, 0.35);
  cursor: grab;
  transition: box-shadow 0.12s, transform 0.12s, background 0.12s;
  z-index: 4;
  user-select: none;
  touch-action: none;
}
.gantt-current-bar-v2:hover:not(.is-dragging) {
  background: #2563eb;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.25), 0 3px 8px rgba(59, 130, 246, 0.5);
  transform: translateY(calc(-50% + 1.5px));
}
.gantt-current-bar-v2 .bar-label {
  letter-spacing: 0.02em;
  pointer-events: none;
}
.gantt-current-bar-v2.is-dragging {
  cursor: grabbing !important;
  opacity: 0.9;
  z-index: 100;
  transition: none;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3), 0 4px 14px rgba(59, 130, 246, 0.55);
}

/* 実績バー（Ver1.65〜：進行中=ブルー、完了=レッドに統一） */
.gantt-actual-bar-v2 {
  position: absolute;
  top: 50%;
  transform: translateY(calc(-50% + 18px));  /* 現状バー(+2px,18px)の下に配置 */
  height: 4px;
  border-radius: 2px;
  z-index: 3;
}
.gantt-actual-bar-v2.is-done { background: #dc2626; }  /* 完了：レッド */
.gantt-actual-bar-v2.is-running {
  background: #3b82f6;  /* 進行中：ブルー（Ver1.65〜統一・現状バーと同色だが高さ4pxで区別） */
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

/* 未入力ラベル */
.gantt-empty-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 10px;
  font-size: 10px;
  color: #bbb;
  font-style: italic;
}

/* ══════════════════════════════════════════════════════════════
   工種一括選択モード（Ver1.61〜 / Session 62）
   ══════════════════════════════════════════════════════════════ */

/* 工種行のチェックボックスラベル */
.phase-bulk-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  margin-right: 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s;
}
.phase-bulk-checkbox:hover {
  background: rgba(59, 130, 246, 0.12);
}
.phase-bulk-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563eb;
}

/* 一括選択モード時の選択中行ハイライト */
.gantt-row-v2.is-bulk-selected,
.gantt-row-v2.is-bulk-selected .gantt-rl-v2,
.gantt-row-v2.is-bulk-selected .gantt-tl-v2 {
  background: rgba(59, 130, 246, 0.12) !important;
}
.gantt-row-v2.is-bulk-selected .gantt-rl-v2 {
  border-left: 3px solid #2563eb;
}

/* 一括選択ボタンのON状態 */
#phase-bulk-select-btn.is-on {
  font-weight: 700;
}

/* モバイル：タップターゲットを44px以上に */
@media (max-width: 768px) {
  .phase-bulk-checkbox {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }
  .phase-bulk-checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }
  #phase-bulk-toolbar {
    padding: 8px 10px;
    gap: 6px;
  }
  #phase-bulk-toolbar .btn {
    min-height: 36px;
  }
}

/* 年線（月境界の縦線） */
.gantt-row-v2 .gantt-tl-v2 .gantt-year-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(60, 70, 90, 0.22);  /* 日境界と同色（通常の年線はこれ） */
  z-index: 1;
}
.gantt-row-v2 .gantt-tl-v2 .gantt-year-line.is-month-first {
  background: rgba(40, 50, 70, 0.55);  /* 月境界：濃 */
  width: 1.5px;
}

/* 日の境界線（ズーム大のときのみ表示） */
.gantt-row-v2 .gantt-tl-v2 .gantt-day-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(60, 70, 90, 0.07);
  z-index: 1;
  pointer-events: none;
}

/* 正午線（半日境界、ズーム大のときのみ表示、点線で区別） */
.gantt-row-v2 .gantt-tl-v2 .gantt-noon-line {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 1px;
  border-left: 1px dashed rgba(60, 70, 90, 0.15);
  z-index: 1;
  pointer-events: none;
}

/* ══ ヘッダーtable構造（セル線が自動で揃う、colspanで月結合） ══ */
.gantt-months .gantt-head-table {
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
  font-family: 'DM Mono', monospace;
  /* widthはJS側でpx指定 */
}
.gantt-months .gantt-head-table col {
  /* colのwidthは<col style="width:...px">で指定済み */
}
.gantt-months .gantt-head-table th {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-weight: inherit;
  background: inherit;
  /* border-right は個別指定に任せる。box-sizing:border-boxでセル幅内に収まる */
}
/* 月行 */
.gantt-months .gantt-th-month {
  background: #e9edf2;
}
.gantt-months .gantt-th-m {
  height: 36px;
  font-size: 12px;
  font-weight: 700;
  color: #1a2a3a;
  letter-spacing: 0.04em;
  text-align: center;
  vertical-align: middle;
  background: #e9edf2;
}
.gantt-months .gantt-th-m.is-even { background: #e3e8ef; }
.gantt-months .gantt-th-m.is-odd  { background: #eff3f8; }
.gantt-months .gantt-th-m:last-child { }
/* 日行 */
.gantt-months .gantt-th-day {
  background: #f4f6f9;
}
.gantt-months .gantt-th-d {
  height: 22px;
  font-size: 10px;
  color: var(--ink3, #555);
  text-align: center;
  vertical-align: middle;
  font-weight: 600;
  border-top: 1px solid rgba(60, 70, 90, 0.22);
  background: #f4f6f9;
}
.gantt-months .gantt-th-d.month-first { }
.gantt-months .gantt-th-d.is-sun { background: rgba(239,68,68,0.15); color: #b91c1c; }
.gantt-months .gantt-th-d.is-sat { background: rgba(59,130,246,0.10); color: #1e40af; }
.gantt-months .gantt-th-d.is-holiday { background: rgba(34,197,94,0.18); color: #1e7a3a; }
.gantt-months .gantt-th-d.is-company { background: rgba(245,158,11,0.18); color: #b45309; }
/* 曜日行（V2詳細ガント） */
.gantt-months .gantt-th-wk-v2 {
  height: 16px;
  font-size: 9px;
  color: var(--ink4, #888);
  text-align: center;
  vertical-align: middle;
  font-weight: 600;
  border-top: 1px solid rgba(60, 70, 90, 0.15);
  background: #fafbfc;
  font-family: 'Noto Sans JP', 'Hiragino Sans', sans-serif;
  letter-spacing: 0;
}
.gantt-months .gantt-th-wk-v2.is-sun      { background: rgba(239,68,68,0.10); color: #b91c1c; }
.gantt-months .gantt-th-wk-v2.is-holiday  { background: rgba(34,197,94,0.12); color: #1e7a3a; }
.gantt-months .gantt-th-wk-v2.is-sat      { background: rgba(59,130,246,0.08); color: #1e40af; }
.gantt-months .gantt-th-wk-v2.is-company  { background: rgba(245,158,11,0.12); color: #b45309; }
/* AM/PM行 */
.gantt-months .gantt-th-half {
  background: #f4f6f9;
}
.gantt-months .gantt-th-h {
  height: 20px;
  font-size: 9px;
  color: var(--ink4, #888);
  text-align: center;
  vertical-align: middle;
  font-weight: 500;
  border-top: 1px solid rgba(60, 70, 90, 0.22);
  background: #f4f6f9;
}
.gantt-months .gantt-th-am { }
.gantt-months .gantt-th-pm { }
.gantt-months .gantt-th-h.month-first { }

/* ヘッダー上の縦罫線（本体側と同じ座標計算でpx絶対配置） */
.gantt-header-gridlines-overlay .gantt-hdr-gl {
  position: absolute;
  top: 0;
  bottom: 0;
}
.gantt-header-gridlines-overlay .gantt-hdr-gl-month {
  width: 1.5px;
  background: rgba(40, 50, 70, 0.65);
}
.gantt-header-gridlines-overlay .gantt-hdr-gl-day {
  width: 1px;
  background: rgba(60, 70, 90, 0.10);
  top: 36px;  /* 月行は貫かない。日行・AM/PM行のみ */
}
.gantt-header-gridlines-overlay .gantt-hdr-gl-noon {
  width: 0;
  border-left: 1px dashed rgba(60, 70, 90, 0.12);
  top: 58px;  /* 月行・日行は貫かない。AM/PM行のみ */
}

/* ══ ヘッダー3段化 ══ */
.gantt-months .gantt-header-row {
  position: relative;
  width: 100%;
}
/* ヘッダー3段を貫通する縦罫線のコンテナ（月・日・正午線） */
.gantt-months .gantt-header-gridlines {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 2;
}
.gantt-months .gantt-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
}
.gantt-months .gantt-gridline.gl-month {
  width: 1.5px;
  background: rgba(40, 50, 70, 0.65);
}
.gantt-months .gantt-gridline.gl-day {
  background: rgba(60, 70, 90, 0.10);
}
.gantt-months .gantt-gridline.gl-noon {
  border-left: 1px dashed rgba(60, 70, 90, 0.12);
  top: 36px;  /* 月ヘッダーにはかからず、日・AM/PM段のみ */
}
.gantt-months .gantt-header-month {
  position: relative;  /* 子要素(.gantt-mh)の絶対配置基準 */
  display: block;
  height: 36px;
  background: #e9edf2;
}
.gantt-months .gantt-header-day,
.gantt-months .gantt-header-half {
  height: 22px;
  border-top: 1px solid rgba(60,70,90,0.22);
  display: block;
  position: relative;  /* 子要素(.gantt-dh/.gantt-hh)の絶対配置基準 */
  background: #f4f6f9;
}
.gantt-months .gantt-dh,
.gantt-months .gantt-hh {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--ink3, #555);
  /* 境界線は .gantt-grid-line 1本に統一（セルごとのborderは持たない） */
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
  font-weight: 600;
}
.gantt-months .gantt-hh {
  font-size: 9px;
  color: var(--ink4, #888);
  font-weight: 500;
}
/* AM-PM 間のヘッダー境界は点線で正午線(tl-v2内)と視覚揃える */
/* セルにborderを持たせず、別途 .gantt-grid-line に dashed を付けて描画 */

/* ══ 休日帯（全行の背景縦帯）══ */
.gantt-row-v2 .gantt-tl-v2 .gantt-holiday-band {
  position: absolute;
  top: 0;
  bottom: 1px;   /* 行下罫線を隠さない */
  z-index: 0;
  pointer-events: none;
}
.gantt-hb-sun { background: rgba(239, 68, 68, 0.07); }     /* 日 ピンク系 */
.gantt-hb-sat { background: rgba(59, 130, 246, 0.05); }    /* 土 ブルー系 */
.gantt-hb-holiday { background: rgba(34, 197, 94, 0.10); } /* 祝日 グリーン系 */
.gantt-hb-company { background: rgba(245, 158, 11, 0.11); }/* 社内休業 */

/* 本日ライン */
.gantt-row-v2 .gantt-tl-v2 .gantt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: #e53935;
  z-index: 4;
  pointer-events: none;
}
.gantt-bar {
  position: absolute; height: 22px; top: 12px;
  display: flex; align-items: center; padding: 0 8px;
  font-size: 10px; font-weight: 600;
  white-space: nowrap; overflow: hidden;
  border-radius: 3px;
}
.gb-active { background: var(--blue-mid); color: #fff; }
.gb-plan   { background: var(--blue-pale); color: var(--blue); border: 1.5px solid var(--blue-light); }
.gb-done   { background: var(--bg2); color: var(--ink3); }
.gb-talk   { background: var(--bg2); color: var(--ink4); border: 1px dashed var(--border2); }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 1.5px; background: var(--red); opacity: 0.5; pointer-events: none; }

/* ════ 資金繰り ════ */
.cf-section td { background: var(--blue-ghost); color: var(--blue); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; padding: 7px 16px !important; }
.cf-total td { background: var(--surface2); font-weight: 700; border-top: 1px solid var(--border2) !important; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ════ モーダル ════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,35,55,0.45); backdrop-filter: blur(3px); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; width: 540px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(20,35,55,0.2); animation: fadeUp 0.2s ease; }
.modal-header { padding: 20px 22px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.modal-close { background: none; border: none; color: var(--ink4); font-size: 18px; cursor: pointer; width: 28px; height: 28px; border-radius: 4px; transition: background 0.15s; }
.modal-close:hover { background: var(--bg2); }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ════ トースト ════ */
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--ink); color: #fff; border-radius: var(--radius); padding: 11px 18px; font-size: 13px; box-shadow: var(--shadow); z-index: 999; display: none; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ════ 顧客情報 ════ */
.karute-list { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 14px; }
.karute-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 14px;
  cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
  box-shadow: var(--shadow-sm);
}
.karute-card:hover { border-color: var(--blue-light); box-shadow: var(--shadow); }
.karute-card-name { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.karute-card-sub  { font-size: 11px; color: var(--ink4); margin-bottom: 12px; }
.karute-card-stats { display: flex; gap: 14px; }
.karute-stat { text-align: center; }
.karute-stat-val { font-family: 'DM Mono',monospace; font-size: 16px; font-weight: 600; color: var(--ink); }
.karute-stat-lbl { font-size: 9px; color: var(--ink4); letter-spacing: 0.5px; text-transform: uppercase; margin-top: 1px; }

.k-detail { display: none; }
.k-detail.open { display: block; }
.k-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink3); cursor: pointer; margin-bottom: 18px; padding: 6px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); transition: all 0.15s; }
.k-back:hover { color: var(--blue); border-color: var(--blue-light); }
.k-name-header { font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.k-sub-header  { font-size: 12px; color: var(--ink3); margin-bottom: 20px; }
.k-section { margin-bottom: 20px; }
.k-section-title { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink3); margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.k-section-title::after { content:''; flex:1; height:1px; background:var(--border); }

.link-name {
  color: var(--blue); cursor: pointer; font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.link-name:hover { border-bottom-color: var(--blue-light); }

/* ════ ログイン画面 ════ */
#login-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 44px 40px 36px;
  width: 400px; box-shadow: 0 8px 40px rgba(30,45,66,0.12);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .icon { font-size: 32px; margin-bottom: 8px; }
.login-logo .name { font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: 1px; }
.login-logo .sub  { font-size: 11px; color: var(--ink4); margin-top: 4px; letter-spacing: 2px; text-transform: uppercase; }
.role-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 20px; }
.role-btn {
  padding: 12px 8px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--surface);
  cursor: pointer; text-align: center; transition: all 0.15s;
  user-select: none;
}
.role-btn:hover { border-color: var(--blue-light); background: var(--blue-ghost); }
.role-btn.selected { border-color: var(--blue-mid); background: var(--blue-ghost); }
.role-btn .role-icon { font-size: 20px; margin-bottom: 4px; }
.role-btn .role-name { font-size: 12px; font-weight: 700; color: var(--ink); }
.role-btn .role-desc { font-size: 10px; color: var(--ink4); margin-top: 2px; }
.login-error { color: var(--red); font-size: 12px; text-align: center; min-height: 18px; margin-top: 8px; }

/* ════ ロールバッジ（サイドバー）════ */
.role-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; padding: 3px 9px;
  border-radius: 10px; letter-spacing: 0.5px;
}
.role-chip.owner   { background: rgba(200,146,42,0.2); color: #c8922a; }
.role-chip.admin   { background: rgba(220,53,69,0.18); color: #dc3545; }
.role-chip.manager { background: rgba(59,130,246,0.15); color: var(--blue-mid); }
.role-chip.finance { background: rgba(180,83,9,0.15); color: #B45309; }
.role-chip.accounting { background: rgba(14,116,144,0.15); color: #0E7490; }
.role-chip.member  { background: rgba(107,127,150,0.15); color: var(--ink3); }

/* ════ お知らせ反応ボタン（いいね・了解）════ */
.notice-react-btn {
  user-select: none;
}
.notice-react-btn:hover:not(:disabled) {
  opacity: 1 !important;
  background: var(--surface2) !important;
  border-color: var(--ink4) !important;
}
.notice-react-btn:disabled {
  cursor: default;
  opacity: 0.5 !important;
}

/* ════ ファイル添付 ════ */
.attach-chip {
  display:flex;align-items:center;gap:8px;padding:7px 10px;
  background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);
  font-size:12px;color:var(--ink2);
}
.attach-icon { font-size:16px;flex-shrink:0; }
.attach-name { flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0; }
.attach-size { font-size:10px;color:var(--ink4);white-space:nowrap; }
.attach-download {
  display:inline-flex;align-items:center;gap:4px;padding:2px 8px;font-size:11px;
  background:var(--blue-ghost);color:var(--blue-mid);border-radius:3px;cursor:pointer;
  border:1px solid var(--blue-pale);text-decoration:none;white-space:nowrap;
}
.attach-download:hover { background:var(--blue-pale); }

/* ════ お知らせ・回覧・承認 共通 ════ */
.feed-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  margin-bottom: 10px; transition: box-shadow 0.15s;
}
.feed-item:hover { box-shadow: var(--shadow); }
.feed-item.unread { border-left: 3px solid var(--blue-mid); }
.feed-meta { font-size: 11px; color: var(--ink4); display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.feed-title { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.feed-body  { font-size: 13px; color: var(--ink2); line-height: 1.6; white-space: pre-wrap; }
.feed-footer { margin-top: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 承認ステータス */
.apv-pending  { background: var(--amber-pale); color: var(--amber); }
.apv-approved { background: var(--green-pale); color: var(--green); }
.apv-rejected { background: var(--red-pale);   color: var(--red); }

/* 回覧確認 */
.circ-check { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.circ-chip {
  font-size: 10px; padding: 3px 9px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface2); color: var(--ink3);
  display: inline-flex; align-items: center; gap: 4px;
}
.circ-chip.done { background: var(--green-pale); color: var(--green); border-color: #b8dfc4; }

/* ════ 管理者パネル ════ */
.admin-section { margin-bottom: 28px; }
.admin-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink3);
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.admin-section-title::after { content:''; flex:1; height:1px; background:var(--border); }
.admin-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.admin-row {
  display: flex; align-items: center; padding: 13px 18px;
  border-bottom: 1px solid var(--border); gap: 14px;
}
.admin-row:last-child { border-bottom: none; }
.admin-row:hover { background: var(--surface2); }
.admin-row-label { flex: 1; }
.admin-row-label .title { font-size: 13px; font-weight: 600; color: var(--ink); }
.admin-row-label .desc  { font-size: 11px; color: var(--ink4); margin-top: 2px; }
.admin-danger { border-color: #f0c0bc !important; }
.admin-danger .admin-row { border-bottom-color: #f0c0bc; }
.admin-danger .admin-row:hover { background: var(--red-pale); }

/* ════ 日報カレンダー ════ */
.np-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 3px; text-align: center;
}
.np-cal-dow {
  font-size: 10px; font-weight: 700; color: var(--ink4);
  padding: 4px 0; letter-spacing: 0.5px;
}
.np-cal-day {
  position: relative; padding: 6px 2px; border-radius: 6px;
  font-size: 12px; cursor: pointer; min-height: 38px;
  display: flex; flex-direction: column; align-items: center;
  transition: background 0.12s;
}
.np-cal-day:hover { background: var(--blue-ghost); }
.np-cal-day.today { background: var(--blue-pale); font-weight: 700; color: var(--blue); }
.np-cal-day.selected { background: var(--blue-mid); color: #fff; font-weight: 700; }
.np-cal-day.selected:hover { background: var(--blue); }
.np-cal-day.other-month { opacity: 0.3; }
.np-cal-day.sun { color: var(--red); }
.np-cal-day.sat { color: var(--blue-mid); }
.np-cal-day.selected.sun, .np-cal-day.selected.sat { color: #fff; }
.np-cal-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }

/* ════ 日報タイムライン ════ */
.np-hour-row {
  display: flex; align-items: stretch;
  border-bottom: 1px solid var(--border);
  min-height: 52px; cursor: pointer; position: relative;
  transition: background 0.1s;
}
.np-hour-row:hover { background: var(--blue-ghost); }
.np-hour-label {
  width: 44px; flex-shrink: 0; padding: 4px 6px 0;
  font-size: 10px; font-family: 'DM Mono', monospace;
  color: var(--ink4); text-align: right; border-right: 1px solid var(--border);
  line-height: 1;
}
.np-hour-slots { flex: 1; position: relative; min-height: 52px; }
/* タイムライン全体を覆う単一ブロック親レイヤー。
   pointer-events:none で空白部は np-hour-row の onclick（新規追加）が透過する。
   左オフセット 44px = .np-hour-label のボックス幅（border-box / 内側に padding+border 含む）。 */
.np-blocks-layer {
  position: absolute; top: 0; left: 44px; right: 0; bottom: 0;
  pointer-events: none;
}
.np-block {
  position: absolute; left: 4px; right: 4px;
  border-radius: 4px; padding: 3px 7px; font-size: 11px; font-weight: 600;
  cursor: grab; overflow: hidden; line-height: 1.3;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  transition: filter 0.15s;
  pointer-events: auto;
  touch-action: none; /* iPhone/iPad: スクロールと切り分けてドラッグ可能化 */
}
.np-block:hover { filter: brightness(0.92); }
.np-block .np-block-time { font-size: 10px; opacity: 0.75; font-weight: 400; font-family: 'DM Mono', monospace; }

/* 振り返り */
.np-q-block { margin-bottom: 16px; }
.np-q-label { font-size: 11px; font-weight: 700; color: var(--ink2); margin-bottom: 7px; letter-spacing: 0.3px; }
.np-toggle-row { display: flex; gap: 6px; }
.np-toggle {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink3); font-size: 12px; border-radius: var(--radius);
  transition: all 0.15s; padding: 7px 0;
}
.np-toggle.active {
  background: var(--blue-mid); border-color: var(--blue-mid);
  color: #fff; font-weight: 600;
}
.np-toggle.active-green  { background: var(--green);  border-color: var(--green);  color: #fff; font-weight: 600; }
.np-toggle.active-amber  { background: var(--amber);  border-color: var(--amber);  color: #fff; font-weight: 600; }
.np-toggle.active-red    { background: var(--red);    border-color: var(--red);    color: #fff; font-weight: 600; }

/* 振り返り：コンパクト横並びレイアウト */
#np-main-content {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.np-review-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.np-cond-inline {
  display: flex; align-items: center; gap: 5px;
}
.np-cond-label {
  font-size: 10px; color: var(--ink4); font-weight: 600;
  letter-spacing: 0.4px; margin-right: 2px;
}
.np-cond-pill {
  padding: 4px 10px; font-size: 11px; min-width: 64px;
  flex: 0 0 auto; justify-content: center;
}
.np-q-row {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; margin-bottom: 10px;
}
.np-q-label-inline {
  font-size: 11px; font-weight: 700; color: var(--ink2);
  letter-spacing: 0.3px; flex: 1; min-width: 200px;
}
.np-q-row .np-toggle-row { flex: 0 0 auto; }
.np-toggle-row-compact { gap: 4px; }
.np-toggle-pill {
  padding: 5px 14px; font-size: 11px; min-width: 76px;
  flex: 0 0 auto; justify-content: center;
}

/* 振り返りカード内のブロック間隔調整 */
#np-main-content .np-q-block { margin-bottom: 10px; }
#np-main-content .np-q-block:last-child { margin-bottom: 0; }

/* モバイル対応（≤768px）：横並びを縦積みに戻す */
@media (max-width: 768px) {
  #np-main-content { flex-direction: column; }
  #np-main-content > #np-timeline-card {
    flex: 1 1 auto !important; width: 100%; min-width: 0 !important;
  }
  .np-review-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .np-cond-inline { width: 100%; flex-wrap: wrap; }
  .np-cond-pill { flex: 1 1 0; min-width: 0; padding: 7px 10px; font-size: 12px; }
  .np-q-row { flex-direction: column; align-items: stretch; gap: 6px; }
  .np-q-label-inline { min-width: 0; flex: 0 0 auto; }
  .np-toggle-pill { flex: 1 1 0; min-width: 0; padding: 8px 4px; font-size: 12px; }
}

/* ════ マイTODO ════ */
.todo-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 16px;
  margin-bottom: 8px; display: flex; align-items: center; gap: 12px;
  transition: box-shadow 0.15s, opacity 0.2s;
}
.todo-item:hover { box-shadow: var(--shadow-sm); }
.todo-item.done { opacity: 0.5; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--ink3); }
.todo-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border2); cursor: pointer;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; background: var(--surface);
}
.todo-check:hover { border-color: var(--blue-mid); background: var(--blue-ghost); }
.todo-check.checked { background: var(--green); border-color: var(--green); color: #fff; }
.todo-text { flex: 1; font-size: 13px; color: var(--ink); line-height: 1.4; word-break: break-word; }
.todo-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.todo-due { font-size: 11px; font-family: 'DM Mono', monospace; padding: 2px 7px; border-radius: 3px; }
.todo-due.ok      { color: var(--ink3); background: var(--surface2); }
.todo-due.soon    { color: var(--amber); background: var(--amber-pale); }
.todo-due.overdue { color: var(--red); background: var(--red-pale); }
.todo-pri { font-size: 11px; font-weight: 700; }
.todo-drag { cursor: grab; color: var(--ink4); font-size: 16px; padding: 0 2px; flex-shrink: 0; }

/* ══ インライン編集（Step1） ══ */
.todo-text-editable { cursor: text; padding: 2px 4px; border-radius: 4px; transition: background 0.1s; }
.todo-text-editable:hover { background: var(--blue-ghost); }
.todo-item.done .todo-text-editable { cursor: default; }
.todo-item.done .todo-text-editable:hover { background: transparent; }

.todo-edit-input {
  width: 100%;
  border: 1.5px solid var(--blue-mid);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  box-shadow: 0 0 0 3px var(--blue-ghost);
}

.todo-pri-editable {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background 0.1s;
  user-select: none;
}
.todo-pri-editable:hover { background: var(--surface2); }
.todo-item.done .todo-pri-editable { cursor: default; pointer-events: none; }

.todo-due-editable { cursor: pointer; transition: filter 0.1s; }
.todo-due-editable:hover { filter: brightness(0.95); }
.todo-item.done .todo-due-editable { cursor: default; pointer-events: none; }

.todo-due-empty {
  cursor: pointer;
  color: var(--ink4);
  font-size: 11px;
  padding: 2px 7px;
  border: 1px dashed var(--border2);
  border-radius: 3px;
  transition: all 0.1s;
  background: transparent;
}
.todo-due-empty:hover {
  color: var(--blue-mid);
  border-color: var(--blue-mid);
  background: var(--blue-ghost);
}

/* 完了日時バッジ（案件タスクの doneBy 表示と同じ流儀の薄字斜体） */
.todo-doneat {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: #aaa;
  font-style: italic;
  white-space: nowrap;
}

/* ══ ドラッグ並び替え（Step2 / Pointer Events 対応） ══ */
.todo-drag {
  cursor: grab;
  color: var(--ink4);
  font-size: 14px;
  padding: 8px 6px;   /* タッチしやすいサイズに拡大 */
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: -3px;
  transition: color 0.1s, background 0.1s;
  border-radius: 4px;
  flex-shrink: 0;
  /* タッチでハンドルを掴んだ時にページスクロールを抑止 */
  touch-action: none;
  -webkit-touch-callout: none;
}
.todo-item:hover .todo-drag { color: var(--ink3); }
.todo-drag:hover { background: var(--surface2); }
.todo-drag:active { cursor: grabbing; background: var(--blue-ghost); color: var(--blue-mid); }
.todo-item.done .todo-drag { visibility: hidden; }

.todo-item.dragging {
  opacity: 0.3;
  background: var(--surface2);
  transition: opacity 0.15s, background 0.15s;
}

.todo-item.drag-over-top {
  box-shadow: inset 0 3px 0 var(--blue-mid);
}
.todo-item.drag-over-bot {
  box-shadow: inset 0 -3px 0 var(--blue-mid);
}

/* ドラッグ中のゴースト（カーソルに追従する複製） */
.todo-ghost {
  position: fixed !important;
  z-index: 99999 !important;
  pointer-events: none !important;
  opacity: 0.92 !important;
  transform: scale(1.02) rotate(-0.5deg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), 0 4px 8px rgba(0, 0, 0, 0.12) !important;
  border: 1.5px solid var(--blue-mid) !important;
  background: var(--surface) !important;
  margin: 0 !important;
  transition: none !important;
  cursor: grabbing !important;
}
.todo-ghost .todo-drag { color: var(--blue-mid) !important; }

/* ══ みんなのタスク（Step3） ══ */
.team-member-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.team-member-card:hover { box-shadow: var(--shadow-sm); }

.team-member-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  background: var(--surface);
  transition: background 0.1s;
}
.team-member-header:hover { background: var(--surface2); }

.team-member-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  flex-wrap: wrap;
}
.team-arrow {
  font-size: 10px;
  color: var(--ink3);
  width: 12px;
  display: inline-block;
  text-align: center;
}
.team-role-badge {
  font-size: 10px;
  color: var(--ink3);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 500;
}

.team-member-counts {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.team-count {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--surface2);
  color: var(--ink3);
  font-weight: 600;
}
.team-count-overdue {
  background: var(--red-pale);
  color: var(--red);
}

.team-member-tasks {
  padding: 0 16px 12px 16px;
  border-top: 1px solid var(--border);
}
.team-no-tasks {
  padding: 14px 0;
  color: var(--ink4);
  font-size: 12px;
  text-align: center;
}

.team-todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.team-todo-item:last-child { border-bottom: none; }

.team-todo-lock {
  width: 20px;
  text-align: center;
  font-size: 12px;
  opacity: 0.4;
  flex-shrink: 0;
}

/* ══ カテゴリ機能（Step4） ══ */
.todo-cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.todo-cat-header {
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  background: linear-gradient(to right, var(--surface2), var(--surface));
  transition: background 0.1s;
}
.todo-cat-header:hover { background: var(--surface2); }

.todo-cat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  flex: 1;
  min-width: 0;
}
.todo-cat-arrow {
  font-size: 10px;
  color: var(--ink3);
  width: 12px;
  display: inline-block;
  text-align: center;
  flex-shrink: 0;
}
.todo-cat-icon { font-size: 14px; flex-shrink: 0; }
.todo-cat-name {
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-cat-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.cat-badge {
  font-size: 11px;
  font-family: 'DM Mono', monospace;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink3);
  font-weight: 600;
  border: 1px solid var(--border);
}
.cat-badge-overdue {
  background: var(--red-pale);
  color: var(--red);
  border-color: #f0c0bc;
}

.todo-cat-body {
  padding: 8px 12px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.todo-cat-body .todo-item {
  margin-bottom: 6px;
}

/* カテゴリチップ（タスク行内の分類表示ボタン） */
.todo-cat-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink3);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.1s;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.todo-cat-chip:hover {
  border-color: var(--blue-mid);
  color: var(--blue-mid);
  background: var(--blue-ghost);
}
.todo-item.done .todo-cat-chip { pointer-events: none; opacity: 0.5; }

/* カテゴリヘッダーのドラッグハンドル */
.todo-cat-drag {
  width: 22px;
  color: var(--ink4);
  font-size: 13px;
  padding: 4px 2px;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  letter-spacing: -3px;
  touch-action: none;
  cursor: grab;
  flex-shrink: 0;
  text-align: center;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.todo-cat-drag:hover { color: var(--ink3); background: var(--surface); }
.todo-cat-drag:active { cursor: grabbing; color: var(--blue-mid); background: var(--blue-ghost); }

/* カテゴリ全体のタイトルは onclick で開閉 */
.todo-cat-title { cursor: pointer; }
.todo-cat-badges { cursor: pointer; }

/* カテゴリドラッグ中 */
.todo-cat-card.cat-dragging {
  opacity: 0.3;
  transition: opacity 0.15s;
}

/* カテゴリのドロップ位置インジケーター */
.todo-cat-card.cat-drag-over-top {
  box-shadow: inset 0 4px 0 var(--blue-mid);
}
.todo-cat-card.cat-drag-over-bot {
  box-shadow: inset 0 -4px 0 var(--blue-mid);
}

/* カテゴリのゴースト */
.todo-cat-ghost {
  position: fixed !important;
  z-index: 99999 !important;
  pointer-events: none !important;
  opacity: 0.92 !important;
  transform: scale(1.01) rotate(-0.3deg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), 0 4px 8px rgba(0, 0, 0, 0.12) !important;
  border: 1.5px solid var(--blue-mid) !important;
  background: var(--surface) !important;
  margin: 0 !important;
  transition: none !important;
}

/* タスクをカテゴリ内にドロップするときのハイライト */
.todo-cat-body.drag-over-cat {
  background: var(--blue-ghost);
  box-shadow: inset 0 0 0 2px var(--blue-mid);
  border-radius: 4px;
}

/* カテゴリが空の時の表示 */
.todo-cat-empty {
  padding: 12px;
  color: var(--ink4);
  font-size: 11px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 4px;
  margin: 4px 0;
}

/* ══ 工種ドラッグ並び替え ══ */
.phase-drag-cell {
  width: 24px;
  padding: 0 !important;
  text-align: center;
}
.phase-drag-handle {
  display: inline-block;
  padding: 6px 4px;
  color: var(--ink4);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  letter-spacing: -3px;
  font-size: 13px;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.phase-drag-handle:hover { color: var(--ink3); background: var(--surface2); }
.phase-drag-handle:active { cursor: grabbing; color: var(--blue-mid); background: var(--blue-ghost); }

tr.phase-row.dragging { opacity: 0.3; }
tr.phase-row.drag-over-top td { box-shadow: inset 0 3px 0 var(--blue-mid); }
tr.phase-row.drag-over-bot td { box-shadow: inset 0 -3px 0 var(--blue-mid); }

.phase-row-ghost {
  position: fixed;
  z-index: 99999;
  pointer-events: none;
  opacity: 0.9;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  border: 1.5px solid var(--blue-mid);
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}
.phase-row-ghost table { margin: 0; }

/* ══ 印刷：工程表 A3 横 専用ビュー v2026-04-16-v4 (週単位復帰・バーに工種名) ══ */
#print-area { display: none; }

@media print {
  @page {
    size: 420mm 297mm;  /* A3 横を実寸で指定（"A3 landscape"より確実） */
    margin: 5mm;
  }

  body.printing-schedule { background: #fff !important; }
  body.printing-schedule > *:not(#print-area) { display: none !important; }
  body.printing-schedule #print-area {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* 自動改ページを防ぐ：1ページ内での強制的な収まり */
  .sch-print-page {
    page-break-inside: avoid;
  }
}

/* ── 印刷ビューのレイアウト ── */
.sch-print-page {
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Meiryo', sans-serif;
  color: #222;
  font-size: 10px;
  line-height: 1.3;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  page-break-after: always;
}
.sch-print-page:last-child { page-break-after: auto; }

/* ══ ヘッダー ══ */
.sch-print-header {
  margin-bottom: 10px;
}

/* 上段：会社名 + 印刷日 */
.sch-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8.5px;
  color: #7a7a7a;
  padding-bottom: 4px;
}
.sch-header-top .brand { letter-spacing: 0.03em; font-weight: 500; }
.sch-header-top .brand-en {
  color: #999;
  letter-spacing: 0.15em;
  margin-right: 8px;
  font-size: 8px;
}
.sch-header-top .print-date {
  font-family: 'DM Mono', monospace;
  font-size: 8.5px;
  color: #999;
}

/* タイトル：中央大きく、下に細い装飾ライン */
.sch-header-title {
  text-align: center;
  padding: 2px 0 0 0;
}
.sch-header-title h1.sch-title,
.sch-header-title h1 {
  display: inline-block;
  position: relative;
  font-size: 26px;
  font-weight: 500;
  margin: 0;
  padding: 0 0 10px 0.08em;  /* 右側letter-spacingを左paddingで相殺 */
  letter-spacing: 0.08em;
  color: #1a2a3a;
  line-height: 1.1;
}
.sch-header-title h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -80px;
  right: -80px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent 0%, #2c6e8a 20%, #2c6e8a 80%, transparent 100%);
  border-radius: 1px;
}

/* 下段：案件情報 + メタ */
.sch-info-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  padding: 10px 0 8px 0;
  border-bottom: 1px solid #d0d5db;
}
.sch-project .job-no {
  display: inline-block;
  font-size: 10px;
  color: #2c6e8a;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.06em;
  background: #e8f0f5;
  padding: 1px 8px;
  border-radius: 3px;
  margin-bottom: 4px;
}
.sch-project .project-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a2a3a;
  line-height: 1.2;
}
.sch-project .project-sub {
  margin-top: 4px;
  font-size: 10px;
  color: #666;
}
.sch-project .project-sub .dot {
  color: #ccc;
  margin: 0 6px;
}

.sch-meta-tbl {
  border-collapse: collapse;
  font-size: 9.5px;
}
.sch-meta-tbl th,
.sch-meta-tbl td {
  border: 1px solid #d8dde3;
  padding: 3px 8px;
  text-align: left;
  vertical-align: middle;
  line-height: 1.25;
}
.sch-meta-tbl th {
  background: #f4f6f8;
  font-weight: 500;
  color: #555;
  white-space: nowrap;
}

/* ── サマリーバンド ── */
.sch-print-summary {
  display: flex;
  gap: 18px;
  padding: 5px 12px;
  background: #fafbfc;
  border: 1px solid #e0e4e9;
  border-radius: 3px;
  margin-bottom: 8px;
  font-size: 10px;
  align-items: center;
}
.sch-print-summary .lbl {
  color: #888;
  font-size: 8.5px;
  margin-right: 5px;
  letter-spacing: 0.04em;
}
.sch-print-summary .val {
  font-weight: 700;
  font-size: 11px;
  color: #1a2a3a;
}
.sch-print-summary .sch-page-indicator {
  margin-left: auto;
  color: #2c6e8a;
  font-weight: 600;
  font-size: 9.5px;
  font-family: 'DM Mono', monospace;
}

/* ══ ガントチャート（週単位・バーは1本描画） ══ */
.sch-gantt-wrap {
  width: 100%;
}
.sch-gantt-weekly {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 9px;
  border: 1px solid rgba(60, 70, 90, 0.35);
}
.sch-gantt-weekly th,
.sch-gantt-weekly td {
  padding: 0;
  text-align: center;
  vertical-align: middle;
  border: none;
}

/* 月行 */
.sch-gantt-weekly .sch-row-month th.sch-month-cell {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 0;
  background: #e9edf2;
  color: #1a2a3a;
  border-bottom: 1px solid rgba(60, 70, 90, 0.25);
  border-right: 1px solid rgba(60, 70, 90, 0.18);
  letter-spacing: 0.04em;
}
.sch-gantt-weekly .sch-row-month th.sch-col-fixed,
.sch-gantt-weekly .sch-row-month th.sch-col-period {
  background: #eef1f5;
  border-right: 1px solid rgba(60, 70, 90, 0.22);
  border-bottom: 1px solid rgba(60, 70, 90, 0.25);
  color: #333;
  font-weight: 600;
  font-size: 10px;
}

/* 週頭日付行 */
.sch-gantt-weekly .sch-row-week th.sch-week-cell {
  font-size: 9px;
  font-weight: 500;
  padding: 2px 0;
  background: #f6f8fa;
  color: #555;
  border-right: 1px solid rgba(60, 70, 90, 0.10);
  border-bottom: 1px solid rgba(60, 70, 90, 0.25);
  height: 16px;
  font-family: 'DM Mono', monospace;
}
.sch-gantt-weekly .sch-row-week th.sch-week-cell.month-first {
  border-left: 1px solid rgba(40, 50, 70, 0.35);
  background: #eef3f7;
}

/* 固定列 */
.sch-gantt-weekly .sch-col-fixed {
  width: 130px;
  padding: 4px 8px !important;
  text-align: left !important;
  vertical-align: middle;
  border-right: 1px solid rgba(60, 70, 90, 0.22) !important;
  background: #fff;
}
.sch-gantt-weekly .sch-col-fixed .phase-info {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  word-break: break-all;
}
.sch-gantt-weekly .sch-col-fixed .phase-name {
  font-size: 10px;
  font-weight: 700;
  color: #222;
}
.sch-gantt-weekly .sch-col-fixed .phase-vendor {
  font-size: 8.5px;
  color: #888;
  font-weight: 400;
  margin-left: 5px;
}
.sch-gantt-weekly .sch-col-period {
  width: 110px;
  padding: 4px 8px !important;
  text-align: left !important;
  vertical-align: middle;
  border-right: 1px solid rgba(60, 70, 90, 0.22) !important;
  background: #fff;
}
.sch-gantt-weekly .sch-col-period .phase-date {
  font-size: 9px;
  color: #444;
  white-space: nowrap;
  font-family: 'DM Mono', monospace;
  line-height: 1.3;
}
.sch-gantt-weekly .sch-col-period .phase-actual {
  color: #1565c0;
  margin-top: 1px;
}

/* ガントtrack：colspan=全週の1セル */
.sch-gantt-weekly .sch-gantt-track {
  padding: 0 !important;
  height: 24px;
  vertical-align: middle;
  position: relative;
  background: #fff;
  border-bottom: 1px solid rgba(60, 70, 90, 0.10) !important;
}
.sch-gantt-weekly .sch-phase-row:last-child .sch-gantt-track {
  border-bottom: none !important;
}
.sch-gantt-weekly .track-inner {
  position: relative;
  height: 24px;
  width: 100%;
}

/* 工種情報列の下線 */
.sch-gantt-weekly .sch-phase-row td.sch-col-fixed,
.sch-gantt-weekly .sch-phase-row td.sch-col-period {
  border-bottom: 1px solid rgba(60, 70, 90, 0.14) !important;
}

/* 背景グリッド：週境界（薄い縦線） */
.sch-gantt-weekly .grid-week {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(60, 70, 90, 0.08);
}
/* 背景グリッド：月境界（濃い縦線） */
.sch-gantt-weekly .grid-month {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(40, 50, 70, 0.35);
}

/* ── 計画バー（1本、工種名入り） ── */
.sch-gantt-weekly .plan-bar {
  position: absolute;
  top: 4px;
  height: 16px;
  border-radius: 2.5px;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 -1.5px 0 rgba(0,0,0,0.15), 0 1px 2px rgba(0,0,0,0.12);
  z-index: 2;
}
.sch-gantt-weekly .plan-bar-label {
  letter-spacing: 0.02em;
}

/* 実績バー（計画の下に細く） */
.sch-gantt-weekly .actual-bar {
  position: absolute;
  top: 20px;
  height: 3px;
  background: #1565c0;
  border-radius: 1.5px;
  z-index: 3;
}

/* 本日ライン（showTodayのみ） */
.sch-gantt-weekly .today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: #e53935;
  z-index: 5;
}

/* ══════════════════════════════════════════════════════════════ */
/* 日単位ガント（1日=2.5mm、3段ヘッダー：月/日/曜日）          */
/* ══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   印刷用ガントチャート v2 (div構造+px統一、画面版 renderDetailGantt 準拠)
   ══════════════════════════════════════════════════════════
   設計思想：
     - dayWidth は整数px。mm単位は一切使わない（mm→px変換の丸めを排除）
     - 全widthをpx明示（flex/%計算による丸め伝搬を排除）
     - 縦線は全て絶対配置px指定のオーバーレイ（セルborderの累積誤差を排除）
     - ヘッダーの table は colgroup で列幅固定のみ、縦線はオーバーレイが担当
*/
.sch2-gantt {
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Meiryo', sans-serif;
  font-size: 8px;
  color: #222;
  box-sizing: border-box;
  /* width はインラインで totalGanttWidth 指定 */
}

/* ── ヘッダー（月 / 日 / 曜日 の3段） ── */
.sch2-head {
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  border-top: 1px solid #9aa3ad;
  border-bottom: 1px solid #9aa3ad;
  background: #e9edf2;
}
.sch2-head-lw {
  flex: none;
  box-sizing: border-box;
  background: #e9edf2;
  border-right: 1.5px solid #4a5568;
  font-weight: 700;
  font-size: 10px;
  color: #1a2a3a;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
}
.sch2-head-tl {
  flex: none;
  box-sizing: border-box;
  position: relative;
}
.sch2-head-table {
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8px;
}
.sch2-head-table th {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border: 0;
  vertical-align: middle;
  text-align: center;
}
.sch2-head-table .sch2-th-m {
  height: 16px;
  background: #e9edf2;
  font-weight: 700;
  font-size: 10px;
  color: #1a2a3a;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #b0b8c0;
}
.sch2-head-table .sch2-th-m.is-even { background: #e3e8ef; }
.sch2-head-table .sch2-th-m.is-odd  { background: #eff3f8; }
.sch2-head-table .sch2-th-d {
  height: 14px;
  background: #f4f6f9;
  font-size: 7px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid #c8cdd3;
}
.sch2-head-table .sch2-th-d.is-sun      { background: #fde0e0; color: #c0392b; }
.sch2-head-table .sch2-th-d.is-holiday  { background: #d4f4de; color: #1e7a3a; }
.sch2-head-table .sch2-th-d.is-sat      { background: #e0ecfa; color: #1e40af; }
.sch2-head-table .sch2-th-d.is-company  { background: #fef3c7; color: #b45309; }
.sch2-head-table .sch2-th-w {
  height: 12px;
  background: #fafbfc;
  font-size: 6.5px;
  font-weight: 500;
  color: #666;
}
.sch2-head-table .sch2-th-w.is-sun      { color: #c0392b; background: #fde0e0; }
.sch2-head-table .sch2-th-w.is-holiday  { color: #1e7a3a; background: #d4f4de; }
.sch2-head-table .sch2-th-w.is-sat      { color: #1e40af; background: #e0ecfa; }
.sch2-head-table .sch2-th-w.is-company  { color: #b45309; background: #fef3c7; }

/* ヘッダー縦線オーバーレイ */
.sch2-hdr-overlay { z-index: 2; }
.sch2-hdr-gl {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  pointer-events: none;
}
/* 日境界は月ヘッダ（高さ16px）を貫かない */
.sch2-hdr-gl-day { top: 16px; }
.sch2-hdr-gl-month { border-left: 1.5px solid rgba(40, 50, 70, 0.65); }
.sch2-hdr-gl-day   { border-left: 1px solid rgba(60, 70, 90, 0.10); }

/* ── 本体：1行=左カラム + タイムライン ── */
.sch2-row {
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  border-bottom: 1px solid #d5d9de;
  height: 22px;
  background: #fff;
}
.sch2-row:nth-child(even) .sch2-tl,
.sch2-row:nth-child(even) .sch2-rl {
  background: #fafbfc;
}
.sch2-row:last-child { border-bottom: 1px solid #9aa3ad; }

.sch2-rl {
  flex: none;
  box-sizing: border-box;
  background: #fff;
  border-right: 1.5px solid #4a5568;
  padding: 2px 6px;
  display: flex;
  align-items: center;
}
.sch2-phase-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
  overflow: hidden;
}
.sch2-phase-name {
  font-weight: 700;
  font-size: 9px;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sch2-phase-vendor {
  font-size: 7px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sch2-tl {
  flex: none;
  box-sizing: border-box;
  position: relative;
  background: #fff;
  height: 100%;
  overflow: hidden;
}

/* ── 休日帯（行背景） ── */
.sch2-hb {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
}
.sch2-hb.hb-sun     { background: rgba(239, 68, 68, 0.10); }
.sch2-hb.hb-holiday { background: rgba(34, 197, 94, 0.12); }
.sch2-hb.hb-sat     { background: rgba(59, 130, 246, 0.07); }
.sch2-hb.hb-company { background: rgba(245, 158, 11, 0.12); }

/* ── 本体縦線 ── */
.sch2-gl {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  pointer-events: none;
  z-index: 1;
}
.sch2-gl-month { border-left: 1.5px solid rgba(40, 50, 70, 0.55); }
.sch2-gl-day   { border-left: 1px solid rgba(60, 70, 90, 0.07); }

/* ── 計画バー（Ver1.65〜：グレー統一） ── */
.sch2-plan-bar {
  position: absolute;
  top: 4px;
  height: 14px;
  border-radius: 2px;
  background: #9ca3af;  /* グレー：計画（Ver1.65〜色統一） */
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 4px;
  font-size: 8px;
  font-weight: 600;
  z-index: 3;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
}
.sch2-plan-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.sch2-plan-bar.is-locked {
  opacity: 0.85;
  border: 1px dashed rgba(255, 255, 255, 0.5);
}
.sch2-plan-bar.trunc-left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.sch2-plan-bar.trunc-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.sch2-trunc-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.85);
  z-index: 4;
  pointer-events: none;
}
.sch2-trunc-arrow.left  { left: 1px; }
.sch2-trunc-arrow.right { right: 1px; }

/* ── 実績バー（Ver1.65〜：進行中=ブルー / 完了=レッドに統一） ── */
.sch2-actual-bar {
  position: absolute;
  bottom: 1px;
  height: 3px;
  background: #3b82f6;  /* 既定（進行中相当）：ブルー */
  border-radius: 1px;
  z-index: 2;
}
.sch2-actual-bar.is-running { background: #3b82f6; }  /* 進行中：ブルー */
.sch2-actual-bar.is-done    { background: #dc2626; }  /* 完了：レッド */
.sch2-actual-bar.trunc-left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.sch2-actual-bar.trunc-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* ── 今日ライン ── */
.sch2-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: #e53935;
  z-index: 5;
  pointer-events: none;
}

/* 空のとき */
.sch2-empty {
  padding: 20px;
  text-align: center;
  color: #999;
  font-size: 10px;
}

/* ── 旧.sch-gantt-daily参照CSS互換用（他所で参照されていても害にならないダミー） ── */
.sch-gantt-daily { display: none; }

/* ── フッター ── */
.sch-print-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 5px;
  border-top: 1px solid #d0d5db;
  font-size: 8px;
  color: #aaa;
}

/* 画面時は非表示（デバッグで表示したい時は .show-print-preview を body に付ける） */
@media screen {
  body:not(.printing-schedule):not(.show-print-preview) #print-area { display: none !important; }
}

/* ══ 密度クラス（週単位ガント）：工期に応じて微調整 ══ */
/* 週単位なので、日単位ほど極端な調整は不要。文字サイズと高さのみ */

/* normal（〜90日 ≒ 13週）：既定 */
.density-normal .sch-gantt-weekly { font-size: 9px; }
.density-normal .sch-gantt-weekly .plan-bar { font-size: 9px; height: 16px; line-height: 16px; top: 4px; }
.density-normal .sch-gantt-weekly .sch-gantt-track { height: 24px; }

/* compact（91〜150日 ≒ 22週）：少し詰める */
.density-compact .sch-gantt-weekly { font-size: 8.5px; }
.density-compact .sch-gantt-weekly .plan-bar { font-size: 8.5px; padding: 0 4px; }
.density-compact .sch-gantt-weekly .sch-col-fixed { width: 120px; }
.density-compact .sch-gantt-weekly .sch-col-period { width: 100px; }

/* ultra（151〜200日 ≒ 29週）：最大密度 */
.density-ultra .sch-gantt-weekly { font-size: 8px; }
.density-ultra .sch-gantt-weekly .plan-bar { font-size: 8px; padding: 0 3px; }
.density-ultra .sch-gantt-weekly .sch-col-fixed { width: 110px; }
.density-ultra .sch-gantt-weekly .sch-col-period { width: 90px; }
.density-ultra .sch-gantt-weekly .sch-col-fixed .phase-name { font-size: 9px; }
.density-ultra .sch-gantt-weekly .sch-col-fixed .phase-vendor { font-size: 7.5px; }
.density-ultra .sch-gantt-weekly .sch-col-period .phase-date { font-size: 8px; }

/* ════════════════════════════════════════════════════════════
   案件ガント V2（詳細ガントと同じ px統一設計）
   ════════════════════════════════════════════════════════════ */
.gnt-scroll-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 320px);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
  scrollbar-color: #bbb #f0f0f0;
}
.gnt-scroll-wrap::-webkit-scrollbar { height: 10px; }
.gnt-scroll-wrap::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 5px; }
.gnt-scroll-wrap::-webkit-scrollbar-thumb { background: #bbb; border-radius: 5px; }
.gnt-scroll-wrap::-webkit-scrollbar-thumb:hover { background: #999; }

.gnt { position: relative; }

/* ヘッダー */
.gnt-head {
  display: flex;
  align-items: stretch;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 15;
}
.gnt-head-lw {
  flex: none;
  box-sizing: border-box;
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ink3);
  background: var(--surface2);
  border-right: 1.5px solid var(--border2);
  display: flex;
  align-items: center;
  position: sticky;
  left: 0;
  z-index: 20;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}
.gnt-head-tl {
  flex: none;
  box-sizing: border-box;
}
.gnt-head-table {
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 10px;
}
.gnt-head-table th {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border: 0;
  vertical-align: middle;
  text-align: center;
  position: relative;
}
.gnt-th-m {
  height: 24px;
  background: #e9edf2;
  font-weight: 700;
  font-size: 11px;
  color: #1a2a3a;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.gnt-th-m.is-even { background: #e3e8ef; }
.gnt-th-m.is-odd  { background: #eff3f8; }
.gnt-th-wk {
  height: 16px;
  background: #f0f3f7;
  font-size: 9px;
  font-weight: 600;
  color: var(--ink3);
  border-bottom: 1px solid var(--border);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.02em;
}
.gnt-th-d {
  height: 20px;
  background: #f4f6f9;
  font-size: 9px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid var(--border);
}
.gnt-th-d.is-sun      { background: #fde0e0; color: #c0392b; }
.gnt-th-d.is-holiday  { background: #d4f4de; color: #1e7a3a; }
.gnt-th-d.is-sat      { background: #e0ecfa; color: #1e40af; }
.gnt-th-d.is-company  { background: #fef3c7; color: #b45309; }
.gnt-th-w {
  height: 14px;
  background: #fafbfc;
  font-size: 8px;
  font-weight: 500;
  color: #666;
}
.gnt-th-w.is-sun      { color: #c0392b; background: #fde0e0; }
.gnt-th-w.is-holiday  { color: #1e7a3a; background: #d4f4de; }
.gnt-th-w.is-sat      { color: #1e40af; background: #e0ecfa; }
.gnt-th-w.is-company  { color: #b45309; background: #fef3c7; }

/* ヘッダー縦線オーバーレイ */
.gnt-hdr-overlay { pointer-events: none; }
.gnt-hdr-gl {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  pointer-events: none;
}
/* 週・日の縦線は月ヘッダ（高さ24px）を避ける */
.gnt-hdr-gl-week, .gnt-hdr-gl-day { top: 24px; }
.gnt-hdr-gl-month { border-left: 1.5px solid rgba(40, 50, 70, 0.65); }
.gnt-hdr-gl-week  { border-left: 1px solid rgba(60, 70, 90, 0.22); }
.gnt-hdr-gl-day   { border-left: 1px solid rgba(60, 70, 90, 0.08); }

/* 本体行 */
.gnt-row {
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.gnt-row:hover { background: var(--blue-ghost); }
.gnt-rl {
  flex: none;
  box-sizing: border-box;
  padding: 8px 14px;
  background: var(--surface);
  border-right: 1.5px solid var(--border2);
  position: sticky;
  left: 0;
  z-index: 10;
  /* スクロール時にバーが透けないよう完全不透明に */
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}
.gnt-row:hover .gnt-rl { background: var(--blue-ghost); }
.gnt-tl {
  flex: none;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  z-index: 0;
}

/* 休日帯 */
.gnt-hb {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
}
.gnt-hb.gnt-hb-sun     { background: rgba(239, 68, 68, 0.08); }
.gnt-hb.gnt-hb-sat     { background: rgba(59, 130, 246, 0.06); }
.gnt-hb.gnt-hb-holiday { background: rgba(34, 197, 94, 0.12); }
.gnt-hb.gnt-hb-company { background: rgba(245, 158, 11, 0.12); }

/* 本体縦線 */
.gnt-gl {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  pointer-events: none;
  z-index: 1;
}
.gnt-gl-month { border-left: 1.5px solid rgba(40, 50, 70, 0.55); }
.gnt-gl-week  { border-left: 1px solid rgba(60, 70, 90, 0.15); }
.gnt-gl-day   { border-left: 1px solid rgba(60, 70, 90, 0.07); }

/* バー */
.gnt-bar {
  position: absolute;
  height: 11px;
  border-radius: 2px;
  opacity: 0.85;
  overflow: hidden;
  box-sizing: border-box;
  z-index: 3;
}
.gnt-bar-label {
  position: absolute;
  left: 3px;
  top: 1px;
  font-size: 8px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

/* 今日ライン */
.gnt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e53935;
  z-index: 6;
  pointer-events: none;
  box-shadow: 0 0 3px rgba(229, 57, 53, 0.4);
}

/* 日ヘッダの showOnGantt マーク（休・会 等） */
.gantt-th-d {
  position: relative;
}
.gantt-day-num {
  display: block;
  line-height: 1;
}
.gantt-day-mark {
  display: inline-block;
  margin-top: 1px;
  padding: 0 3px;
  min-width: 11px;
  height: 11px;
  line-height: 11px;
  font-size: 9px;
  font-weight: 900;
  color: #fff;
  border-radius: 2px;
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.gantt-th-d:has(.gantt-day-mark) {
  padding-bottom: 1px;
}

/* ════════════════════════════════════════════════════════════
   年間行事カレンダー V2（詳細ガントと同じ px統一設計）
   ════════════════════════════════════════════════════════════ */
.ev-scroll-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
  scrollbar-color: #bbb #f0f0f0;
}
.ev-scroll-wrap::-webkit-scrollbar { height: 10px; }
.ev-scroll-wrap::-webkit-scrollbar-track { background: #f0f0f0; border-radius: 5px; }
.ev-scroll-wrap::-webkit-scrollbar-thumb { background: #bbb; border-radius: 5px; }
.ev-scroll-wrap::-webkit-scrollbar-thumb:hover { background: #999; }

.evg { position: relative; }

/* ヘッダー（3段） */
.evg-head {
  display: flex;
  align-items: stretch;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 15;
}
.evg-head-lw {
  flex: none;
  box-sizing: border-box;
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ink3);
  background: var(--surface2);
  border-right: 1.5px solid var(--border2);
  display: flex;
  align-items: center;
  position: sticky;
  left: 0;
  z-index: 20;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}
.evg-head-tl {
  flex: none;
  box-sizing: border-box;
}
.evg-head-table {
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 10px;
}
.evg-head-table th {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  border: 0;
  vertical-align: middle;
  text-align: center;
}
.evg-th-m {
  height: 24px;
  background: #e9edf2;
  font-weight: 700;
  font-size: 11px;
  color: #1a2a3a;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.evg-th-m.is-even { background: #e3e8ef; }
.evg-th-m.is-odd  { background: #eff3f8; }
.evg-th-d {
  height: 18px;
  background: #f4f6f9;
  font-size: 9px;
  font-weight: 600;
  color: #333;
  border-bottom: 1px solid var(--border);
}
.evg-th-d.is-sun      { background: #fde0e0; color: #c0392b; }
.evg-th-d.is-holiday  { background: #d4f4de; color: #1e7a3a; }
.evg-th-d.is-sat      { background: #e0ecfa; color: #1e40af; }
.evg-th-d.is-company  { background: #fef3c7; color: #b45309; }
.evg-th-w {
  height: 14px;
  background: #fafbfc;
  font-size: 8px;
  font-weight: 500;
  color: #666;
}
.evg-th-w.is-sun      { color: #c0392b; background: #fde0e0; }
.evg-th-w.is-holiday  { color: #1e7a3a; background: #d4f4de; }
.evg-th-w.is-sat      { color: #1e40af; background: #e0ecfa; }
.evg-th-w.is-company  { color: #b45309; background: #fef3c7; }

/* ヘッダー縦線オーバーレイ */
.evg-hdr-overlay { pointer-events: none; }
.evg-hdr-gl {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  pointer-events: none;
}
/* 日の縦線は月ヘッダ（高さ24px）を避ける */
.evg-hdr-gl-day { top: 24px; }
.evg-hdr-gl-month { border-left: 1.5px solid rgba(40, 50, 70, 0.65); }
.evg-hdr-gl-day   { border-left: 1px solid rgba(60, 70, 90, 0.08); }

/* 本体行 */
.evg-row {
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.evg-row:hover { background: var(--blue-ghost); }
.evg-rl {
  flex: none;
  box-sizing: border-box;
  padding: 8px 14px;
  background: var(--surface);
  border-right: 1.5px solid var(--border2);
  position: sticky;
  left: 0;
  z-index: 10;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
}
.evg-row:hover .evg-rl { background: var(--blue-ghost); }
.evg-tl {
  flex: none;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

/* 休日帯 */
.evg-hb {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
}
.evg-hb.evg-hb-sun     { background: rgba(239, 68, 68, 0.08); }
.evg-hb.evg-hb-sat     { background: rgba(59, 130, 246, 0.06); }
.evg-hb.evg-hb-holiday { background: rgba(34, 197, 94, 0.12); }
.evg-hb.evg-hb-company { background: rgba(245, 158, 11, 0.12); }

/* 本体縦線 */
.evg-gl {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  pointer-events: none;
  z-index: 1;
}
.evg-gl-month { border-left: 1.5px solid rgba(40, 50, 70, 0.55); }
.evg-gl-day   { border-left: 1px solid rgba(60, 70, 90, 0.07); }

/* 今日ライン */
.evg-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e53935;
  z-index: 6;
  pointer-events: none;
  box-shadow: 0 0 3px rgba(229, 57, 53, 0.4);
}
/* 年間行事カレンダー上のマーク表示ドット */
.cal-mark-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border: 1.5px solid #fff;
}

/* マーク選択モーダル：月カレンダーグリッド */
.cm-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  padding: 1px;
}
.cm-dow {
  padding: 6px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink3);
  background: var(--surface2);
  letter-spacing: 0.5px;
}
.cm-dow.is-sun { color: #c0392b; }
.cm-dow.is-sat { color: #1e40af; }

.cm-day-empty {
  background: var(--surface2);
  aspect-ratio: 1;
}
.cm-day {
  position: relative;
  background: var(--surface);
  aspect-ratio: 1;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, transform 0.1s;
  border: 2px solid transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.cm-day:hover { background: var(--blue-ghost); }
.cm-day.is-sun .cm-day-num,
.cm-day.is-holiday .cm-day-num { color: #c0392b; }
.cm-day.is-sat .cm-day-num { color: #1e40af; }
.cm-day.is-today {
  border-color: var(--blue-mid);
  box-shadow: inset 0 0 0 1px var(--blue-mid);
}
.cm-day.is-selected {
  /* 背景色・ボーダー色は JS から inline style で上書き（タイプ色に合わせる） */
}
.cm-day.is-selected .cm-day-num {
  color: #fff !important;
  font-weight: 800;
}
.cm-day-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
}
.cm-day.is-selected .cm-day-num {
  color: #fff;
}

/* 他タイプのマーク小ドット（複数表示時） */
.cm-other-dots {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}
.cm-other-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}

/* 選択済みリストのチップ */
.cm-selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 32px;
  max-height: 120px;
  overflow-y: auto;
  padding: 4px 2px;
}
.cm-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 8px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'DM Mono', monospace;
  border: 1.5px solid;
  border-radius: 4px;
  user-select: none;
  -webkit-user-select: none;
}
.cm-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.1s, background 0.1s;
}
.cm-chip-x:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

/* モバイル最適化 */
@media (max-width: 600px) {
  .cm-day-num { font-size: 12px; }
  .cm-dow { padding: 4px 0; font-size: 10px; }
}

/* ════ アクセス拒否 ════ */
.access-denied {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 40px; text-align: center; color: var(--ink4);
}
.access-denied .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.access-denied .msg  { font-size: 15px; font-weight: 600; color: var(--ink3); margin-bottom: 6px; }
.access-denied .sub  { font-size: 13px; }

/* ════ タブ ════ */
.tab-panel { display: none; contain: content; }
.tab-panel.active { display: block; animation: fadeUp 0.18s ease; }

/* スクロールバー */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ════ レスポンシブ対応 - 改善版 ════ */
/* デフォルト：3列グリッド */
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr) !important; }

/* タブレット（iPad縦・横） */
@media (max-width: 1200px) {
  .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* 支払い管理など grid-2 内テーブルのカラム圧縮 */
  .grid-2 .tbl th, .grid-2 .tbl td {
    padding: 8px 6px;
    font-size: 11px;
    white-space: nowrap;
  }
  /* 支払先・案件名など長い列だけは折り返し許可 */
  .grid-2 .tbl td:first-child { white-space: normal; word-break: break-word; min-width: 90px; }
}
@media (max-width: 1024px) {
  .sidebar { width: 200px; }
  .main { margin-left: 200px; }
  .content { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
  .kpi-grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-2 { grid-template-columns: 1fr; }
  /* タッチターゲット最低44px（Apple HIG） */
  .btn { min-height: 38px; padding: 8px 14px; }
  .btn-primary, .btn-danger { min-height: 42px; }
  .form-input, .form-select { min-height: 42px; padding: 8px 12px; }
  .nav-item { padding: 12px 18px; min-height: 44px; }
}

/* スマートフォン（iPhone） */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 260px;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 12px; }
  .topbar { padding: 0 10px; }
  /* トップバーのタイトル領域確保 */
  .topbar-left { flex: 1; min-width: 0; overflow: hidden; }
  .page-title { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kpi-grid, .kpi-grid-3 { grid-template-columns: 1fr !important; gap: 10px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .modal { width: 96vw !important; max-width: 96vw; margin: 8px; max-height: 90vh; }
  .modal-body { padding: 14px; }
  .tbl th, .tbl td { padding: 10px 8px; font-size: 12px; }
  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .gantt-lw, .gantt-rl { width: 120px !important; }
  .gantt { min-width: 500px; }
  /* タッチターゲット強化 */
  .btn { min-height: 40px; font-size: 13px; padding: 8px 14px; }
  .btn-primary, .btn-danger { min-height: 44px; }
  .form-input, .form-select { min-height: 44px; padding: 10px 12px; font-size: 16px; /* iOS自動ズーム防止 */ }
  .nav-item { padding: 14px 20px; min-height: 48px; font-size: 15px; }
  /* ハンバーガーメニュー表示 */
  .mobile-menu-btn { display: flex !important; }
  /* モバイル用のオーバーレイ */
  .mobile-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s;
  }
  .mobile-overlay.active { opacity: 1; pointer-events: auto; }
  /* 横スクロール可能なテーブル */
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* ダッシュボードのKPI調整 */
  .kpi-value { font-size: 24px; word-break: break-all; }
  .kpi-label { font-size: 12px; }
  /* topbar右側の主要操作以外を隠す */
  .topbar-mobile-hide { display: none !important; }
  /* タイトルのサブも狭い時は隠す */
  .page-divider, .page-sub { display: none; }

  /* 日報：横並びレイアウトを縦積みに */
  #np-main-content { flex-direction: column !important; }
  #np-main-content > .card { flex: 1 1 auto !important; min-width: 0 !important; width: 100% !important; }

  /* タイムラインのテキストが折り返さないように */
  #np-timeline { min-width: 0; }

  /* 日報サブナビ・各種サブタブの折り返し */
  .tab-sub-nav { flex-wrap: wrap; }

  /* 一般的な flex:1 min-width:200px 系の入力欄 */
  input.form-input[style*="min-width:200px"],
  input.form-input[style*="min-width:180px"] {
    min-width: 0 !important;
    width: 100%;
  }

  /* テーブルがはみ出すときは横スクロール（card-body経由） */
  .card-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── 管理者パネル admin-row のモバイル最適化 ── */
  .admin-row {
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
    padding: 14px 14px;
  }
  .admin-row-label { flex: 0 0 auto; width: 100%; }
  .admin-row-label .title { font-size: 14px; }
  .admin-row-label .desc { font-size: 12px; }
  /* admin-row の右側コンテナ（インラインstyleで display:flex などが入っている） */
  .admin-row > div:not(.admin-row-label) {
    width: 100%;
    flex-wrap: wrap !important;
    align-items: stretch !important;
  }
  /* admin-row 内の input/select は幅100%に */
  .admin-row input.form-input,
  .admin-row select.form-select {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100%;
  }
  /* admin-row 内のボタンは縦書き化を防ぐ */
  .admin-row .btn {
    white-space: nowrap;
    flex: 0 0 auto;
    min-width: max-content;
  }
  /* admin-section-title 内の操作ボタン群も折り返し */
  .admin-section-title { flex-wrap: wrap; gap: 8px; }
  /* セキュリティログ等のフィルタ select も幅自動 */
  #admin-sub-security select.form-select[style*="width"],
  #admin-sub-security input.form-input[style*="width"] {
    width: auto !important;
    min-width: 120px;
    flex: 1 1 auto;
  }
}

/* 小型スマートフォン */
@media (max-width: 380px) {
  .topbar-right > *:not(.mobile-menu-btn):not(:last-child) { display: none; }
  .page-sub, .page-divider { display: none !important; }
}

/* ハンバーガーメニューボタン（モバイルのみ表示） */
.mobile-menu-btn {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  border-radius: 8px;
  margin-right: 8px;
}
.mobile-menu-btn:hover { background: var(--surface2); }
.mobile-menu-btn svg { width: 24px; height: 24px; stroke: var(--ink); }

/* ════ アクセシビリティ：50代向け配慮 ════ */
/* フォーカス可視性向上 */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
/* リンク・ボタンのhoverを明確に */
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
/* リンク名のクリック領域拡大 */
.link-name { display: inline-block; padding: 4px 0; cursor: pointer; }
.link-name:hover { text-decoration: underline; }

/* ════ フローティングアクションボタン（新規案件追加） ════ */
.fab {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(30,100,200,0.35);
  display: none;
  align-items: center; justify-content: center;
  font-size: 28px; font-weight: 300;
  z-index: 50;
  transition: transform 0.15s, box-shadow 0.15s;
}
.fab:hover { transform: scale(1.05); box-shadow: 0 6px 20px rgba(30,100,200,0.45); }
.fab:active { transform: scale(0.95); }
.fab.visible { display: flex; }
@media (max-width: 768px) {
  .fab { bottom: 20px; right: 20px; width: 60px; height: 60px; font-size: 32px; }
}

/* ════ 印刷時 ════ */
@media print {
  .sidebar, .topbar, .fab, .mobile-menu-btn, .mobile-overlay { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
}

.npb-proj-item:hover { background: var(--surface2); }
@keyframes spin360 {
  to { transform: rotate(360deg); }
}

/* ════ 共有リンク経由で開いたカードの一時ハイライト ════ */
@keyframes gotoFlash {
  0% {
    box-shadow: 0 0 0 3px rgba(44, 110, 138, 0.7), 0 0 20px rgba(44, 110, 138, 0.4);
    background-color: #e8f4f8;
  }
  60% {
    box-shadow: 0 0 0 3px rgba(44, 110, 138, 0.5), 0 0 14px rgba(44, 110, 138, 0.25);
    background-color: #f0f8fb;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(44, 110, 138, 0);
    background-color: transparent;
  }
}
.goto-flash {
  animation: gotoFlash 2.4s ease-out;
  border-radius: 8px;
  position: relative;
  z-index: 1;
}

/* ══════════════════════════════════════════
   案件詳細 - 進捗・報告ボックス
   (white-space:pre-wrap問題を解消し、投稿済/未投稿の見た目を明確化)
   ══════════════════════════════════════════ */
.cd-report-box {
  font-size: 12px;
  color: #333;
  background: #fafaf8;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 10px 12px;
  min-height: 36px;
  line-height: 1.7;
}
.cd-report-box-cb {
  background: #fff8e8;
  border-color: #f0dda0;
}
.cd-report-box.is-empty {
  background: #fafaf8;
  border-style: dashed;
  border-color: #ddd;
  color: #999;
  font-size: 11px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cd-report-box-cb.is-empty {
  background: #fffdf5;
  border-color: #e8d9a0;
}
.cd-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px dashed #e0ded8;
  font-size: 10px;
  color: #888;
}
.cd-report-header b {
  color: #555;
  font-weight: 700;
}
.cd-report-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  color: #333;
  line-height: 1.7;
}
.cd-report-body a {
  color: var(--blue);
  text-decoration: underline;
  word-break: break-all;
}
.cd-report-box-cb .cd-report-header {
  border-bottom-color: #e8d9a0;
}

/* ══════════════════════════════════════════
   案件詳細 - 問題・課題ボックス（赤系）
   ══════════════════════════════════════════ */
.cd-report-box-prob {
  background: #fdecea;
  border-color: #e8b4af;
}
.cd-report-box-prob.is-empty {
  background: #fff5f4;
  border-color: #e8c8c4;
}
.cd-report-box-prob .cd-report-header {
  border-bottom-color: #e8b4af;
}

/* ══════════════════════════════════════════
   案件詳細 - レポート枠 インライン投稿モード
   （投稿する→ クリック時に展開、その場でテキスト投稿）
   ══════════════════════════════════════════ */
.cd-report-box.is-editing {
  background: #fdfbf3;
  border: 1.5px solid #d4b870;
  border-style: solid;
  padding: 10px 12px;
  display: block;
  color: #333;
  font-size: 12px;
}
.cd-report-box.is-editing textarea {
  font-family: inherit;
  outline: none;
}
.cd-report-box.is-editing textarea:focus {
  border-color: #b89545;
  box-shadow: 0 0 0 2px rgba(184,149,69,0.15);
}

/* ══════════════════════════════════════════
   案件詳細 - 危険信号サマリー
   ══════════════════════════════════════════ */
#cd-alert-bar {
  font-size: 12px;
  line-height: 1.6;
}
.cd-alert-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #a32d2d;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.cd-alert-title.ok {
  color: #2d7a4f;
}
.cd-alert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.cd-alert-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  border: 1px solid transparent;
}
.cd-alert-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.cd-alert-chip.red {
  background: #fff;
  color: #a32d2d;
  border-color: #e8b4af;
}
.cd-alert-chip.amber {
  background: #fff;
  color: #b9770e;
  border-color: #f0dda0;
}
.cd-alert-chip.blue {
  background: #fff;
  color: #1a5faa;
  border-color: #c8dbed;
}
.cd-alert-chip.green {
  background: #fff;
  color: #2d7a4f;
  border-color: #c8e1d2;
}

/* ══════════════════════════════════════════════
   家づくりノート 有効期限・停止トグル (5.1)
   ══════════════════════════════════════════════ */

/* 期限ラベル（URL欄の下に表示） */
.note-expiry {
  font-size: 10px;
  font-family: 'DM Mono', monospace;
  color: #999;
  margin-top: 4px;
  padding-left: 2px;
  letter-spacing: 0.02em;
}
.note-expiry.--ok      { color: #2d7a4f; }
.note-expiry.--warn    { color: #b9770e; font-weight: 700; }
.note-expiry.--danger  { color: #a32d2d; font-weight: 700; }

/* 停止トグルボタン（タイトル横） */
.suspend-toggle {
  background: #fff;
  border: 1px solid #c8c6c0;
  color: #555;
  padding: 5px 12px;
  font-size: 11px;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-weight: 500;
  min-height: 30px;
}
.suspend-toggle:hover {
  background: #fff8e7;
  border-color: #e6b800;
  color: #5a4a1f;
}
.suspend-toggle.--on {
  background: #d63a3a;
  border-color: #d63a3a;
  color: #fff;
}
.suspend-toggle.--on:hover {
  background: #b82a2a;
  border-color: #b82a2a;
  color: #fff;
}

/* 停止中バナー（赤系の警告表示） */
.suspend-banner {
  background: #fff5f5;
  border: 1px solid #f0c0c0;
  border-left: 4px solid #d63a3a;
  color: #7a1f1f;
  font-size: 12px;
  padding: 9px 13px;
  border-radius: 6px;
  margin-bottom: 10px;
  line-height: 1.6;
}
.suspend-banner b { color: #5a1010; }

/* モバイル対応 (≤768px) */
@media (max-width: 768px) {
  .suspend-toggle {
    width: 100%;
    min-height: 44px;
    font-size: 13px;
    padding: 8px 14px;
  }
  .note-expiry {
    font-size: 11px;
    margin-top: 6px;
  }
  .suspend-banner {
    font-size: 12.5px;
    padding: 11px 14px;
  }
  /* ヘッダー行の停止トグルが折返し時にフル幅になるように */
  #cf-tool-link-group > div:first-child,
  #cd-tool-wrap > div:first-child {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ════ トップバー 通知ベル（Session ㉖） ════ */
.topbar-notif-bell {
  transition: background 0.15s, color 0.15s;
}
.topbar-notif-bell.has-unread {
  color: var(--blue) !important;
  border-color: var(--blue-pale) !important;
}
.topbar-notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--red, #d04444);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  border: 1.5px solid var(--surface, #fff);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  pointer-events: none;
  letter-spacing: 0;
}
@media (max-width: 768px) {
  .topbar-notif-bell { padding: 4px 8px !important; }
  .topbar-notif-badge { top: -4px; right: -4px; min-width: 15px; height: 15px; line-height: 15px; font-size: 9px; }
}

/* ════════════════════════════════════════ */
/* バージョンバッジ + バージョン情報モーダル（Session ㉞） */
/* ════════════════════════════════════════ */
.topbar-version-badge {
  font-size: 10px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  padding: 4px 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--ink3);
  cursor: pointer;
  letter-spacing: 0.3px;
  line-height: 1;
  transition: all 0.12s;
  user-select: none;
}
.topbar-version-badge:hover {
  background: var(--blue-pale);
  color: var(--blue);
  border-color: var(--blue-mid);
}

.ver-modal-row {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ver-modal-row:last-of-type { border-bottom: none; }
.ver-modal-key {
  width: 100px;
  flex-shrink: 0;
  color: var(--ink3);
  font-weight: 600;
  font-size: 12px;
}
.ver-modal-val {
  flex: 1;
  color: var(--ink);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ver-modal-sub {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--ink4);
  font-weight: 400;
}
.ver-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .topbar-version-badge { display: none !important; }
}

/* ── 現場レポート：折りたたみ式案件カード ── */
.rp-case-card { transition: box-shadow 0.15s; }
.rp-case-card[data-collapsed="1"] .rp-card-body { display: none; }
.rp-case-card[data-collapsed="0"] .rp-card-body { display: block; }
.rp-case-card[data-collapsed="1"] .rp-card-summary { display: flex; }
.rp-case-card[data-collapsed="0"] .rp-card-summary { display: none; }
.rp-case-card[data-collapsed="1"] .rp-card-toggle { transform: rotate(0deg); }
.rp-case-card[data-collapsed="0"] .rp-card-toggle { transform: rotate(90deg); }
.rp-case-card .rp-card-header:hover { background: var(--surface2); border-radius: 6px; }
.rp-case-card .rp-card-header { margin: -6px; padding: 6px; transition: background 0.1s; }

/* ── 改善リスト：折りたたみ式カード（Ver1.84） ── */
.imp-card { transition: box-shadow 0.15s; }
.imp-card[data-collapsed="1"] .imp-card-body { display: none; }
.imp-card[data-collapsed="0"] .imp-card-body { display: block; }
.imp-card[data-collapsed="1"] .imp-card-toggle { transform: rotate(0deg); }
.imp-card[data-collapsed="0"] .imp-card-toggle { transform: rotate(90deg); }
.imp-card .imp-card-header:hover { background: var(--surface2); }
.imp-card .imp-card-header { transition: background 0.1s; }
@media (max-width: 768px) {
  .imp-card .imp-card-summary { flex-wrap: wrap !important; }
  .imp-card .imp-card-header { flex-wrap: wrap !important; gap: 6px !important; }
}

/* ══════════════════════════════════════════
   🛠 メンテナンスシステム（Session ㊶ 新設）
   ══════════════════════════════════════════ */

/* 全画面共通の告知バナー（topbarの上） */
.maint-banner {
  position: sticky;
  top: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: linear-gradient(90deg, #f59f00, #f76707);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  line-height: 1.5;
}
.maint-banner .maint-banner-icon { font-size: 18px; flex-shrink: 0; }
.maint-banner .maint-banner-text { flex: 1; min-width: 0; }
body.has-maint-banner .topbar { top: auto; }

/* メンテ中オーバーレイ（一般ユーザー画面を覆う） */
#maint-overlay {
  position: fixed;
  inset: 0;
  z-index: 99000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.maint-ov-card {
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.maint-ov-icon { font-size: 56px; margin-bottom: 16px; }
.maint-ov-title {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 14px;
}
.maint-ov-msg {
  font-size: 14px;
  color: #475569;
  line-height: 1.7;
  margin-bottom: 14px;
  white-space: pre-wrap;
}
.maint-ov-end {
  display: inline-block;
  background: #f1f5f9;
  color: #334155;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
}
.maint-ov-foot {
  margin-top: 22px;
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

/* ログイン画面のメンテ表示カード */
.login-maint-card {
  padding: 16px;
  border: 2px solid #f76707;
  background: #fff7ed;
  border-radius: 10px;
  text-align: center;
}
.login-maint-card.--warn {
  border-color: #f59f00;
  background: #fffbeb;
}
.login-maint-icon { font-size: 28px; margin-bottom: 6px; }
.login-maint-title {
  font-size: 14px;
  font-weight: 700;
  color: #c2410c;
  margin-bottom: 6px;
}
.login-maint-card.--warn .login-maint-title { color: #92400e; }
.login-maint-msg {
  font-size: 12px;
  color: #475569;
  line-height: 1.6;
  white-space: pre-wrap;
}
.login-maint-end {
  margin-top: 8px;
  font-size: 11px;
  color: #334155;
  font-weight: 600;
}
.login-maint-note {
  margin-top: 10px;
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}

/* 管理者システムタブのメンテ制御カード */
.maint-card-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.maint-card-h h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.maint-card-icon { font-size: 18px; }

.maint-no-perm {
  padding: 18px 20px;
  text-align: center;
}
.maint-no-perm p {
  font-size: 12px;
  color: var(--ink3);
  line-height: 1.7;
  margin: 0 0 14px;
}

.maint-state-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  flex-wrap: wrap;
  border-bottom: 1px dashed var(--border);
}
.maint-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
}
.maint-state-badge.--idle { background: #d1fae5; color: #065f46; }
.maint-state-badge.--scheduled { background: #fef3c7; color: #92400e; }
.maint-state-badge.--active { background: #fecaca; color: #991b1b; }
.maint-state-detail {
  font-size: 12px;
  color: var(--ink3);
  font-family: 'DM Mono', monospace;
}

.maint-msg-row {
  padding: 12px 16px;
  border-bottom: 1px dashed var(--border);
}
.maint-msg-label {
  display: block;
  font-size: 11px;
  color: var(--ink4);
  margin-bottom: 4px;
}
.maint-msg-body {
  font-size: 12px;
  color: var(--ink);
  line-height: 1.6;
  white-space: pre-wrap;
}

.maint-actions {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  flex-wrap: wrap;
}
.maint-revoke-row {
  padding: 8px 16px 14px;
  text-align: right;
  font-size: 11px;
}
.maint-revoke-row a {
  color: var(--ink4);
  text-decoration: underline;
  cursor: pointer;
}
.maint-revoke-row a:hover { color: var(--red); }

/* モバイル対応（≤768px） */
@media (max-width: 768px) {
  .maint-banner {
    padding: 8px 12px;
    font-size: 11px;
  }
  .maint-banner .maint-banner-icon { font-size: 14px; }
  .maint-ov-card {
    padding: 26px 20px;
  }
  .maint-ov-icon { font-size: 44px; }
  .maint-ov-title { font-size: 18px; }
  .maint-ov-msg { font-size: 13px; }
  .maint-state-row { padding: 12px; }
  .maint-actions { padding: 12px; flex-direction: column; }
  .maint-actions .btn { width: 100%; min-height: 44px; }
}

/* ══════════════════════════════════════════════════
   工種編集モーダル — 期間タブ（C案 / Session ㊷）
   ────────────────────────────────────────────── */
.pm-period-tabs-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.pm-period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pm-period-tab {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: 'Noto Sans JP', sans-serif;
  min-height: 32px;
  min-width: 44px;
}
.pm-period-tab:hover {
  border-color: var(--blue);
  background: var(--blue-ghost);
}
.pm-period-tab.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.pm-period-add {
  background: #f0fdf4;
  border: 1.5px dashed #86efac;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #047857;
  cursor: pointer;
  transition: all 0.12s ease;
  min-height: 32px;
}
.pm-period-add:hover {
  background: #dcfce7;
  border-color: #4ade80;
}
.pm-period-del {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #b91c1c;
  cursor: pointer;
  transition: all 0.12s ease;
  min-height: 32px;
  margin-left: auto;
}
.pm-period-del:hover {
  background: #fee2e2;
  border-color: #f87171;
}
@media (max-width: 768px) {
  .pm-period-tab,
  .pm-period-add,
  .pm-period-del {
    min-height: 36px;
    font-size: 13px;
    padding: 7px 12px;
  }
}

/* ═══════════════════════════════════════════════════ */
/* 引き継ぎ注意点（クレーム予防のための共有メモ）        */
/* v5.34 で追加                                         */
/* ═══════════════════════════════════════════════════ */

/* 案件詳細モーダル：警告ボックス */
.cd-cautions-box {
  margin: 8px 24px 0;
  padding: 12px 16px;
  background: linear-gradient(180deg, #fff8e7 0%, #fff4d6 100%);
  border: 1px solid #f0d9a0;
  border-left: 4px solid #e6b800;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(184, 137, 0, 0.08);
}
.cd-cautions-title {
  font-size: 11px;
  font-weight: 700;
  color: #8a6900;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.5px;
}
.cd-caution-item {
  font-size: 13px;
  color: #4a3a0f;
  line-height: 1.6;
  white-space: pre-wrap;
  padding: 8px 0;
  border-top: 1px dashed #e8d4a0;
  word-wrap: break-word;
}
.cd-caution-item:first-of-type {
  border-top: none;
  padding-top: 4px;
}
.cd-caution-meta {
  font-size: 10px;
  color: #a08a4a;
  margin-top: 4px;
  font-weight: 500;
  font-family: 'DM Mono', monospace;
}

/* 編集モーダル：注意点セクション */
.cf-cautions-section {
  margin: 16px 0;
  padding: 14px;
  background: #fff8e7;
  border: 1px solid #f0d9a0;
  border-radius: 6px;
}
.cf-cautions-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #8a6900;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.caution-edit-list {
  margin-bottom: 10px;
}
.caution-edit-item {
  background: #fff;
  border: 1px solid #f0d9a0;
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.caution-edit-item-text {
  font-size: 12px;
  color: #333;
  white-space: pre-wrap;
  line-height: 1.5;
  word-wrap: break-word;
}
.caution-edit-item-meta {
  font-size: 10px;
  color: #888;
  margin-top: 4px;
  font-family: 'DM Mono', monospace;
}
.caution-edit-input-wrap {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin-top: 4px;
}
.caution-edit-input-wrap textarea {
  flex: 1;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid #d4d2cc;
  border-radius: 4px;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  background: #fff;
}
.caution-edit-input-wrap textarea:focus {
  outline: none;
  border-color: #e6b800;
  box-shadow: 0 0 0 2px rgba(230, 184, 0, 0.15);
}
.caution-edit-add-btn {
  white-space: nowrap;
  align-self: flex-end;
  background: #e6b800;
  color: #fff;
  border: 1px solid #c9a000;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  min-height: 38px;
}
.caution-edit-add-btn:hover {
  background: #c9a000;
}
.caution-edit-empty {
  font-size: 11px;
  color: #999;
  padding: 6px 0;
  font-style: italic;
}
.caution-edit-disabled {
  font-size: 12px;
  color: #888;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
  text-align: center;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .cd-cautions-box {
    margin: 8px 12px 0;
    padding: 10px 12px;
  }
  .cd-caution-item {
    font-size: 13px;
  }
  .caution-edit-input-wrap {
    flex-direction: column;
  }
  .caution-edit-add-btn {
    align-self: stretch;
    min-height: 44px;
    font-size: 14px;
  }
  .caution-edit-input-wrap textarea {
    min-height: 70px;
    font-size: 16px; /* iOS auto-zoom 防止 */
  }
}

/* ══════════════════════════════════════════════════════════
   📄 アンケート単票PDF プレビュー用スタイル（Session 56）
   印刷ウィンドウ側に書き込まれている styles 文字列と同じ定義を、
   ポータル内のプレビューモーダルでも適用するため永続CSSとして配置。
   印刷ウィンドウ側の styles も維持（@page 等は印刷時のみ意味あり）。
   ══════════════════════════════════════════════════════════ */
.pdf-page { padding: 0; max-width: 210mm; margin: 0 auto; background: #fff; color: #3a3530; line-height: 1.65; font-family: 'Noto Sans JP', sans-serif; }
.pdf-header { background: #c9a87c; color: #3a2d1d; padding: 14px 22px; display: flex; justify-content: space-between; align-items: center; }
.pdf-header-l-sub { font-size: 9px; letter-spacing: 0.18em; opacity: 0.75; font-weight: 400; }
.pdf-header-l-main { font-size: 15px; font-weight: 500; margin-top: 3px; letter-spacing: 0.04em; }
.pdf-header-r { text-align: right; font-size: 9px; line-height: 1.6; }
.pdf-subhead { padding: 9px 22px; background: #faf4e8; border-bottom: 1px solid #e0d5c0; display: flex; gap: 18px; font-size: 10px; align-items: center; flex-wrap: wrap; }
.pdf-subhead .lbl { color: #9a8770; }
.pdf-subhead .val { font-weight: 500; color: #3a3530; }
.pdf-subhead .tantou { margin-left: auto; color: #9a8770; }
.pdf-body { padding: 18px 22px 6px; }
.pdf-section { margin-bottom: 14px; }
.pdf-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 7px; border-bottom: 1.5px solid #b8956a; padding-bottom: 4px; }
.pdf-section-head .num { font-size: 13px; font-weight: 500; color: #5a4628; }
.pdf-section-head .en { font-size: 9px; color: #b8956a; letter-spacing: 0.1em; }
table.pdf-tbl { width: 100%; border-collapse: collapse; }
table.pdf-tbl td { padding: 6px 10px; font-size: 11px; vertical-align: top; border: 0.5px solid #d8c8a8; }
table.pdf-tbl td.label { background: #faf4e8; width: 30%; font-size: 10px; color: #7a6650; }
table.pdf-tbl td.val { font-weight: 500; color: #3a3530; }
.pdf-area-chip { background: #a07840; color: #fff; padding: 2px 9px; border-radius: 2px; font-size: 10px; margin-right: 5px; display: inline-block; margin-bottom: 2px; }
.pdf-tag-chip { background: #f0e3c9; color: #5a4628; padding: 2px 8px; border: 0.5px solid #d8c8a8; border-radius: 2px; font-size: 10px; margin-right: 4px; display: inline-block; }
.pdf-areas-map { margin-top: 8px; max-width: 360px; }
.pdf-areas-map-cap { font-size: 9px; color: #9a8770; margin-bottom: 3px; letter-spacing: 0.05em; }
.pdf-areas-map-svg { width: 100%; height: auto; display: block; }
.pdf-quote { background: #faf4e8; border-left: 3px solid #b8956a; padding: 10px 14px; font-size: 11px; line-height: 1.85; color: #3a3530; white-space: pre-wrap; }
.pdf-footer { background: #c9a87c; color: #3a2d1d; padding: 7px 22px; display: flex; justify-content: space-between; align-items: center; font-size: 9px; letter-spacing: 0.04em; }
.pdf-footer-l { opacity: 0.85; }
.pdf-footer-r { opacity: 0.75; }

/* ═══════════════════════════════════════════════════════════════════
 * 👁 ゲスト閲覧モード（Session 60.9 / Ver1.59）
 * 専務の管理者アカウントに搭載するトグル式の演示モード。
 * ONにすると左サイドバー以外がすりガラス化＋ウォーターマーク表示。
 * 「導入企業（ゲスト）に画面を見せる際の演出」が用途。
 * ═══════════════════════════════════════════════════════════════════ */

/* メイン画面ぼかし（左サイドバー以外のすべて） */
body.guest-view-mode .main-content,
body.guest-view-mode .topbar,
body.guest-view-mode .modal,
body.guest-view-mode .toast-container,
body.guest-view-mode .tab-panel {
  filter: blur(5px);
  transition: filter 0.25s ease;
  user-select: none;
}

/* サイドバーだけクリア（タブ操作可能） */
body.guest-view-mode .sidebar {
  filter: none;
  /* サイドバーよりトグルボタンを目立たせる */
}

/* ウォーターマーク：画面全体に「ゲスト閲覧中」＋現在時刻を薄く重ねる */
body.guest-view-mode::before {
  content: attr(data-guest-watermark);
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
  font-weight: 800;
  color: rgba(60, 80, 130, 0.13);
  letter-spacing: 0.1em;
  white-space: pre;
  text-align: center;
  user-select: none;
  /* 斜め配置で印刷物っぽい雰囲気 */
  transform: rotate(-22deg);
  line-height: 1.4;
}

/* トグルボタン（トップバー） */
.guest-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink2);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.guest-view-toggle:hover {
  background: var(--surface2);
  border-color: var(--blue-mid);
}
.guest-view-toggle.is-on {
  background: var(--blue-mid);
  color: #fff;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(0,100,200,0.15);
}
.guest-view-toggle .gv-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink4);
  display: inline-block;
}
.guest-view-toggle.is-on .gv-dot {
  background: #ffe4a8;
  box-shadow: 0 0 6px rgba(255, 220, 100, 0.8);
  animation: gvBlink 1.5s ease-in-out infinite;
}
@keyframes gvBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* スマホ：ウォーターマークを小さく */
@media (max-width: 768px) {
  body.guest-view-mode::before {
    font-size: 36px;
  }
  .guest-view-toggle {
    padding: 5px 8px;
    font-size: 11px;
  }
  .guest-view-toggle .gv-label-full {
    display: none;
  }
}

/* ══════════════════════════════════════════════════
   🧰 ツールテンプレート管理プレビュー（フェーズ2／v6.02）
   家づくりノート資金計画書本体（#view-funding）のCSSを #tooltpl-preview に移植。
   管理者パネル内で本体と同じ書式・編集体験を提供する。
   ══════════════════════════════════════════════════ */
#tooltpl-preview {
  --teal-dark:  #1a6b72;
  --teal-mid:   #2a9aa8;
  --teal-light: #5ec8d8;
  --teal-faint: #edf8fa;
  --tpl-accent:     #0e4f57;
  --tpl-gray-text:  #3a3a3a;
  --tpl-gray-mid:   #666666;
  --tpl-gray-light: #999999;
  --tpl-border:     #c5e6eb;
  --tpl-border-cat: #e0f2f5;
  --tpl-white:      #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--tpl-gray-text);
}
#tooltpl-preview *,
#tooltpl-preview *::before,
#tooltpl-preview *::after {
  box-sizing: border-box;
}
#tooltpl-preview .tt-toolbar {
  width: 100%;
  max-width: 1120px;
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
#tooltpl-preview .tt-toolbar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--tpl-gray-mid);
}
#tooltpl-preview .tt-toolbar input[type="text"] {
  border: 1px solid var(--tpl-border);
  border-radius: 4px;
  padding: 5px 9px;
  font-size: 12px;
  font-family: inherit;
  background: #fafafa;
  color: var(--tpl-gray-text);
  outline: none;
  transition: border-color .18s, background .18s;
}
#tooltpl-preview .tt-toolbar input:focus {
  border-color: var(--teal-mid);
  background: var(--tpl-white);
}
#tooltpl-preview .tt-doc {
  width: 1040px;
  background: var(--tpl-white);
  border: 1px solid var(--tpl-border);
  border-radius: 8px;
  box-shadow: 0 6px 32px rgba(26,107,114,.10);
  padding: 40px 38px 26px;
  position: relative;
}
#tooltpl-preview .tt-doc-tag {
  position: absolute;
  top: 18px;
  left: 24px;
  background: var(--teal-mid);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  border-radius: 20px;
}
#tooltpl-preview .tt-doc-header {
  text-align: center;
  margin-bottom: 4px;
  position: relative;
}
#tooltpl-preview .tt-doc-title {
  font-family: 'Noto Serif JP', serif;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--tpl-accent);
}
#tooltpl-preview .tt-doc-client {
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--tpl-gray-text);
  margin-top: 2px;
  font-weight: 400;
}
#tooltpl-preview .tt-doc-meta {
  position: absolute;
  top: 0; right: 0;
  font-size: 11px;
  color: var(--tpl-gray-light);
  line-height: 1.8;
  text-align: right;
  letter-spacing: 0.04em;
}
#tooltpl-preview .tt-header-rule {
  border: none;
  border-top: 2px solid var(--teal-light);
  margin: 8px 0 16px;
}
#tooltpl-preview .tt-main-grid {
  display: grid;
  grid-template-columns: 375px 1fr;
  gap: 30px;
  align-items: start;
}
#tooltpl-preview .tt-chart-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
#tooltpl-preview .tt-chart-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--tpl-accent);
  border-bottom: 2px solid var(--teal-light);
  padding-bottom: 5px;
  width: 100%;
  text-align: center;
}
#tooltpl-preview #tt-pieChart {
  display: block;
  width: 300px;
  height: 300px;
}
#tooltpl-preview .tt-legend {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}
#tooltpl-preview .tt-legend-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: end;
  gap: 6px;
  font-size: 11.5px;
  color: var(--tpl-gray-text);
  padding-bottom: 5px;
  border-bottom: 1px solid #e0f0f3;
}
#tooltpl-preview .tt-legend-dot {
  width: 10px; height: 10px; border-radius: 2px; margin-bottom: 2px;
}
#tooltpl-preview .tt-legend-label { line-height: 1.3; }
#tooltpl-preview .tt-legend-val {
  font-weight: 700;
  color: var(--tpl-accent);
  font-size: 12px;
  white-space: nowrap;
  text-align: right;
}
#tooltpl-preview .tt-detail-area {
  display: flex; flex-direction: column;
}
#tooltpl-preview .tt-ref-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
#tooltpl-preview .tt-ref-item {
  flex: 1;
  background: #fafafa;
  border: 1px solid var(--tpl-border);
  border-radius: 4px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.55;
}
#tooltpl-preview .tt-ref-label {
  font-size: 10px;
  color: var(--tpl-gray-mid);
  white-space: nowrap;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
#tooltpl-preview .tt-ref-placeholder {
  flex: 1;
  border-bottom: 1px solid var(--tpl-border);
  height: 18px;
  text-align: right;
  color: var(--tpl-gray-light);
  font-size: 13px;
  padding-right: 4px;
}
#tooltpl-preview .tt-ref-unit {
  font-size: 10px; color: var(--tpl-gray-light); white-space: nowrap;
}
#tooltpl-preview .tt-budget-row {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  background: var(--teal-faint);
  border-radius: 4px;
  margin-bottom: 6px;
}
#tooltpl-preview .tt-budget-row + .tt-budget-row {
  background: var(--tpl-white);
  border: 1.5px solid var(--teal-mid);
  margin-bottom: 10px;
}
#tooltpl-preview .tt-budget-label {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--tpl-accent);
}
#tooltpl-preview .tt-budget-placeholder {
  width: 90px;
  border-bottom: 2px solid var(--teal-light);
  text-align: right;
  color: var(--tpl-gray-light);
  font-size: 22px;
  font-weight: 700;
  opacity: 0.55;
}
#tooltpl-preview .tt-budget-unit {
  font-size: 13px; color: var(--tpl-gray-mid); font-weight: 500;
  margin-left: 3px;
}
#tooltpl-preview .tt-budget-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--teal-dark);
  letter-spacing: 0.02em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 3px;
}
#tooltpl-preview .tt-budget-val .tt-unit {
  font-size: 13px; color: var(--tpl-gray-mid); font-weight: 500;
}
#tooltpl-preview .tt-cat-block {
  border-bottom: 1px solid var(--tpl-border-cat);
  padding: 10px 0 9px;
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 13px;
  align-items: stretch;
}
#tooltpl-preview .tt-cat-block:last-child {
  border-bottom: none;
}
#tooltpl-preview .tt-cat-marker {
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: box-shadow .15s;
}
#tooltpl-preview .tt-cat-marker:hover {
  box-shadow: 0 0 0 2px rgba(42,154,168,.35);
}
#tooltpl-preview .tt-cat-marker::after {
  content: "🎨";
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
#tooltpl-preview .tt-cat-marker:hover::after { opacity: 0.7; }
#tooltpl-preview .tt-cat-color-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0; left: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}
#tooltpl-preview .tt-cat-body {
  display: flex; flex-direction: column; gap: 4px;
}
#tooltpl-preview .tt-cat-header {
  display: flex;
  align-items: baseline;
}
#tooltpl-preview .tt-cat-name-text {
  flex: 1;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--tpl-accent);
  line-height: 1.2;
}
#tooltpl-preview .tt-amount-wrap {
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-shrink: 0;
}
#tooltpl-preview .tt-amount-input {
  width: 76px;
  padding: 1px 3px;
  border: none;
  border-bottom: 1.5px solid var(--teal-light);
  background: transparent;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--teal-dark);
  text-align: right;
  outline: none;
  transition: border-color .18s;
  -moz-appearance: textfield;
}
#tooltpl-preview .tt-amount-input::-webkit-outer-spin-button,
#tooltpl-preview .tt-amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
#tooltpl-preview .tt-amount-input:focus {
  border-bottom-color: var(--teal-dark);
}
#tooltpl-preview .tt-amount-unit {
  font-size: 11.5px; color: var(--tpl-gray-mid); white-space: nowrap;
}
#tooltpl-preview .tt-cat-desc {
  font-size: 10.5px; color: var(--tpl-gray-light); line-height: 1.65;
  outline: none;
}
#tooltpl-preview .tt-cat-note {
  font-size: 9.5px; color: #bbb; line-height: 1.5; margin-top: 1px;
  outline: none;
}
#tooltpl-preview [contenteditable]:focus {
  outline: none;
  border-bottom: 1px dashed var(--teal-light);
  padding-bottom: 1px;
}
/* タグ・項目名は見出しの一部に見えるように、編集UIは控えめに */
#tooltpl-preview .tt-cat-tag-edit,
#tooltpl-preview .tt-cat-name-edit {
  display: inline-block;
  min-width: 8px;
  padding: 0 1px;
  transition: background .15s;
}
#tooltpl-preview .tt-cat-tag-edit:hover,
#tooltpl-preview .tt-cat-name-edit:hover {
  background: #eef7f8;
  border-radius: 2px;
  cursor: text;
}
#tooltpl-preview .tt-cat-tag-edit:focus,
#tooltpl-preview .tt-cat-name-edit:focus {
  background: #eef7f8;
  border-radius: 2px;
}
#tooltpl-preview [contenteditable]:empty:before {
  content: attr(data-ph);
  color: #ccc;
}
#tooltpl-preview .tt-doc-footer {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  border-top: 1px solid var(--tpl-border-cat);
  padding-top: 10px;
}
#tooltpl-preview .tt-footer-note {
  font-size: 10px; color: var(--teal-mid); line-height: 1.8;
}
#tooltpl-preview .tt-footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
#tooltpl-preview .tt-trial-cond {
  font-size: 10.5px; color: var(--tpl-gray-light);
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
#tooltpl-preview .tt-trial-cond-disp {
  font-size: 10.5px;
  color: var(--tpl-gray-light);
}
#tooltpl-preview .tt-company-name {
  border: none;
  background: transparent;
  font-family: 'Noto Sans JP', sans-serif;
  color: var(--tpl-gray-light);
  outline: none;
  text-align: right;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 0;
  border-bottom: 1px dashed transparent;
  transition: border-color .18s;
  width: 260px;
}
#tooltpl-preview .tt-company-name:focus {
  border-bottom-color: var(--tpl-border);
}
/* 編集対象外フィールドの視覚的サイレン化 */
#tooltpl-preview .tt-noedit {
  pointer-events: none;
}
/* レスポンシブ：1040pxは管理画面では大きすぎるのでスクロールさせる */
#tooltpl-preview-wrap {
  overflow-x: auto;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 0;
  margin-bottom: 14px;
}

/* ══════════════════════════════════════════════════
   🗺 Googleマップ連携リンク（v6.03 新設、v6.04 でテキスト表記に変更）
   案件画面・カルテ・ガント等の現場住所をクリック可能リンクに
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   v6.03→v6.04 で 🗺 絵文字（世界地図みたいで分かりにくい）を
   「← MAP」テキストバッジに変更。一目で「MAPに飛べる」と分かるUI。
   ══════════════════════════════════════════════════ */
.addr-map-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color .15s;
}
.addr-map-link:hover {
  color: var(--blue-mid, #2a7ab8);
}
.addr-map-icon {
  display: inline-block;
  font-size: 0.72em;
  margin-left: 6px;
  padding: 1px 7px;
  color: var(--blue-mid, #2a7ab8);
  border: 1px solid var(--blue-mid, #2a7ab8);
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: #fff;
  opacity: 0.85;
  transition: opacity .15s, background .15s, color .15s;
  vertical-align: middle;
  white-space: nowrap;
}
.addr-map-link:hover .addr-map-icon {
  opacity: 1;
  background: var(--blue-mid, #2a7ab8);
  color: #fff;
}
/* 印刷時はバッジを非表示（紙には地図リンクは不要） */
@media print {
  .addr-map-icon { display: none !important; }
  .addr-map-link { color: inherit !important; }
}
