:root {
  --c-main: #1a6b6b; --c-main-dark: #145454; --c-bg: #fafbfb; --c-bg2: #f4f6f6;
  --c-line: #cfd6d6; --c-line2: #e2e6e6; --c-text: #1c1c1a; --c-muted: #6b6b66;
  --c-warn: #a32b2b; --c-warn-bg: #fbe9e9; --c-done: #1f6b3a; --c-done-bg: #e6f3ea;
  --c-prog: #8a5a1a; --c-prog-bg: #fdebd0; --c-caution: #8a4500; --c-caution-bg: #fff0dc;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; background: var(--c-bg); color: var(--c-text); font-size: 15px; line-height: 1.6; }
a { color: var(--c-main); }
h1 { font-size: 1.35rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
code { background: var(--c-bg2); padding: .05em .35em; border-radius: 4px; font-size: .9em; }

.topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; padding: .6rem 1rem; background: #fff; border-bottom: 1px solid var(--c-line); }
.brand { display: flex; align-items: center; gap: .6rem; }
.brand-name { font-weight: 700; color: var(--c-main); font-size: 1.05rem; }
.brand-sep { width: 1px; height: 1.1rem; background: var(--c-line); }
.scope-badge { font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--c-line); color: var(--c-muted); background: var(--c-bg2); }
.scope-admin { color: var(--c-main); border-color: var(--c-main); background: #fff; }
.scope-viewer { color: var(--c-prog); border-color: var(--c-prog); background: var(--c-prog-bg); }
.nav-links { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.nav-links a { text-decoration: none; color: var(--c-text); }
.nav-links a:hover { color: var(--c-main); }
.nav-sep { width: 1px; height: 1.1rem; background: var(--c-line); }
.logout-form { display: inline; }

.main { max-width: 960px; margin: 0 auto; padding: 1rem; }
.card { background: #fff; border: 1px solid var(--c-line2); border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.card-narrow { max-width: 480px; margin: 1.5rem auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.big { font-size: 1.6rem; font-weight: 700; margin: .25rem 0; }
.hint { color: var(--c-muted); font-size: .9rem; }

label { display: block; margin: .6rem 0; font-weight: 500; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; border: 1px solid var(--c-line); border-radius: 6px; font: inherit; background: #fff; }
input[type=file] { margin-top: .25rem; }
.pw-toggle { font-weight: 400; font-size: .9rem; }
.pw-toggle input { display: inline; width: auto; margin-right: .3rem; }
.check-label { font-weight: 400; font-size: .9rem; }
.check-label input { display: inline; width: auto; margin-right: .3rem; }
.team-fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
.team-fieldset legend { font-weight: 600; padding: 0; }
.field-inline { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; }
.field-inline label { flex: 1 1 200px; }

.btn { display: inline-block; padding: .45rem 1rem; border-radius: 6px; border: 1.5px solid var(--c-main); background: var(--c-main); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--c-main-dark); }
.btn-primary { }
.btn-ghost { background: #fff; color: var(--c-main); }
.btn-ghost:hover { background: var(--c-bg2); }
.btn-danger { background: #fff; color: var(--c-warn); border-color: var(--c-warn); }
.btn-danger:hover { background: var(--c-warn-bg); }
.btn-mini { padding: .2rem .6rem; font-size: .85rem; font-weight: 500; }

.alert { padding: .6rem .8rem; border-radius: 6px; background: var(--c-warn-bg); color: var(--c-warn); border: 1px solid var(--c-warn); margin: .5rem 0; }
.alert-warn { background: var(--c-prog-bg); color: var(--c-prog); border-color: var(--c-prog); }
.alert-ok { background: var(--c-done-bg); color: var(--c-done); border-color: var(--c-done); }

.table { width: 100%; border-collapse: collapse; background: #fff; font-size: .95rem; }
.table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--c-line2); vertical-align: top; }
.table th { background: var(--c-bg2); font-weight: 600; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.badge { display: inline-flex; align-items: center; gap: .35em; font-size: .85rem; font-weight: 600; color: var(--c-muted); white-space: nowrap; }
.badge::before { content: ""; width: .55em; height: .55em; border-radius: 50%; background: currentColor; flex: none; }
.badge-active, .badge-open, .badge-done { color: var(--c-done); }
.badge-inactive, .badge-declined { color: var(--c-warn); }
.badge-draft, .badge-in_progress { color: var(--c-prog); }
.badge-warn { color: var(--c-caution); }
.badge-closed, .badge-finalized { }
.row-warn td { background: #fffaf0; }
.row-error td { background: var(--c-warn-bg); }

.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 10px; padding: 1.25rem; max-width: 420px; width: calc(100% - 2rem); }
.modal-msg { margin: 0 0 1rem; white-space: pre-line; }
.modal-actions { display: flex; gap: .5rem; justify-content: flex-end; }

@media (max-width: 600px) {
  body { font-size: 15px; }
  .main { padding: .75rem; }
  .card { padding: .85rem 1rem; }
  .nav-links { gap: .6rem; }
}

.extra-q { border: 1px solid var(--line-soft, #e2e6e6); border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.extra-q legend { font-weight: 600; padding: 0 6px; }

.notice { background: #f4f6f6; border-radius: 8px; padding: 10px 14px; margin: 12px 0; font-size: 0.92rem; }
.notice p { margin: 4px 0; }
.q { border: 1px solid #e2e6e6; border-radius: 8px; padding: 12px 14px; margin: 14px 0; }
.q legend { font-weight: 600; padding: 0 6px; }
.q-options { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 6px 0; }
.q-options label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.q-sub { margin: 8px 0 0 4px; padding-left: 10px; border-left: 3px solid #cfd6d6; }
.q-sub[hidden] { display: none; }
.assure { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 8px; padding: 8px 10px; border-radius: 8px; background: var(--c-done-bg); color: var(--c-done); font-size: .92rem; }
.assure-icon { flex: none; margin-top: .2em; }
.q-options-col { flex-direction: column; align-items: flex-start; gap: 6px; }

.inline-form { display: inline; }

.resend-title { font-size: 1rem; margin-top: 20px; }

/* 回答タブ（B-2 Task 8・設計 §5-1・改訂 §5-3）: 返信状態＝灰（対象外・本人）・既定（未返信で 3 暦日未満）・赤（未返信で 3 暦日以上）・緑（返信済み）／絞り込み（GET・狭い画面は折り返す）／左の一覧と右の詳細の 2 列（狭い画面は縦に積む） */
.reply-badge { display: inline-block; font-size: .8rem; padding: .05rem .5rem; border-radius: 999px; border: 1px solid var(--c-line); white-space: nowrap; }
.reply-none { color: var(--c-muted); background: var(--c-bg2); border-color: var(--c-line2); }
.reply-operator { color: var(--c-muted); background: var(--c-bg2); border-color: var(--c-line2); }
.reply-pending { color: var(--c-text); background: #fff; border-color: var(--c-line); }
.reply-overdue { color: var(--c-warn); background: var(--c-warn-bg); border-color: var(--c-warn); font-weight: 600; }
.reply-done { color: var(--c-done); background: var(--c-done-bg); border-color: var(--c-done); }
.filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: .25rem 1rem; margin: 0 0 1rem; }
.filter-form label { margin: 0; }
.filter-form select { min-width: 10rem; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
@media (max-width: 800px) { .split { grid-template-columns: minmax(0, 1fr); } }
.month-switch { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: 0 0 1rem; }
.month-current { font-weight: 700; }
tr.is-selected td { background: var(--c-bg2); }
.answers { margin: .5rem 0 1rem; }
.answers dt { font-size: .85rem; color: var(--c-muted); margin-top: .6rem; }
.answers dd { margin: .1rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.reply-log { list-style: none; margin: .5rem 0 1rem; padding: 0; }
.reply-log li { border-left: 3px solid var(--c-line); padding: .1rem 0 .1rem .6rem; margin: .5rem 0; }
.reply-body { margin: .25rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.reply-kinds { border: 0; padding: 0; margin: .5rem 0; }
.reply-kinds label { display: inline-flex; align-items: center; gap: .35rem; margin: 0 1rem .25rem 0; font-weight: 400; }
.plain-list { list-style: none; margin: .25rem 0; padding: 0; }
.plain-list li { padding: .25rem 0; border-bottom: 1px solid var(--c-line2); }

.mypage { max-width: 640px; margin: 1.5rem auto; }
.mypage .weather { font-size: 1.25rem; }
.mypage-history { font-size: .85rem; }
.mypage-history th { white-space: normal; }
.mypage-history th, .mypage-history td { padding: .4rem .35rem; }
.mypage-history th:first-child, .mypage-history td:first-child { min-width: 6.5em; }
.mypage-history th:nth-child(2), .mypage-history td:nth-child(2) { min-width: 3em; }
.voices { list-style: none; margin: 0; padding: 0; }
.voice { border-left: 3px solid var(--c-line); padding: .35rem 0 .35rem .75rem; margin: .6rem 0; }
.voice-admin { border-left-color: var(--c-main); }
.voice-meta { margin: 0; color: var(--c-muted); font-size: .85rem; }
.voice-kind { font-weight: 600; color: var(--c-text); }
.voice-body { margin: .2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.thanks-list { margin: .25rem 0; padding-left: 1.2rem; }
.thanks-past { margin-top: .75rem; }
.thanks-past:first-child { margin-top: 0; }
.thanks-past summary { cursor: pointer; font-weight: 600; }
.thanks-past:first-child summary { font-size: 1.1rem; font-weight: 700; }   /* 今月の節が無い人は、これがカードの見出しになる */
.thanks-past .hint { margin: .75rem 0 .1rem; }

/* 全社の今月: ありがとうの流れの行列（B-2 Task 10・改訂 §5-2）。会社の境目の区切り線はクラスで（CSP＝インラインの style を使わない） */
.flow-matrix th, .flow-matrix td { white-space: nowrap; }
.flow-matrix td { text-align: center; }
.flow-matrix .flow-sep-col { border-left: 2px solid var(--c-line); }
.flow-matrix .flow-sep-row > th, .flow-matrix .flow-sep-row > td { border-top: 2px solid var(--c-line); }
.flow-matrix .flow-total { font-weight: 600; }
.flow-matrix tfoot th, .flow-matrix tfoot td { background: var(--c-bg2); }
.thanks-dept tfoot td { background: var(--c-bg2); font-weight: 600; }
.team-mine td { background: var(--c-done-bg); font-weight: 600; }
.team-mine .badge-mine { display: inline-block; margin-left: .5em; padding: 0 .45em; border-radius: 4px; font-size: .8rem; font-weight: 600; background: var(--c-main); color: #fff; }
.ops-errors { margin-top: .25rem; }
.ops-errors summary { cursor: pointer; }

/* 本人専用リンクの入口（U6・設計 2026-10-09 §2-2）。中央寄せと緑のマーク。インラインの style は使わない（CSP・CspPinTest） */
.entry { text-align: center; }
.entry-mark { display: block; width: 64px; height: 64px; margin: .25rem auto 1rem; border-radius: 14px; }
.entry form { margin: 1.25rem 0 1rem; }

/* U3（2026-10-09 設計 §5）: 名簿・チームの操作の列。編集と無効化を横に並べて折り返さない・間をあける（.inline-form の display: inline は既存のまま） */
.row-actions { white-space: nowrap; }
.row-actions > * + * { margin-left: .5rem; }

/* U4 設問の表（設計 2026-10-09 §6）: 設問文の列を広く・2 行の枠は縦だけ伸ばせる。CSP＝インラインの style を使わずクラスで */
.q-table .q-text { width: 55%; min-width: 18rem; }
.q-table .q-opts { width: 22%; }
.q-table textarea { resize: vertical; }

/* U5 試し送り（設計 2026-10-09 §7-1）: 「保存だけする」「保存して試し送りする」を横に並べる・狭い画面は折り返す */
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.btn-row .btn { min-width: 12rem; }

/* R2 名簿の氏名の列（独立レビュー・東郷さん案 A）: 他の列に押されて「山田 太郎」が折り返さないよう最低幅を持たせる（td は変えない＝th で列が決まる） */
.table .col-name { min-width: 5.5em; }

/* 名簿のメールは途中でも折り返す＝氏名の最低幅で 960px からはみ出さない（Task 17 G3） */
.table .col-mail { overflow-wrap: anywhere; }

/* 「配信しない」（2026-10-13 設計 §6・nd Task 6）: 名簿の状態のバッジの下に重ねる灰色の印。新しい列は足さない（960px で操作の列を枠の中に保つ） */
.badge-nodelivery { display: flex; margin-top: .15rem; color: var(--c-muted); }

/* ダッシュボードの横棒（B-3 便 2・Task 5）。棒はインライン SVG の属性（x・width）で描き、色はクラスで（CSP＝インラインの style を使わない） */
.hbar { display: block; width: 100%; min-width: 6rem; height: 12px; }
.bar-main { fill: var(--c-main); }
.bar-muted { fill: var(--c-line); }
.dash-table .chart-bar { width: 45%; vertical-align: middle; }
.dash-table td:first-child { min-width: 7em; }   /* 375px で切り口の名前が 2〜3 字の幅に詰まらない */
.dash-table .chart-bar ~ td { white-space: nowrap; }
/* 隣り合う表（ダッシュボードの切り口ごとの数字の 2 つ目＝Q3 の相手）を 1 つの長い表に見せない */
.table-wrap + .table-wrap { margin-top: 1rem; }
.legend-main::before, .legend-muted::before { content: ""; display: inline-block; width: .7em; height: .7em; margin-right: .35em; border-radius: 2px; }
.legend-main::before { background: var(--c-main); }
.legend-muted::before { background: var(--c-line); }
.legend span + span { margin-left: 1em; }

/* 確定前のプレビューの通知の文面（B-3 便 2・Task 7）: 本文の改行をそのまま見せ、長いリンクの代わりの語も折り返す */
.notify-body { white-space: pre-line; overflow-wrap: anywhere; }

/* ダッシュボードの横に長い表（B-3 便 3・部署のあいだの流れ）: 折り返さず 1 列目（語）を横にずらしても残す。ヘッダーと合計の行は灰の地 */
.dash-wide td, .dash-wide th { white-space: nowrap; }
.dash-wide tr > :first-child { position: sticky; left: 0; background: #fff; }
.dash-wide thead tr > :first-child, .dash-wide tfoot tr > :first-child { background: var(--c-bg2); }

/* ダッシュボードの月ごとの推移（B-3 便 3・インライン SVG の折れ線）: 全体は緑の実線・SUMUS は灰の実線・札促社は灰の点線。確定前の月の点は白抜きの破線の縁（札促社の確定月の白抜きと見分ける） */
.trend { display: block; width: 100%; height: auto; max-width: 640px; }
.trend polyline { fill: none; stroke-width: 2; }
.trend text { font-size: 11px; fill: var(--c-muted); }
.trend-main { stroke: var(--c-main); }
.trend-muted, .trend-dashed { stroke: var(--c-muted); }
.trend-dashed { stroke-dasharray: 5 4; }
.trend .dot-main { fill: var(--c-main); }
.trend .dot-muted { fill: var(--c-muted); }
.trend .dot-dashed { fill: #fff; stroke: var(--c-muted); stroke-width: 1.5; }
.trend .dot-midway { fill: #fff; stroke: var(--c-muted); stroke-width: 1.5; stroke-dasharray: 2 2; }
.trend .dot-midway.dot-main { stroke: var(--c-main); }
.legend-dot-midway::before { content: ""; display: inline-block; width: .7em; height: .7em; margin-right: .35em; vertical-align: middle; border: 1.5px dashed var(--c-muted); border-radius: 50%; }
.legend-line-main::before, .legend-line-muted::before, .legend-line-dashed::before { content: ""; display: inline-block; width: 1.4em; margin-right: .35em; vertical-align: middle; border-top: 2px solid var(--c-muted); }
.legend-line-main::before { border-top-color: var(--c-main); }
.legend-line-dashed::before { border-top-style: dashed; }
.dash-jump a { margin-right: 1em; }
@media (max-width: 600px) { .trend text { font-size: 16px; } }
