:root {
  --g: #26833A; --g-dark: #1e6a2f; --gl: #EAF4EC; --gl2: #f3f9f4;
  --ink: #1f2a24; --muted: #66736c; --line: #d9e4dd; --bg: #f4f7f5; --card: #fff;
  --red: #c62828; --red-bg: #fdecec; --yellow: #b26a00; --yellow-bg: #fff4d6; --blue: #1f5fa8; --blue-bg: #e7f0fb; --info: #4a5a52; --info-bg: #eef1ef;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.55; font-feature-settings: 'palt'; }
table, input[type=date], .ym select, .counter { font-variant-numeric: tabular-nums; }
a { color: var(--g); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 7px 9px; border: 1px solid #b9c9be; border-radius: 7px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(38,131,58,.35); border-color: var(--g); }
/* 例文（未入力）は薄く、入力済みは濃い文字＋淡い緑地で見分ける */
input::placeholder, textarea::placeholder { color: #b3bcb7; opacity: 1; }
input:not([type=checkbox]):not([type=file]):not([readonly]):not(:placeholder-shown), textarea:not(:placeholder-shown) { background: #f6fbf7; border-color: #a7c9b0; color: #111; }
input[type=date]:valid { background: #f6fbf7; border-color: #a7c9b0; }
select:has(option:checked:not([value=""])) { background: #f6fbf7; border-color: #a7c9b0; }
/* 必須で未入力 → 赤枠。カーソルを当てると入力見本は消える */
input:required:invalid, select:required:invalid, textarea:required:invalid { border-color: var(--red); background: #fff7f7; }
input:focus::placeholder, textarea:focus::placeholder { color: transparent; }
label .req { color: var(--red); font-size: 10px; margin-left: 4px; font-weight: 600; }
/* 書類チェックが付いている欄 */
input.chk-red, select.chk-red, textarea.chk-red { border-color: var(--red) !important; background: #fff7f7 !important; box-shadow: 0 0 0 2px rgba(198,40,40,.15); }
input.chk-yellow, select.chk-yellow, textarea.chk-yellow { border-color: var(--yellow) !important; background: #fffaf0 !important; box-shadow: 0 0 0 2px rgba(178,106,0,.15); }
input.chk-blue, select.chk-blue, textarea.chk-blue { border-color: var(--blue) !important; background: #f4f8fd !important; }
textarea { min-height: 72px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--g); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--g-dark); }
.btn.ghost { background: #fff; color: var(--g); border: 1.5px solid var(--g); }
.btn.ghost:hover { background: var(--gl); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.hidden { display: none !important; }

/* login */
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: min(440px, 92vw); text-align: center; }
.brand { display: flex; align-items: center; gap: 12px; text-align: left; margin-bottom: 18px; }
.brand-mark { background: var(--g); color: #fff; font-weight: 800; border-radius: 10px; padding: 8px 10px; letter-spacing: .05em; }
.brand-title { font-weight: 800; font-size: 17px; } .brand-sub { color: var(--muted); font-size: 12px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

/* layout */
.topbar { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 3px solid var(--g); display: flex; align-items: center; gap: 14px; padding: 8px 16px; }
.topbar .brand { margin: 0; } .topbar .spacer { flex: 1; }
.topbar .user { font-size: 12px; color: var(--muted); }
main { max-width: 1280px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 15px; color: var(--g-dark); display: flex; align-items: center; gap: 8px; }
.card h2 .tag { font-size: 11px; background: var(--gl); color: var(--g-dark); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.field { margin-bottom: 8px; }
.toolbar-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status { font-size: 12px; color: var(--muted); }

/* list */
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
table.list th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.list tr:hover td { background: var(--gl2); cursor: pointer; }
.pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 11px; font-weight: 700; }
.pill.ok { background: var(--gl); color: var(--g-dark); } .pill.warn { background: var(--yellow-bg); color: var(--yellow); } .pill.gray { background: var(--info-bg); color: var(--info); } .pill.red { background: var(--red-bg); color: var(--red); }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.side { position: sticky; top: 64px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 80px); overflow: auto; }
@media (max-width: 1000px) { .editor { grid-template-columns: 1fr; } .side { position: static; max-height: none; } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 8px 12px; cursor: pointer; border-bottom: 3px solid transparent; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tabs button.active { color: var(--g-dark); border-bottom-color: var(--g); }
.tabs button .n { background: var(--red); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; margin-left: 4px; }

.row-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #fbfdfb; position: relative; }
.row-item.flag-red { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-bg); }
.row-item.flag-yellow { border-color: var(--yellow); box-shadow: 0 0 0 2px var(--yellow-bg); }
.row-item .row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.row-item .row-head .idx { font-weight: 800; color: var(--g-dark); }
.row-item .row-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; cursor: pointer; font-size: 12px; }
.icon-btn:hover { background: var(--gl); }
.ym { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ym select { padding: 6px 4px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline label { margin: 0; }
.checkbox { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; color: var(--ink); font-size: 13px; }
.checkbox input { width: auto; }

/* checks */
.check { border-left: 4px solid; border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; background: #fff; }
.check.red, .check.yellow, .check.blue { border-color: var(--red); background: var(--red-bg); }
.check.acked { opacity: .55; background: #fff; border-color: #b9c4bd; }
a.ext { font-size: 12px; font-weight: 500; margin-left: auto; color: var(--g); text-decoration: none; border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
a.ext:hover { background: var(--gl); }
.check.info { border-color: #b9c4bd; background: var(--info-bg); color: var(--info); }
.check .code { font-weight: 800; font-size: 11px; margin-right: 6px; }
.check .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.check .acts { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.summary-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.check-group { margin-bottom: 10px; }
.check-group-title { font-size: 12px; font-weight: 700; color: var(--g-dark); border-bottom: 1px solid var(--line); padding: 4px 0; margin-bottom: 6px; cursor: pointer; }
.check-group-title:hover { text-decoration: underline; }
.counter { font-size: 11px; color: var(--muted); text-align: right; }
.counter.over { color: var(--red); font-weight: 700; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #1b1b1f; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.toast.err { background: var(--red); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: #fff; border-radius: 14px; padding: 18px; width: min(760px, 100%); max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 10px; }
.photo-box { width: 90px; height: 120px; border: 1px dashed #99a; border-radius: 6px; display: grid; place-items: center; overflow: hidden; background: #fafafa; font-size: 11px; color: var(--muted); text-align: center; }
.photo-box img { width: 100%; height: 100%; object-fit: cover; }
.kbd { background: #eee; border-radius: 4px; padding: 0 5px; font-family: ui-monospace, monospace; font-size: 12px; }
.linkbox { display: flex; gap: 6px; align-items: center; }
.linkbox input { font-size: 12px; }
pre.map { background: #f6f8f7; padding: 8px; border-radius: 8px; font-size: 12px; overflow: auto; max-height: 220px; }
.diff { display: grid; grid-template-columns: 1fr; gap: 4px; font-size: 12px; }
.diff .d { display: grid; grid-template-columns: 120px 1fr; gap: 8px; padding: 4px 6px; border-radius: 6px; background: var(--gl2); }

/* 一覧: 並び替え・選択・一括変更 */
table.list th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.list th.sortable:hover { color: var(--g-dark); }
table.list th.sortable .arrow { font-size: 9px; margin-left: 3px; color: #b8c2bc; }
table.list th.sortable.on { color: var(--g-dark); } table.list th.sortable.on .arrow { color: var(--g); }
table.list td[data-cell="check"] { cursor: default; width: 28px; } table.list td[data-cell="check"] input, table.list th input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--g); cursor: pointer; }
table.list tr.sel td { background: var(--gl2); }
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--gl); border: 1px solid var(--g); border-radius: 10px; padding: 8px 12px; margin: 6px 0 10px; font-size: 13px; }
.bulkbar select.sm { width: auto; min-width: 120px; padding: 4px 8px; font-size: 12px; }

select.sm.inline { width: auto; min-width: 110px; max-width: 180px; padding: 3px 6px; font-size: 12px; }
table.roster td[data-cell="ctl"] { cursor: default; }
select.st-drafting, select.st-confirming, select.st-confirmed, select.st-screening { color: var(--g-dark); font-weight: 700; } select.st-closed { color: var(--muted); }

/* 気づきを送る（右下固定） */
.fab { position: fixed; right: 18px; bottom: 18px; z-index: 30; background: #fff; color: var(--g-dark); border: 1.5px solid var(--g); border-radius: 999px; padding: 9px 14px; font-size: 13px; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.12); cursor: pointer; font-family: inherit; }
.fab:hover { background: var(--gl); }
@media print { .fab { display: none; } }
.modal .diff .d input { width: 100%; padding: 4px 6px; font-size: 12px; }

.doclink { margin-top: 10px; padding: 10px 12px; background: var(--gl2); border: 1px dashed var(--line); border-radius: 8px; }
.doclink .linkbox input { font-size: 12px; }

.flagbox.chk-red { outline: 2px solid var(--red); outline-offset: 4px; border-radius: 6px; background: #fff7f7; }
