/* 色や余白は変数（デザイントークン）にまとめる。値は _非公開/デザインシステム_v1.0.md の「ブランドの土台」に合わせてある */
:root {
  --brand: #c82e3b;          /* アクセント（白地で 5.4:1、WCAG AA を満たす） */
  --brand-dark: #a3232f;
  --brand-soft: #fbe9eb;
  --text: #17202d;           /* 主文字 */
  --muted: #5f6b7a;          /* 副文字（白地で 5.4:1） */
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --bg: #ffffff;             /* 地（canvas）。灰色の地にカードを乗せる構成はやめ、白地＋1px の枠線で区切る */
  --card: #ffffff;
  --soft: #f8f9fb;           /* 控えめな面（surface） */
  --ok: #0f7b4d;
  --ok-soft: #e7f6ee;
  --warn: #92400e;
  --warn-soft: #fff8e6;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --info: #0b5394;
  --info-soft: #e6f4ff;
  /* 角丸：小さな部品 4px／入力とボタン 6px／パネル 8px／モーダル 12px。丸い帯（pill）は使わない */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-modal: 12px;
  /* 影はポップオーバーとダイアログ（トースト・保存バー・ビューア）だけ。カードや表には付けない */
  --shadow: 0 6px 20px rgba(16, 24, 40, .18);
  --ring: 0 0 0 3px rgba(200, 46, 59, .18);
  /* 余白の段階 */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

* { box-sizing: border-box; }
body {
  margin: 0;
  /* 欧文・数字は Inter、日本語は Noto Sans JP（index.html で読み込む）。Inter に日本語の字形はないので、日本語は自動で次の書体に落ちる */
  font-family: Inter, "Noto Sans JP", "Hiragino Sans", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 22px;
  font-feature-settings: "tnum"; /* 数字の幅を揃える（表で桁が揃う） */
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 32px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
small { color: var(--muted); font-weight: normal; }
[hidden] { display: none !important; }

/* ---------- 上のバー ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
/* ページ切り替え中の細いバー */
body.busy::before { content: ""; position: fixed; top: 0; left: 0; height: 3px; width: 30%; background: var(--brand); z-index: 50; animation: busy 1s ease-in-out infinite; }
@keyframes busy { 0% { left: -30%; } 100% { left: 100%; } }
.brand { font-weight: 700; color: var(--brand); letter-spacing: .02em; }
.brand span { color: var(--text); font-weight: 500; margin-left: 6px; }
.topbar-right { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 14px; min-width: 0; flex: none; max-width: 48%; }
#me { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

main { max-width: 1200px; margin: 0 auto; padding: 24px 20px 64px; }

/* ---------- ボタンと入力 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 16px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; line-height: 1.3; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: var(--soft); border-color: #b8bec7; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-small { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn-ghost { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; }
.link { background: none; border: none; padding: 0; color: var(--brand); cursor: pointer; font: inherit; text-align: left; }
.link.danger { color: var(--danger); }

input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: #fff; width: 100%; min-height: 38px; transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: #b8bec7; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--ring); border-color: var(--brand); }
input::placeholder { color: #9ca3af; }
input:disabled { background: #f9fafb; color: var(--muted); }
/* ラベル：見出し（文字＋「必須」などの small）は1行に並べ、入力欄はその下で幅いっぱい。
   前は縦並びの flex だったので small が別の行になり、隣の欄と入力欄の高さがずれていた */
label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-size: 13px; color: #374151; font-weight: 500; }
label > input, label > select, label > textarea, label > .inline-choices { flex: 1 0 100%; width: 100%; font-weight: 400; color: var(--text); margin-top: 2px; }
label.inline { flex-wrap: nowrap; align-items: center; gap: 8px; }
label.inline > input, label.inline > select { flex: 0 0 auto; width: auto; margin-top: 0; }
/* 2列のフォーム：見出しが2行になっても、入力欄の下端をそろえる */
.form-grid > label { align-self: end; }
.req { color: var(--brand); }
.form-error { color: var(--danger); font-size: 13px; margin: 0; }
.muted { color: var(--muted); }
.pre { white-space: pre-wrap; }

/* ---------- ログイン ---------- */
.center-card {
  max-width: 380px; margin: 12vh auto 0; background: var(--card);
  padding: 32px; border-radius: var(--radius-modal); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 16px;
}
.center-card h1 { color: var(--brand); font-size: 20px; }

/* ---------- 一覧 ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filters select { width: 200px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; line-height: 20px; }
.table tr:last-child td { border-bottom: 0; }
.table th { color: var(--muted); font-weight: 500; background: var(--soft); font-size: 12px; letter-spacing: .02em; }
.table tbody tr[data-id] { cursor: pointer; transition: background .1s; }
.table tbody tr[data-id]:hover { background: var(--soft); }
.stage { display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm); font-size: 12px; line-height: 18px; font-weight: 500; background: #eef2ff; color: #3730a3; }
.stage-inquiry { background: #f3f4f6; color: #374151; }
.stage-operating { background: #e7f6ee; color: var(--ok); }
.stage-cancelled { background: #fdecea; color: var(--danger); }

/* ---------- 詳細 ---------- */
.back { display: inline-block; margin-bottom: 8px; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
/* ステージの進み（ステッパー） */
.stagebar { display: flex; list-style: none; padding: 0; margin: 0 0 12px; gap: 0; overflow-x: auto; counter-reset: step; }
.stagebar li {
  flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 6px 8px 6px 0;
  color: var(--muted); white-space: nowrap; position: relative;
}
.stagebar li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; background: var(--bg); padding-right: 4px; position: relative; z-index: 1; }
.stagebar li::before { counter-increment: step; content: counter(step); width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none; background: #fff; }
.stagebar li::after { content: ""; position: absolute; left: 20px; right: 0; top: 50%; height: 1px; background: var(--line-strong); z-index: 0; }
.stagebar li:last-child::after { display: none; }
.stagebar li::before { position: relative; z-index: 1; }
.stagebar li.done { color: var(--brand-dark); }
.stagebar li.done::before { content: "✓"; background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.stagebar li.current { color: var(--brand); font-weight: 600; }
.stagebar li.current::before { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--ring); }
.stagebar.is-cancelled li { opacity: .5; }
/* タブ（下線型） */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14px; font-weight: 500; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--text); background: var(--soft); border-radius: 6px 6px 0 0; }
.case-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.case-head h1 { font-size: 24px; }
.case-head .meta { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
/* 次にやること：概要以外のタブでは1行にたたむ */
.next-compact { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; padding: 8px 14px; margin-bottom: 12px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid #f5d48a; }
.next-compact .n { font-weight: 600; }
.next-compact a { margin-left: auto; }
.next-ready.next-compact { background: var(--ok-soft); border-color: #a9dcc0; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.kv > dt:not(:first-child), .kv > dd:not(:nth-child(2)) { border-top: 1px dashed var(--line); padding-top: 10px; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; }
.chip { display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0; background: #f3f4f6; border-radius: var(--radius-sm); font-size: 13px; }
#add-member { display: flex; gap: 8px; margin-top: 8px; max-width: 560px; }
#add-member .btn { white-space: nowrap; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.form-grid fieldset { border: none; padding: 0; margin: 0; display: flex; gap: 20px; }
.form-grid legend { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.span-2 { grid-column: span 2; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

.upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.upload select { width: 120px; }
.upload input[type=file] { width: auto; flex: 1; }
.upload .form-error { flex-basis: 100%; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 16px; }

/* ---------- 上のバーのメニュー ---------- */
.topbar { gap: 24px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 6px 12px; border-radius: var(--radius); color: var(--muted); white-space: nowrap; font-size: 14px; font-weight: 500; }
.topbar-right .btn-ghost { white-space: nowrap; }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav a:hover { text-decoration: none; color: var(--text); }

/* ---------- 見出し・小物 ---------- */
h2 { font-size: 18px; line-height: 26px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 16px 0 8px; }
.card + .card, .card + section { margin-top: 16px; }
.small { font-size: 12px; line-height: 18px; }
.narrow { max-width: 240px; }
.inline-edit { margin-top: 6px; }
.section-label { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--brand-dark); }

/* ---------- 次にやること ---------- */
.next { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.next-wait { background: #fff8e6; border: 1px solid #f5d48a; }
.next-wait ul { margin: 6px 0 0; padding: 0; list-style: none; }
.next-wait li { padding: 3px 0; }
.next-wait li.mine { font-weight: 600; }
.next-wait li.mine::before { content: "→ "; color: var(--brand); }
.next-ready { background: #e7f6ee; border: 1px solid #a9dcc0; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.owner { display: inline-block; font-size: 12px; line-height: 18px; padding: 1px 6px; border-radius: var(--radius-sm); margin-right: 8px; background: #eef2ff; color: #3730a3; font-weight: 500; }
.owner-seller { background: #fdecef; color: var(--brand-dark); }
.owner-contractor { background: #e6f4ff; color: #0b5394; }
.owner-aggregator { background: #f1ecff; color: #5b3cc4; }

/* ---------- ホーム ---------- */
.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash .card + .card { margin-top: 0; }
.dash-main { grid-column: span 2; }
.count { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--brand); color: #fff; font-size: 12px; text-align: center; vertical-align: middle; }
.todo { list-style: none; padding: 0; margin: 0; }
.todo > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.todo > li:last-child { border-bottom: 0; }
.todo > li > a { font-weight: 600; margin-right: 8px; }
.todo-items { list-style: none; padding: 4px 0 0; margin: 0; font-size: 14px; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-bottom: 1px dashed var(--line); }
.plain li:last-child { border-bottom: 0; }
.counts { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 14px; }
.counts li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 2px 0; }

/* ---------- お知らせ ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: var(--radius-lg);
  font-size: 14px; z-index: 100; box-shadow: var(--shadow); animation: toast-in .18s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast-error { background: var(--danger); }

/* ---------- スマホ ---------- */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .table th:nth-child(3), .table td:nth-child(3), .table th:nth-child(5), .table td:nth-child(5) { display: none; }
  .topbar #me { display: none; }
  .tabs a { padding: 8px 12px; }
  .dash { grid-template-columns: 1fr; }
  .dash-main { grid-column: span 1; }
  .topbar { gap: 8px; padding: 10px 16px; }
  .brand span { display: none; }
  .brand { font-size: 14px; white-space: nowrap; }
  .nav a { padding: 6px 8px; }
  .card { padding: 16px; }
}

/* ---------- 段階3 ---------- */
.kana-input { padding: 4px 8px; font-size: 13px; min-width: 140px; }
h3 .btn-small { margin-left: 12px; vertical-align: middle; }

/* ---------- 申請書類 ---------- */
.doc-progress { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; font-size: 14px; }
.bar { height: 6px; background: #e5e7eb; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.bar > div { height: 100%; background: var(--brand); }
.bar-ok > div { background: var(--ok); }
.doc-list { list-style: none; padding: 0; margin: 0 0 8px; }
.doc-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.doc-main { flex: 1; min-width: 0; }
.doc-no { width: 24px; text-align: right; color: var(--muted); font-size: 13px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.doc-name { font-weight: 600; }
.doc-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.doc-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 6px; font-size: 14px; }
.pill { font-size: 12px; line-height: 18px; padding: 1px 8px; border-radius: var(--radius-sm); white-space: nowrap; font-weight: 500; }
.pill-ok { background: #e7f6ee; color: var(--ok); }
.pill-wait { background: #fff8e6; color: #92400e; }
.pill-todo { background: #fdecea; color: var(--danger); }
.pill-ready { background: #e6f4ff; color: #0b5394; }
.file-btn { cursor: pointer; }
.danger-btn { color: var(--danger); border-color: #f5c2c7; }
.seal-box { background: #fafafa; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.seal-row { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.seal-img { width: 64px; height: 64px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.config-line { font-size: 14px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.doc-bundle { align-items: center; margin-top: 16px; }
.map-slot { padding: 12px 0 16px; border-bottom: 1px solid var(--line); }
.map-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.map-hint { margin: 0 0 6px; color: var(--muted); }
.map-canvas { width: 100%; aspect-ratio: 10 / 7; max-height: 75vh; border: 1px solid var(--line); border-radius: var(--radius); } /* 付近図と同じ横長の形（見えている範囲がそのまま PDF になる） */
/* 印の形（記載例：引込柱＝赤い△、電柱＝赤い○） */
.mk { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; box-sizing: border-box; }
.mk-circle { border: 2px solid #e11d1d; border-radius: 50%; }
.mk-square { border: 2px solid #2563eb; }
.mk-dot { background: #111827; border-radius: 50%; width: 8px; height: 8px; }
.mk-triangle { width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid #e11d1d; position: relative; }
.mk-triangle::after { content: ''; position: absolute; left: -4px; top: 4px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 6px solid #fff; }
.site-marker .mk-big { transform: scale(1.6); transform-origin: center; filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff); }
.site-marker .mk-circle.mk-big, .site-marker .mk-square.mk-big { background: transparent; }
.site-marker .pin-label { position: absolute; left: 24px; top: -2px; white-space: nowrap; background: rgba(255,255,255,.92); padding: 1px 6px; border-radius: 3px; font-size: 12px; font-weight: 600; }
/* 囲みの説明の箱と、角のつまみ */
.area-label { width: auto !important; height: auto !important; }
.area-callout { background: #fff; border: 1.5px solid #111; padding: 6px 10px; font-size: 13px; line-height: 1.5; white-space: nowrap; color: #111; cursor: move; }
.area-handle { background: #fff; border: 2px solid #e11d1d; border-radius: 2px; }
.map-areas { display: grid; gap: 8px; margin-top: 8px; }
.map-area-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.map-area-row label { flex: 1 1 260px; display: grid; gap: 4px; }
.tpl-slot { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tpl-slot input[type=file] { width: 260px; }
.config-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; }
.config-card h3 { margin-top: 0; }
@media (max-width: 640px) {
  .doc-progress { grid-template-columns: 1fr; }
  .tpl-slot { grid-template-columns: 1fr; }
  .map-canvas { height: auto; }
}

/* ---------- ファイルの表示（アプリ内ビューア） ---------- */
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 24px; }
.viewer-panel { background: #fff; border-radius: var(--radius-modal); box-shadow: var(--shadow); width: min(1100px, 100%); height: min(90vh, 100%); display: flex; flex-direction: column; overflow: hidden; }
.viewer-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.viewer-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 16px 16px; overflow: auto; }
.viewer-body > p { margin: 4px 0 8px; }
.viewer-pdf { flex: 1; min-height: 0; overflow: auto; background: #e5e7eb; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 12px; border-radius: 4px; }
.viewer-pdf canvas { box-shadow: 0 1px 4px rgba(0,0,0,.3); background: #fff; max-width: 100%; }
.viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; margin: auto; }
.viewer-doc { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: 4px; padding: 16px; font-size: 13px; line-height: 1.6; }
.viewer-doc table { border-collapse: collapse; margin: 8px 0; }
.viewer-doc td, .viewer-doc th { border: 0; padding: 2px 8px; vertical-align: top; white-space: pre-wrap; font-size: 13px; line-height: 1.5; }
.viewer-doc td:empty { padding: 0; }
.viewer-doc tr:has(td:not(:empty)) { border-bottom: 1px dashed #eee; }
.viewer-doc h1, .viewer-doc h2, .viewer-doc h3 { font-size: 15px; }
.viewer-doc img { max-width: 100%; }
.viewer-doc .sheet-name { font-weight: 600; margin: 16px 0 4px; color: #555; }
.tpl-list { list-style: none; padding: 0; margin: 0 0 8px; font-size: 13px; }
.tpl-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
@media (max-width: 640px) { .viewer { padding: 8px; } }
.view-as select { padding: 2px 8px; min-height: 28px; font-size: 12px; max-width: 200px; border-radius: var(--radius-sm); }
.view-as-on select { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.tpl-files li { align-items: center; }
.tpl-files select.small { font-size: 12px; padding: 2px 6px; }
.view-as { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; font-weight: 400; color: var(--muted); }
#me { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* ---------- 申請書類タブ（入力チェック＋書類の一覧） ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--soft); border-radius: var(--radius); padding: 10px 14px; }
.stat-n { font-size: 22px; font-weight: 600; }
.stat-n small { font-size: 13px; color: var(--muted); font-weight: 400; }
.sec { margin: 20px 0 8px; }
.sec .small { font-weight: 400; margin-left: 8px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.check-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.check-mine { border-color: var(--brand); }
.check-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.check-list .box { width: 16px; height: 16px; border: 1.5px solid #9ca3af; border-radius: 4px; font-size: 11px; line-height: 13px; text-align: center; flex: none; }
.check-list .done .box, .check-list li.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-list li.done { color: var(--muted); }
.check-list li.todo .box { border-color: var(--danger); }
.doc-compact { display: block; padding: 0; }
.doc-line { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 4px; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.doc-line:hover { background: var(--soft); }
.doc-line:focus-visible { outline-offset: -2px; }
.doc-line .doc-name { flex: 1; min-width: 0; font-weight: 500; }
.doc-line .doc-source { width: 130px; flex: none; }
.doc-line .pill { flex: none; }
.doc-detail { padding: 0 4px 10px 38px; }
.doc-detail .doc-sub { margin-bottom: 6px; }
.site-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 4px; }
.site-head h4 { margin: 0; font-size: 15px; }
.site-head .config-line { margin: 0; }
.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: #fff4d6; } to { background: transparent; } }
@media (max-width: 640px) {
  .stat-row { grid-template-columns: 1fr; }
  .doc-line .doc-source { display: none; }
  .doc-detail { padding-left: 4px; }
}
.viewer-docx { flex: 1; min-height: 0; overflow: auto; background: #e5e7eb; padding: 12px; border-radius: 4px; }
.viewer-docx .docx-wrapper { background: transparent; padding: 0; }
.viewer-docx .docx-wrapper > section.docx { box-shadow: 0 1px 4px rgba(0,0,0,.3); margin-bottom: 12px; max-width: 100%; }

/* ---------- Excel 風の表示 ---------- */
.xl-book { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.xl-pane { flex: 1; min-height: 0; overflow: auto; background: #fff; padding: 8px; }
.xl-sheet { border-collapse: collapse; table-layout: fixed; font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif; font-size: 13px; color: #000; }
.xl-sheet td { padding: 1px 4px; overflow: hidden; text-overflow: clip; line-height: 1.3; }
.xl-grid td { border: 1px solid #e3e3e3; }
.xl-tabs { display: flex; gap: 2px; padding: 4px 6px; background: #f3f4f6; border-top: 1px solid var(--line); overflow-x: auto; }
.xl-tab { border: 1px solid #d1d5db; border-bottom: 0; background: #e5e7eb; padding: 3px 12px; font-size: 12px; border-radius: 4px 4px 0 0; cursor: pointer; white-space: nowrap; }
.xl-tab.active { background: #fff; font-weight: 600; color: #107c41; }


/* ---------- 仕上げ（全体） ---------- */
.empty { color: var(--muted); text-align: center; padding: 28px 12px; font-size: 14px; }
.page-head h1 + .muted { font-size: 14px; }
.card h2:first-child { margin-top: 0; }
.filters input[type=search] { max-width: 320px; }
.dash .card { padding: 20px; }
.next { font-size: 14px; }
.btn-ghost:hover { color: var(--text); }
.tpl-slot { align-items: center; }
.config-card { box-shadow: none; }
@media (max-width: 640px) {
  .topbar { height: 52px; padding: 0 12px; }
  main { padding: 16px 12px 56px; }
  .card { padding: 16px; }
  .case-head h1 { font-size: 20px; }
  .stagebar li { min-width: 0; flex: none; padding: 4px 6px; }
  .stagebar li::after { display: none; }
  .stagebar li:not(.current):not(.done) { display: none; }
  .next-compact a { margin-left: 0; }
}
@media (max-width: 640px) {
  /* スマホでは指で押す部品を最小 44px にする */
  .btn:not(.btn-small), input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 44px; }
  /* 一覧の検索と絞り込みは折り返して、横にはみ出さないようにする */
  .filters { flex-wrap: wrap; }
  .filters input[type=search] { max-width: none; flex-basis: 100%; }
  .brand { font-size: 13px; }
  .nav { gap: 0; }
  .nav a { padding: 6px 8px; font-size: 13px; }
  .topbar-right { gap: 6px; }
  .topbar-right .btn-ghost { font-size: 13px; padding: 4px; }
  .view-as { display: none; }
}

/* ---------- ホーム・一覧・概要の改善 ---------- */
.stat-4 { grid-template-columns: repeat(4, 1fr); }
a.stat { color: inherit; text-decoration: none; border: 1px solid transparent; transition: border-color .12s, transform .05s; }
a.stat:hover { border-color: var(--line-strong); text-decoration: none; }
.stat-hot { background: var(--brand-soft); }
.stat-hot .stat-n { color: var(--brand); }
.stat-warn { background: var(--warn-soft); }
.count-soft { background: #e5e7eb; color: #374151; }
.todo-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.todo-title { font-weight: 600; }
.todo-items a { color: var(--text); }
.todo-items a:hover { color: var(--brand); }
.todo-items li { padding: 2px 0; }
.dash-col { display: flex; flex-direction: column; gap: 16px; }
.dash-col .card { margin: 0; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; }
.bars li { display: grid; grid-template-columns: 88px 1fr 28px; align-items: center; gap: 8px; }
.bars li a { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars li strong { text-align: right; }
.bar-track { height: 8px; background: #eceef2; border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 4px; transition: width .3s; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip-btn { border: 1px solid var(--line-strong); background: #fff; border-radius: var(--radius); padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.chip-btn span { color: var(--muted); margin-left: 4px; font-size: 12px; }
.chip-btn:hover { background: var(--soft); }
.chip-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-btn.active span { color: #fff; opacity: .85; }
.filters { align-items: center; }
.filters label.inline { white-space: nowrap; }
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.th-sort.active { color: var(--text); font-weight: 600; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 8px; }
.summary { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; color: inherit; background: var(--soft); font-size: 14px; }
a.summary:hover { text-decoration: none; border-color: var(--brand); background: #fff; }
.summary-main { font-weight: 600; margin: 2px 0; }
.mini-log { list-style: none; padding: 0; margin: 4px 0; font-size: 13px; display: grid; gap: 3px; }
/* 保存していない変更のバー */
form.dirty .savebar { display: flex; }
.savebar { position: sticky; bottom: 12px; grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--text); color: #fff; border-radius: var(--radius-lg); font-size: 13px; box-shadow: var(--shadow); z-index: 5; }
.savebar span { flex: 1; }
.savebar .btn { background: #fff; }
.savebar .btn-primary { background: var(--brand); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, .15); }
@media (max-width: 640px) {
  .stat-4 { grid-template-columns: 1fr 1fr; }
  .bars li { grid-template-columns: 72px 1fr 24px; }
}

/* ---------- 入力しながら確認 ---------- */
.editor-panel { width: min(1400px, 100%); }
.editor-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 340px 1fr; gap: 16px; padding: 12px 16px 16px; }
.editor-form { overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.editor-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0; display: grid; gap: 8px; }
.editor-form legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.editor-preview { min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.editor-preview > * { flex: 1; }
@media (max-width: 900px) { .editor-body { grid-template-columns: 1fr; } .editor-form { max-height: 40%; } }

/* ---------- 案件一覧：スマホではカードに ---------- */
@media (max-width: 640px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards { border: 0; box-shadow: none; background: transparent; }
  .table-cards tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 10px; }
  .table-cards td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: none; }
  .table-cards td[data-label="案件"] { display: block; font-size: 14px; margin-bottom: 4px; }
  .table-cards td[data-label="案件"]::before { display: none; }
  .table th:nth-child(3), .table td:nth-child(3), .table th:nth-child(5), .table td:nth-child(5) { display: flex; }
}

/* ---------- ファイルのドロップ枠 ---------- */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 16px; background: var(--soft); display: grid; gap: 8px; transition: border-color .12s, background .12s; }
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dropzone-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dropzone .inline select { width: auto; min-width: 120px; }
.dropzone p { margin: 0; }
.table td:last-child, .table th:last-child { white-space: nowrap; }
.viewer-docx section.docx td, .viewer-docx section.docx th { overflow-wrap: anywhere; }
.chip-old { background: #e5e7eb; color: var(--muted); font-size: 11px; padding: 0 6px; }
tr.old-version td { color: var(--muted); }

/* ---------- 案件ページ（1枚） ---------- */
.sec-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 18px; }
.sec-title .small { font-weight: 400; }
.todos { display: grid; gap: 10px; }
.todo-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: var(--soft); }
.todo-label { font-weight: 600; margin-bottom: 8px; }
.todo-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.todo-form.grid label { flex: 1 1 200px; }
.todo-form select { width: auto; min-width: 200px; }
.todo-form .btn { margin-bottom: 1px; }
details.others { margin-top: 12px; font-size: 13px; }
details.others summary { cursor: pointer; color: var(--muted); }
details.others ul { margin-top: 6px; }
details.info { border-top: 1px solid var(--line); }
details.info:last-child { border-bottom: 1px solid var(--line); }
details.info summary { cursor: pointer; padding: 12px 4px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px; }
details.info summary::before { content: "▸"; color: var(--muted); font-size: 12px; transition: transform .12s; }
details.info[open] summary::before { transform: rotate(90deg); }
details.info summary .small { font-weight: 400; }
details.info summary:hover { background: var(--soft); }
.info-body { padding: 4px 4px 20px; }
.doc-summary { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.doc-summary strong { color: var(--text); }
.seal-inline { display: inline-flex; align-items: center; gap: 6px; }
.seal-mini { width: 22px; height: 22px; object-fit: contain; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.card + .card { margin-top: 16px; }

/* ---------- レビュー反映 ---------- */
.pill-wait { background: #f3f4f6; color: #6b7280; }
.pill-ok::before { content: "✓ "; }
.pill-todo { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.doc-compact .doc-no { white-space: nowrap; min-width: 24px; }
input:disabled, select:disabled, textarea:disabled { border-color: transparent; background: transparent; color: var(--text); padding-left: 0; box-shadow: none; }
.lock { background: var(--soft); border-radius: var(--radius); padding: 8px 12px; }
.section-label.optional { color: var(--muted); font-weight: 500; }
.pagenav { position: sticky; top: 56px; z-index: 5; display: flex; gap: 4px; background: var(--bg); padding: 6px 0 10px; margin: 0 0 4px; }
.pagenav a { padding: 6px 12px; border-radius: var(--radius); font-size: 13px; color: var(--muted); background: #fff; border: 1px solid var(--line); }
.pagenav a:hover { text-decoration: none; color: var(--text); border-color: var(--line-strong); }
.pagenav .count { margin-left: 4px; }
.meta-link { color: inherit; }
.meta-link:hover { color: var(--brand); text-decoration: none; }
details.info summary::before { font-size: 16px; width: 18px; text-align: center; }
.del-soft { color: var(--muted); }
.del-soft:hover { color: var(--danger); }
.timeline li .small { min-width: 70px; }
@media (max-width: 640px) { .pagenav { top: 52px; } }
.stagebar li span { white-space: normal; line-height: 1.15; text-overflow: clip; }
.bars li { grid-template-columns: 110px 1fr 28px; }
.bars li a { white-space: normal; line-height: 1.2; }
.todo-first { color: var(--muted); }
.pick { display: inline-flex; align-items: center; gap: 8px; }
.tpl-slot .pick { justify-self: start; }

/* ---------- 段階B：案件番号・期日・健康状態 ---------- */
.case-id { font-size: 12px; line-height: 18px; color: var(--muted); font-weight: 500; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
h1 .case-id { display: block; }
.health { display: inline-block; font-size: 12px; line-height: 18px; padding: 1px 8px; border-radius: var(--radius-sm); font-weight: 600; white-space: nowrap; }
.health-action { background: var(--brand-soft); color: var(--brand-dark); }
.health-stalled { background: var(--warn-soft); color: var(--warn); }
.health-waiting { background: #f3f4f6; color: var(--muted); }
.health-ok { background: var(--ok-soft); color: var(--ok); }
.due-over { color: var(--danger); font-weight: 600; }
.due-soon { color: var(--warn); font-weight: 600; }
.due-edit { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 400; color: var(--muted); font-size: 13px; }
.due-edit input[type=date] { width: auto; min-height: 28px; padding: 2px 6px; font-size: 13px; }
.next-cell .owner { margin-right: 6px; }
.overdue-list { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radius); background: var(--brand-soft); }
.overdue-list ul { margin: 4px 0 0; }

/* ---------- 段階C：サイドバー（PC）とドロワー（スマホ） ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-width, 232px) minmax(0, 1fr); min-height: 100vh; }
body.no-chrome .shell { display: block; }
.content { min-width: 0; }
.sidebar { position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--soft); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { padding: 4px 10px 12px; font-size: 15px; line-height: 22px; }
.sidebar .brand span { display: block; margin: 0; font-size: 12px; line-height: 18px; }
.sidebar .nav { flex-direction: column; gap: 2px; flex: none; }
.sidebar .nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 14px; }
.sidebar .me-box { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 10px 0; font-size: 13px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; color: var(--muted); }
.sidebar .me-box .btn-ghost { padding: 0; font-size: 13px; }
.sidebar #me { display: block; white-space: normal; }
.sidebar .view-as { display: flex; margin-bottom: 4px; }
.topbar { display: none; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(16, 24, 40, .4); z-index: 50; }
@media (max-width: 767px) {
  .shell { grid-template-columns: 1fr; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; padding: 0 12px; }
  .topbar .brand { font-size: 14px; }
  .menu-btn { width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); color: var(--text); font: inherit; font-size: 18px; cursor: pointer; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 264px; height: auto; z-index: 60; transform: translateX(-100%); transition: transform .15s; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  body.nav-open .backdrop { display: block; }
  .sidebar .brand span { display: block; }
  .sidebar .view-as { display: flex; }
}

/* ---------- 段階C：案件ページ（タブ＋右パネル） ---------- */
.case-tabs { margin-bottom: 16px; }
.case-tabs button { background: none; border: 0; font: inherit; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; cursor: pointer; }
.case-tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.case-tabs button:hover { color: var(--text); }
.case-tabs button .count { margin-left: 6px; }
.case-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.case-main { min-width: 0; }
.case-main > [data-pane] > .card + .card { margin-top: 16px; }
.case-panel { position: sticky; top: 16px; display: grid; gap: 12px; }
.case-panel .card { padding: 16px; }
.case-panel h3 { margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.panel-log { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.panel-log li { padding: 6px 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: 56px 1fr; gap: 8px; }
.panel-log li:last-child { border-bottom: 0; }
.panel-log .when { color: var(--muted); white-space: nowrap; }
.panel-log .who { color: var(--muted); margin-right: 4px; }
@media (max-width: 1023px) { .case-body { grid-template-columns: minmax(0, 1fr); } .case-panel { position: static; } }

/* ---------- トラック化：全体の状況と4トラック ---------- */
.overall { display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm); font-size: 12px; line-height: 18px; font-weight: 500; background: var(--info-soft); color: var(--info); }
.overall-prospect { background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.overall-operating { background: var(--ok-soft); color: var(--ok); }
.overall-cancelled { background: var(--danger-soft); color: var(--danger); }

/* トラックの状態：まだ（idle）／進んでいる（moving）／終わった（done）／やめた（stopped） */
.track-badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-sm); font-size: 12px; line-height: 18px; white-space: nowrap; background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.track-badge b { font-weight: 600; color: var(--text); }
.track-badge.track-moving { background: var(--info-soft); color: var(--info); border-color: transparent; }
.track-badge.track-done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.track-badge.track-stopped { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.track-strip { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0 var(--space-4); }
.track-cell { display: flex; flex-wrap: wrap; gap: 4px; }

.tracks { display: grid; gap: var(--space-2); }
.track-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.track-card > summary { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); cursor: pointer; list-style: none; }
.track-card > summary::-webkit-details-marker { display: none; }
.track-card > summary::after { content: '▾'; margin-left: auto; color: var(--muted); }
.track-card[open] > summary::after { content: '▴'; }
.track-card .track-name { font-weight: 600; min-width: 3em; }
.track-card .track-form { padding: 0 var(--space-4) var(--space-4); }

/* ---------- 管理：会社と所属する人 ---------- */
.org-block { border-top: 1px solid var(--line); padding: var(--space-3) 0; }
.org-block:first-of-type { border-top: 0; }
.org-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.org-head h3 { margin: 0; }
.add-person { margin: var(--space-3) 0; padding: var(--space-3); background: var(--soft); border-radius: var(--radius-lg); }
/* 1人ずつ、欄を3列のグリッドに並べる（表のままだと欄が細くなりすぎるため）。欄名は data-label から出す */
.people-table, .people-table tbody { display: block; border: 0; background: none; }
.people-table thead { display: none; }
.people-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-top: var(--space-2); }
.people-table td { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; font-size: 13px; }
.people-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
.people-table input, .people-table select { padding: 6px 8px; font-size: 13px; width: 100%; }
.people-table td label.inline { margin-top: 4px; }
.people-table .row-actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; gap: var(--space-2); }
@media (max-width: 640px) { .people-table tr { grid-template-columns: 1fr; } }

/* ---------- 販売代理店の受付フォーム（ログインなし） ---------- */
.intake-card { max-width: 560px; margin-top: 6vh; }
.intake-card fieldset { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4) var(--space-4); margin: 0; display: grid; gap: var(--space-3); }
.intake-card legend { padding: 0 var(--space-2); font-weight: 600; }
.intake-card .inline-choices { display: flex; gap: var(--space-4); }
.intake-card .btn-primary { width: 100%; padding: 12px; }
.agency-tag { display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm); font-size: 12px; line-height: 18px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }
.agency-tag.confirmed { background: var(--soft); color: var(--muted); border: 1px solid var(--line); }
.intake-card .site-block { position: relative; }
.intake-card .site-tools { display: flex; gap: var(--space-3); justify-content: flex-end; }
.intake-card #billing-other { display: grid; gap: var(--space-3); }
.intake-card .consent { align-items: flex-start; font-size: 14px; }
.case-links { display: grid; gap: var(--space-3); }
.case-link { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); display: grid; gap: var(--space-2); }
.case-link-head { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.case-link-head .actions { margin-left: auto; display: flex; gap: var(--space-2); }
.party { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; margin-right: 8px; font-weight: 500; }
.party-internal { background: var(--brand-soft); color: var(--brand-dark); }
.party-sales { background: var(--warn-soft); color: var(--warn); }
.party-contractor { background: var(--info-soft); color: var(--info); }
.party-aggregator { background: #f1ecff; color: #5b3cc4; }

/* ---------- 書類（フォルダ表示） ---------- */
.files-page { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: var(--space-4); align-items: start; }
.files-tree { position: sticky; top: var(--space-4); max-height: calc(100vh - 120px); overflow: auto; }
.files-tree input[type=search] { margin-bottom: var(--space-3); }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; border-left: 1px dashed var(--line); margin-left: 8px; }
.tree details > summary { list-style: none; cursor: pointer; }
.tree details > summary::-webkit-details-marker { display: none; }
.tree details > summary::before { content: '▸'; color: var(--muted); display: inline-block; width: 12px; font-size: 11px; }
.tree details[open] > summary::before { content: '▾'; }
.tree details > summary .tree-item { display: inline-flex; width: calc(100% - 14px); }
.tree-item { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: none; border: 0; padding: 4px 6px; border-radius: var(--radius-sm); font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.tree-item:hover { background: var(--soft); }
.tree-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.files-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.files-head h2 { margin: 0; }
.tree-item .overall { white-space: nowrap; flex-shrink: 0; }
.files-list td, .files-list th { white-space: nowrap; }
.files-list td:first-child { white-space: normal; }
.files-list { overflow-x: auto; }
@media (max-width: 1100px) {
  .files-page { grid-template-columns: 1fr; }
  .files-tree { position: static; max-height: none; }
}

/* ---------- 変な改行をなくす（11/4） ----------
   日本語は単語の切れ目がないので、短い項目（会社名・見出し・日付・「A → B」）は折り返さず、
   足りないときは表ごと横にスクロールさせる */
.nowrap { white-space: nowrap; }
/* 案件一覧：表は縮めずに横スクロール。短い列は折り返さない */
#list { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table th { white-space: nowrap; }
.table-cards td:nth-child(1) .case-id, .table-cards td:nth-child(1) a { white-space: nowrap; }
.table-cards td:nth-child(1) .agency-tag { display: inline-block; margin-top: 2px; }
.table-cards td:nth-child(2), .table-cards td:nth-child(4), .table-cards td:nth-child(6), .table-cards td:nth-child(7) { white-space: nowrap; }
.table-cards td:nth-child(3) { min-width: 190px; }
/* 次にやること：語の途中（「確／認」）で割らない。keep-all は日本語を「：」「）」や空白でしか折り返さない指定 */
.table-cards td:nth-child(5) { min-width: 240px; word-break: keep-all; }
/* 一覧は列が多いので、左右の余白を少し詰めて1画面に収まりやすくする */
.table-cards th, .table-cards td { padding-left: 10px; padding-right: 10px; }
/* 案件の列：「販売：〜株式会社」も折り返さない。代理店のタグは自分の行に */
.table-cards td:nth-child(1) { white-space: nowrap; }
.table-cards td:nth-child(1) .agency-tag { display: block; width: fit-content; }
/* 書類ページのフォルダ名：名前は折り返さず、入らないときは状況のバッジと件数を次の行へ */
.files-page { grid-template-columns: minmax(280px, 380px) 1fr; }
.tree-item { flex-wrap: wrap; row-gap: 2px; }
.tree-name { white-space: nowrap; }
.overall, .health { white-space: nowrap; }
/* 見出しの本文（説明）は、見出しの語を割らずに次の行へ */
.sec-title { flex-wrap: wrap; row-gap: 2px; }
.sec-title > .small { flex: 1 1 200px; }
/* 「…を待っているもの 施工会社 1 件」の件数は、ひとかたまりで次の行へ */
summary > .muted { display: inline-block; }
/* 履歴の「前 → 後」は途中で折り返さない */
.panel-log .nowrap { white-space: nowrap; }
@media (max-width: 640px) {
  /* スマホ：見出しとボタンが同じ行に入らないときはボタンを下へ */
  .page-head { flex-wrap: wrap; }
  /* カード表示の「進み具合」は、全体の状況とトラックを縦に */
  .table-cards td[data-label="進み具合"] { flex-wrap: wrap; }
  .table-cards td[data-label="進み具合"] .track-cell { flex-basis: 100%; justify-content: flex-end; }
  /* カード表示では列の幅指定を外す */
  .table-cards td:nth-child(3), .table-cards td:nth-child(5) { min-width: 0; }
  .table-cards td:nth-child(2) { white-space: normal; }
}

/* ---------- Google Drive の受け渡し ---------- */
.drive-banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.files-page + .drive-banner, .page-head + .drive-banner { margin-bottom: var(--space-3); padding: var(--space-3) var(--space-4); }
#drive-card .drive-banner { margin: var(--space-2) 0 var(--space-3); }
.viewer-note { margin: 0 0 var(--space-2); }

/* ---------- やりとり（チャット） ---------- */
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; }
.chat { display: grid; grid-template-columns: 300px 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); height: calc(100vh - 96px); min-height: 480px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow-y: auto; }
.chat-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 8px; }
.chat-list-head h1 { font-size: 18px; margin: 0; }
.chat-chips { padding: 0 14px 10px; margin: 0; }
.chat-chips .chip-btn { padding: 2px 10px; font-size: 12px; }
.thread-list { list-style: none; padding: 0; margin: 0; }
.thread-row { border-top: 1px solid var(--line); }
.thread-row.active { background: var(--brand-soft); }
.thread-link { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--text); }
.thread-link:hover { background: var(--soft); text-decoration: none; }
.thread-row.active .thread-link:hover { background: var(--brand-soft); }
.thread-list.compact .thread-row { border-top: 0; border-bottom: 1px dashed var(--line); }
.thread-list.compact .thread-link { padding: 8px 4px; }
.thread-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; flex: none; }
.thread-row.unread .thread-dot { background: var(--brand); }
.thread-row.unread .thread-subject { font-weight: 600; }
.thread-row.done .thread-subject { color: var(--muted); }
.thread-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.thread-subject { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-empty { margin: auto; text-align: center; padding: 24px; }
.chat-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-back { display: none; font-size: 18px; line-height: 28px; }
.chat-head-main { flex: 1; min-width: 0; }
.chat-subject { font: inherit; font-weight: 600; font-size: 16px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 2px 6px; margin-left: -6px; width: 100%; background: transparent; }
.chat-subject:hover, .chat-subject:focus { border-color: var(--line-strong); background: #fff; }
.chat-subject-text { font-size: 16px; }
.chat-head-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.chat-head-sub select { width: auto; min-height: 26px; padding: 1px 6px; font-size: 12px; }
.chat-head-sub label.inline { gap: 4px; }
.messages { flex: 1; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 16px; min-height: 0; }
.msg-day { align-self: center; padding: 2px 10px; background: var(--soft); border-radius: 10px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 14px; background: var(--soft); border: 1px solid var(--line); align-self: flex-start; }
.msg.my-org { align-self: flex-end; background: var(--brand-soft); border-color: #f3c9ce; }
.msg-head { margin-bottom: 2px; }
.msg-body { font-size: 14px; line-height: 22px; }
.msg-files { list-style: none; padding: 6px 0 0; margin: 0; }
.composer { border-top: 1px solid var(--line); padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.composer textarea { width: 100%; resize: vertical; }
.composer-foot { display: flex; align-items: center; gap: 12px; }
.composer-attach { cursor: pointer; color: var(--muted); }
.composer-attach:hover { color: var(--text); }
.composer-foot .form-error { flex: 1; }
.composer-foot .btn { margin-left: auto; }
@media (max-width: 767px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 72px); }
  .chat-list { border-right: 0; }
  .chat.chat-open .chat-list { display: none; }
  .chat:not(.chat-open) .chat-pane { display: none; }
  .chat-back { display: block; }
  .msg { max-width: 90%; }
}
/* 代理店の案件ページ（右パネルなし） */
.case-body:not(:has(.case-panel)) { grid-template-columns: minmax(0, 1fr); } /* 1fr だと中身の幅より狭くならず、スマホで横にはみ出す */
.case-main > .card + .card { margin-top: 16px; }
/* 代理店の案件表：余白を抑えて読みやすく */
.agency-table td, .agency-table th { padding: 8px 12px; }
.agency-table .pill-ready { background: var(--info-soft); color: var(--info); }

/* 資料ページ */
.material-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.material-list li > .link { font-weight: 500; }
.material-list li > .btn { margin-left: auto; }

/* 案件一覧「次にやること」：番号バッジと文字の間、行の余白 */
.next-cell { line-height: 1.7; padding-top: 12px; padding-bottom: 12px; }
.next-cell .count { margin-right: 8px; line-height: 20px; }
.next-cell .party { margin-right: 8px; }
.next-cell > span { display: inline-block; max-width: 36em; }

/* LINE につなぐ */
.line-panel { max-width: 520px; }
.line-code { font-size: 32px; letter-spacing: .2em; font-weight: 700; text-align: center; margin: 12px 0; }

/* ---------- 郵便番号⇄住所の案内 ---------- */
.postal-hint { flex-basis: 100%; font-size: 12px; color: var(--muted); font-weight: 400; }
.postal-hint[data-kind="ok"] { color: var(--ok, #15803d); }
.postal-hint[data-kind="warn"] { color: var(--warn, #b45309); }

/* ---------- スマホ（LINE の中など）：入力欄とボタンを指で押しやすく。文字 16px で iOS の自動拡大を防ぐ ---------- */
@media (max-width: 640px) {
  input, select, textarea { font-size: 16px; min-height: 44px; padding: 10px 12px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 22px; height: 22px; }
  .btn { min-height: 44px; font-size: 15px; }
  .btn-small { min-height: 36px; font-size: 14px; }
  label { font-size: 14px; gap: 4px 8px; }
  label > input, label > select, label > textarea { flex-basis: 100%; }
  .center-card { margin: 0; padding: 20px 16px; border-radius: 0; border-left: none; border-right: none; max-width: none; }
  .intake-card { margin-top: 0; }
  .intake-card fieldset { padding: var(--space-3); }
  .intake-card .inline-choices { flex-wrap: wrap; gap: var(--space-3) var(--space-4); }
  .intake-card .inline { font-size: 15px; }
  .form-grid { gap: 12px; }
  .page { padding-left: 12px; padding-right: 12px; }
}
body.liff .page { padding: 0; }
body.liff .center-card { margin: 0; border: none; border-radius: 0; max-width: none; }

/* ---------- LINE リッチメニュー（管理画面） ---------- */
.line-richmenu { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); display: grid; gap: var(--space-2); }
.line-richmenu h3 { margin: 0; font-size: 15px; }
.line-richmenu .actions { align-items: center; flex-wrap: wrap; }
.richmenu-preview { width: 240px; border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- お客さまのマイページ（LINE の中） ---------- */
.mp { max-width: 560px; margin: 0 auto; }
.mp-head { padding: 16px 16px 8px; }
.mp-head h1 { color: var(--brand); font-size: 20px; }
.mp-tabs { display: flex; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; }
.mp-tabs button { flex: 1; border: none; background: none; font: inherit; font-size: 15px; padding: 12px 0; color: var(--muted); border-bottom: 2px solid transparent; }
.mp-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.mp-body { padding: 16px; display: grid; gap: 16px; }
.mp-case { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; }
.mp-case h2 { font-size: 16px; margin: 0 0 4px; }
.mp-status { font-size: 18px; font-weight: 600; color: var(--brand); margin: 4px 0 12px; }
.mp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; counter-reset: s; }
.mp-steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.mp-steps li::before { counter-increment: s; content: counter(s); width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: none; background: #fff; }
.mp-steps li.done { color: var(--text); }
.mp-steps li.done::before { background: var(--brand); border-color: var(--brand); color: #fff; content: "✓"; }
.mp-steps li.now { color: var(--brand); font-weight: 600; }
.mp-steps li.now::before { border-color: var(--brand); color: var(--brand); border-width: 2px; }
.mp-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mp-files li { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 14px; }
.mp-upload { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.mp-upload h3 { margin: 0; font-size: 15px; }
.mp-chat { display: grid; gap: 10px; }
.mp-send { display: grid; gap: 8px; }

/* ---------- 案件ページ：お客さまの LINE ---------- */
.customer-link { display: grid; gap: var(--space-2); }
.customer-link input { font-size: 13px; color: var(--muted); }
.customer-link.off input { text-decoration: line-through; }
#customer-link-qr-box svg { width: 200px; height: 200px; display: block; }

.mp-preview { background: var(--warn-soft, #fff7e6); color: var(--warn, #b45309); font-size: 13px; padding: 8px 16px; }

/* ---------- 商社：申請表の一覧 ---------- */
.cert-list { display: grid; gap: var(--space-3); }
.cert-req { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); display: grid; gap: var(--space-2); }
.cert-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.cert-sites { display: grid; gap: var(--space-2); }
.cert-sites li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }

/* ---------- お客さまの LINE：連携ID ---------- */
.link-code { display: grid; gap: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4); }
.link-code-main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.link-code-value { font-size: 26px; letter-spacing: .12em; font-feature-settings: "tnum"; }
.link-code.off .link-code-value { color: var(--muted); text-decoration: line-through; }
.link-code { min-width: 0; }
.link-code .actions { flex-wrap: wrap; }
.link-code .actions .btn { white-space: nowrap; }

/* ---------- 管理画面：LINE 通知の一覧と送信履歴 ---------- */
.line-rules, .line-history { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); display: grid; gap: var(--space-2); }
.line-rules h3, .line-history h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.line-history-table td { vertical-align: top; }

/* ---------- 名義 ---------- */
.applicant-choice { display: grid; gap: 6px; }
.applicant-card .actions { align-items: center; flex-wrap: wrap; }

/* ---------- スマホ：販売店・代理店の案件一覧は 1 件 1 枚のカードに（LINE の中で開いたとき見やすく） ---------- */
@media (max-width: 640px) {
  .case-cards thead { display: none; }
  .case-cards, .case-cards tbody, .case-cards tr, .case-cards td { display: block; width: 100%; }
  .case-cards tr { border-bottom: 1px solid var(--line); padding: 10px 14px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; }
  .case-cards td { border: none; padding: 0; }
  .case-cards td[data-label="番号"] { grid-row: 1; }
  .case-cards td[data-label="案件"] { grid-row: 1; font-weight: 600; }
  .case-cards td[data-label="お客さま"], .case-cards td[data-label="状況"], .case-cards td[data-label="最後の動き"] { grid-column: 1 / -1; }
  .case-cards td[data-label="お客さま"] { color: var(--muted); font-size: 13px; }
}

/* ---------- スマホ：表を 1 行 1 枚のカードに（.stack-mobile。欄名は td の data-label から出す） ---------- */
@media (max-width: 640px) {
  .stack-mobile thead { display: none; }
  .stack-mobile, .stack-mobile tbody, .stack-mobile tr, .stack-mobile td { display: block; width: 100%; }
  .stack-mobile { border: 0; background: transparent; }
  .stack-mobile tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 10px; }
  .stack-mobile tr[hidden] { display: none; }
  .stack-mobile td, .stack-mobile td:last-child { border: 0; padding: 3px 0; white-space: normal; overflow-wrap: anywhere; }
  .stack-mobile td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; }
  .stack-mobile td.stack-title { font-size: 15px; }
  .stack-mobile td.stack-title::before, .stack-mobile td:empty { display: none; }
}
@media (max-width: 640px) { .stack-mobile td, .stack-mobile td:nth-child(n) { display: block; } }
/* スマホ：管理画面の人・代理店の行は 1 列に（「2 列ぶん」の欄があると、見えない 2 列目ができて右がはみ出すため） */
@media (max-width: 640px) {
  .people-table tr { grid-template-columns: minmax(0, 1fr); }
  .people-table td, .people-table td.span-2, .people-table .row-actions { grid-column: 1 / -1; }
  .agency-table td { padding: 0; }
}
/* 商社の申請表カード：中身が長くても枠からはみ出さない */
.cert-req { grid-template-columns: minmax(0, 1fr); }
.cert-sites li > * { min-width: 0; overflow-wrap: anywhere; }
/* 申請表カードの余白（.plain li の余白の上書き） */
.cert-list > li.cert-req { padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-lg); }

/* 管理画面：LINE につながっている人 */
.line-people-title { margin: var(--space-3) 0 0; font-size: 15px; }
.line-people li { align-items: center; }
.line-people .actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

/* ---------- 電柱（写真・札・地図のピン） ---------- */
.poles { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.poles > h3 { margin: 4px 0 0; }
.pole-tips { width: 100%; background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; }
.pole-tips summary { cursor: pointer; font-weight: 600; }
.pole-tips ol { margin: 8px 0 2px; padding-left: 1.4em; display: flex; flex-direction: column; gap: 4px; line-height: 1.6; }
.pole-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.pole-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.pole-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pole-head .pole-del { margin-left: auto; font-size: 12px; color: var(--danger); }
.pill-supply { background: #e8f0fe; color: #1d4ed8; }
.pole-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.pole-photo { position: relative; margin: 0; width: 96px; height: 96px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: #f3f4f6; }
.pole-photo img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.pole-photo-del { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 14px; line-height: 22px; padding: 0; }
.pole-photo-add { width: 96px; height: 96px; border: 1.5px dashed var(--line); border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; font-size: 13px; color: var(--brand); text-align: center; }
.pole-photo-add small { color: var(--muted, #6b7280); font-size: 11px; }
.pole-photo-add.is-busy { pointer-events: none; opacity: .6; }
.pole-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.pole-fields .pole-note { grid-column: 1 / -1; }
.pole-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pin-map .viewer-panel { height: min(90vh, 760px); }
.pin-map-canvas { flex: 1; min-height: 300px; border: 1px solid var(--line); border-radius: var(--radius); }
.pin-map .actions { margin-top: 8px; }
.pole-pin { width: 18px !important; height: 18px !important; }
.pole-pin-dot { display: block; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #9ca3af; background: rgba(255,255,255,.85); box-sizing: border-box; }
.pole-pin.is-target .pole-pin-dot { border-color: #e11d1d; }
.pole-pin .pin-label { position: absolute; left: 22px; top: -1px; white-space: nowrap; font-size: 12px; font-weight: 700; color: #111; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff; }
@media (max-width: 640px) {
  .viewer.pin-map { padding: 0; }
  .pin-map .viewer-panel { height: 100%; border-radius: 0; }
  .pole-fields { grid-template-columns: 1fr; }
}

/* ---------- お客さまに入力をお願いする（案件の「お客さまの LINE」カード） ---------- */
.ask-input { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.ask-input textarea { width: 100%; }

/* ---------- LINE のマイページ「入力」 ---------- */
.mp-input-lead { margin: 4px 0 12px; }
.mp-input h3 { font-size: 15px; margin: 12px 0 0; }
.mp-input .form-grid { grid-template-columns: 1fr; }
.mp-input .form-grid .span-2 { grid-column: 1 / -1; }
.mp-poles { margin-top: 16px; }

/* ---------- お客さまが LINE で変えたところ ---------- */
.change-list { margin: 4px 0 6px; padding-left: 1.2em; list-style: disc; overflow-wrap: anywhere; word-break: break-word; }
.change-list .nowrap { white-space: normal; }
.change-item + .change-item { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.pole-supply-hint { width: 100%; margin: 0; padding: 8px 12px; border-radius: var(--radius); background: #fff8e6; color: #92400e; }
.line-people li + li { margin-top: 2px; }
.danger-link { color: var(--danger); font-size: 12px; margin-left: 4px; }

/* ---------- 名前の欄（姓・名の 2 つ） ---------- */
.name-pair { display: flex; gap: 8px; flex: 1 0 100%; width: 100%; margin-top: 2px; }
.name-pair input { flex: 1 1 0; min-width: 0; width: 0; font-weight: 400; color: var(--text); } /* width:0 と flex で半分ずつ。入力欄の元の幅（約20文字）で画面が横に広がらないように */
fieldset { min-width: 0; } /* fieldset は中身の幅より狭くならない（min-content）のが既定。スマホで横にはみ出さないように */

/* ---------- ログイン画面の「LINE でログイン」 ---------- */
.login-line { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; }
.btn-line { background: #06c755; border-color: #06c755; color: #fff; justify-content: center; }
.btn-line:hover { background: #05b34c; border-color: #05b34c; color: #fff; }

/* ---------- 縦に並べるフォーム（LINE の登録の申し込みなど） ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label > small.muted { flex-basis: 100%; margin-top: 2px; }
.form .actions { margin-top: 4px; }
.form .btn-primary { width: 100%; padding: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: #374151; font-weight: 500; }
.inline-choices { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.choice-list { display: flex; flex-direction: column; gap: 12px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg, 10px); background: #fff; cursor: pointer; font: inherit; }
.choice strong { font-size: 16px; color: var(--text); }
.choice span { font-size: 13px; color: var(--muted); }
.choice:active, .choice:hover { border-color: var(--brand); }
/* スマホでは「前 → 後」も折り返す（長い値で画面が横に広がらないように） */
@media (max-width: 640px) { .nowrap { white-space: normal; overflow-wrap: anywhere; } }
.case-panel { min-width: 0; grid-template-columns: minmax(0, 1fr); } /* 履歴の長い行で、スマホの画面が横に広がらないように */
.panel-log li > span { min-width: 0; overflow-wrap: anywhere; }
