/* ===== 評価仕様書兼報告書 画面用スタイル ===== */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --fg: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line2: #d1d5db;
  --pri: #1e3a8a;
  --pri-2: #2563eb;
  --pri-soft: #eef2ff;
  --ok: #15803d;
  --ng: #b91c1c;
  --hold: #b45309;
  --todo: #6b7280;
  --ok-bg: #22c55e;
  --ng-bg: #ef4444;
  --hold-bg: #f59e0b;
  --todo-bg: #cbd5e1;
  --na: #475569;
  --na-bg: repeating-linear-gradient(45deg, #94a3b8 0 4px, #cbd5e1 4px 8px);
  --warn-bg: #fff7ed;
  --warn-line: #fdba74;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --detail-w: min(560px, 46vw);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.6 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; }

/* ---- ボタン ---- */
.btn {
  display: inline-flex; align-items: center; gap: 4px; justify-content: center;
  padding: 7px 14px; border: 1px solid var(--line2); background: #fff; border-radius: 8px;
  cursor: pointer; white-space: nowrap; line-height: 1.3; text-decoration: none;
}
.btn:hover { background: #f9fafb; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--pri-2); border-color: var(--pri-2); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--ng); }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 3px 10px; font-size: 13px; }
.icon-btn { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.icon-btn:hover:not(:disabled) { background: #f3f4f6; }
.icon-btn:disabled { opacity: .3; cursor: default; }
.link { border: 0; background: none; color: var(--pri-2); cursor: pointer; padding: 0; text-align: left; }
.link:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--pri-2); outline-offset: 2px; }

/* ---- ヘッダ ---- */
.topbar {
  position: sticky; top: 0; z-index: 45;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--pri); color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; color: #3b82f6; }
.project-select { flex: 1; min-width: 0; display: flex; }
.project-select select {
  width: 100%; max-width: 420px; min-width: 0; padding: 6px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); color: #fff;
}
.project-select option { color: #111; }
.topbar .btn { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.3); }
.topbar .btn:hover { background: rgba(255,255,255,.2); }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  width: 300px; max-height: calc(100vh - 80px); overflow: auto;
  background: #fff; color: var(--fg); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 6px;
}
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--pri-soft); }
.menu button.danger { color: var(--ng); }
.menu-group { font-size: 11px; color: var(--muted); padding: 10px 12px 2px; font-weight: 700; letter-spacing: .05em; }

/* ---- タブ ---- */
.tabs { display: flex; gap: 4px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 50px; z-index: 20; }
.tab { border: 0; background: none; padding: 10px 16px; cursor: pointer; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; }
.tab.active { color: var(--pri); border-bottom-color: var(--pri-2); }

main { padding: 16px; max-width: 1600px; margin: 0 auto; }
body.detail-open main { margin-right: var(--detail-w); max-width: none; }

/* ---- カード / ダッシュボード ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.card-warn { border-color: var(--warn-line); }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.dash-head h1 { margin: 0; font-size: 22px; }
.dash-head p { margin: 2px 0 0; }

.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--pri-2);
  border-radius: var(--radius); padding: 12px 16px; cursor: pointer; text-align: left; box-shadow: var(--shadow);
}
.stat:hover { background: #fafbff; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-val { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat-ok { border-left-color: var(--ok-bg); } .stat-ok .stat-val { color: var(--ok); }
.stat-ng { border-left-color: var(--ng-bg); } .stat-ng .stat-val { color: var(--ng); }
.stat-hold { border-left-color: var(--hold-bg); } .stat-hold .stat-val { color: var(--hold); }
.stat-todo { border-left-color: var(--todo-bg); } .stat-todo .stat-val { color: var(--todo); }
.stat-na { border-left: 5px dashed var(--na); } .stat-na .stat-val { color: var(--na); }

.progress-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.progress-nums strong { font-size: 18px; }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #eef0f3; margin: 8px 0; }
.stack .seg { display: block; height: 100%; }
.seg-ok { background: var(--ok-bg); } .seg-ng { background: var(--ng-bg); } .seg-hold { background: var(--hold-bg); } .seg-todo { background: var(--todo-bg); } .seg-na { background: var(--na-bg); }
.seg-empty { background: #eef0f3; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.big-num { font-size: 34px; font-weight: 700; line-height: 1.2; }
.big-num small { font-size: 14px; color: var(--muted); font-weight: 400; }
.r-ok { color: var(--ok); } .r-ng { color: var(--ng); } .r-hold { color: var(--hold); } .r-todo { color: var(--todo); } .r-na { color: var(--na); }
h3.mt { margin-top: 16px; }
.na-break { list-style: none; margin: 4px 0 0; padding: 0; }
.na-break li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 3px 0; font-size: 13px; }
.alert { background: var(--warn-bg); border: 1px solid var(--warn-line); color: #9a3412; border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.ok-msg { color: var(--ok); margin: 8px 0 0; }
.item-links { margin: 6px 0 0; padding-left: 18px; }
.item-links li { margin: 2px 0; }

.table-scroll { overflow-x: auto; }
table.grp { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grp th, table.grp td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.grp thead th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.grp .num { text-align: right; }
table.grp .bar-cell { width: 35%; min-width: 160px; }
table.grp .bar-cell .stack { display: inline-flex; width: calc(100% - 56px); height: 10px; margin: 0; vertical-align: middle; }
table.grp .pct { display: inline-block; width: 52px; text-align: right; font-size: 12px; color: var(--muted); }

/* ---- 一覧 ---- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; }
.filters select, .filters input[type=search] {
  padding: 6px 8px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; min-width: 0; max-width: 200px;
}
.filters input[type=search] { flex: 1 1 160px; max-width: 260px; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }

.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
table.items { width: 100%; border-collapse: collapse; }
table.items th, table.items td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.items thead th { position: sticky; top: 0; background: #f8fafc; font-size: 12px; color: #374151; white-space: nowrap; z-index: 1; }
table.items tbody tr { cursor: pointer; }
table.items tbody tr:hover { background: #f8fafc; }
table.items tbody tr.selected { background: var(--pri-soft); box-shadow: inset 3px 0 0 var(--pri-2); }
table.items tbody tr.warn td.c-ev { background: var(--warn-bg); }
.c-no { white-space: nowrap; font-weight: 600; }
.c-major { white-space: nowrap; }
.c-minor { min-width: 120px; }
.c-exp { min-width: 200px; color: #374151; }
.c-res, .c-date, .c-asg { white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.thumbs { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; min-width: 120px; }
.thumb { width: 56px; height: 40px; object-fit: cover; border: 1px solid var(--line); border-radius: 4px; background: #f3f4f6; cursor: zoom-in; }
.more { font-size: 12px; color: var(--muted); }
.warn-ic { color: #c2410c; font-size: 12px; font-weight: 700; white-space: nowrap; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

.badge { display: inline-block; min-width: 3.4em; text-align: center; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; }
.b-ok { background: var(--ok); } .b-ng { background: var(--ng); } .b-hold { background: var(--hold); } .b-todo { background: #9ca3af; }
.b-na { background: #fff; color: var(--na); border: 1px dashed var(--na); padding: 0 7px; }
.badge-btn { border: 0; background: none; padding: 2px; cursor: pointer; border-radius: 999px; }
.badge-btn:hover .badge { filter: brightness(1.1); box-shadow: 0 0 0 2px rgba(37,99,235,.3); }
.quick-pop { position: absolute; z-index: 60; display: flex; gap: 4px; background: #fff; padding: 6px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.quick-pop button { border: 0; background: none; padding: 4px; cursor: pointer; border-radius: 8px; }
.quick-pop button:hover, .quick-pop button.cur { background: #f3f4f6; }

/* ---- 詳細パネル ---- */
.backdrop { display: none; }
.detail {
  position: fixed; right: 0; top: 50px; bottom: 0; width: var(--detail-w); z-index: 40;
  background: #fff; border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(0,0,0,.08);
  display: flex; flex-direction: column;
}
.detail.dragging::after {
  content: "ここにドロップしてエビデンスを追加"; position: absolute; inset: 8px; border: 3px dashed var(--pri-2); border-radius: 12px;
  background: rgba(238,242,255,.92); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--pri); z-index: 5; pointer-events: none;
}
.detail-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); padding-top: max(10px, env(safe-area-inset-top)); }
.detail-title strong { font-size: 17px; margin-right: 8px; }
.detail-nav { display: flex; gap: 2px; }
.detail-body { flex: 1; overflow: auto; padding: 14px 16px 24px; overscroll-behavior: contain; }
.result-seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.seg-btn { padding: 10px 4px; border: 2px solid var(--line2); background: #fff; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 15px; }
.seg-btn.r-ok { color: var(--ok); } .seg-btn.r-ng { color: var(--ng); } .seg-btn.r-hold { color: var(--hold); } .seg-btn.r-todo { color: var(--todo); }
.seg-btn.on.r-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.seg-btn.on.r-ng { background: var(--ng); border-color: var(--ng); color: #fff; }
.seg-btn.on.r-hold { background: var(--hold); border-color: var(--hold); color: #fff; }
.seg-btn.on.r-todo { background: var(--todo); border-color: var(--todo); color: #fff; }
.seg-btn.r-na { color: var(--na); border-style: dashed; }
.seg-btn.on.r-na { background: var(--na); border-color: var(--na); color: #fff; }
.na-box { border: 1px dashed var(--na); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; background: #f8fafc; display: flex; flex-direction: column; gap: 8px; }
.na-head { font-weight: 700; font-size: 13px; }
.req { font-size: 11px; color: #fff; background: #c2410c; border-radius: 4px; padding: 0 5px; margin-left: 4px; font-weight: 400; }
.na-reasons { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.na-text { font-size: 12px; color: var(--na); margin-top: 2px; }
.snip-btn { border: 0; background: none; cursor: pointer; font-size: 13px; padding: 0 4px; margin-left: 4px; border-radius: 4px; }
.snip-btn:hover { background: var(--pri-soft); }
.drop-note { margin-top: 6px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 3px; grid-column: 1 / -1; min-width: 0; }
.field.half { grid-column: auto; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field textarea, .field select { width: 100%; padding: 7px 9px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; }
.field textarea { resize: vertical; min-height: 40px; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--pri-2); outline: 2px solid rgba(37,99,235,.15); }
.date-row { display: flex; gap: 6px; }
.date-row input { flex: 1; min-width: 0; }

.ev-section { margin: 4px 0 18px; }
.ev-section h3 { font-size: 14px; margin: 0 0 8px; }
.drop { border: 2px dashed var(--line2); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); background: #fafafa; }
.drop:focus { border-color: var(--pri-2); }
.drop-msg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; font-size: 13px; }
.only-touch { display: none; }
@media (pointer: coarse) { .only-touch { display: inline-flex; } }
.ev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.ev { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; position: relative; }
.ev img { display: block; width: 100%; height: 100px; object-fit: contain; background: #f3f4f6; cursor: zoom-in; }
.ev figcaption { font-size: 11px; color: var(--muted); padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-tools { display: flex; border-top: 1px solid var(--line); }
.ev-tools button { flex: 1; border: 0; background: none; padding: 4px; cursor: pointer; font-size: 12px; }
.ev-tools button:hover:not(:disabled) { background: #f3f4f6; }
.ev-tools button:disabled { opacity: .3; }
.ev-tools .del:hover { background: #fef2f2; }
.detail-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---- ライトボックス ---- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(10,10,15,.92); display: flex; align-items: center; justify-content: center; }
.lb-top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; color: #fff; font-size: 13px; padding-top: max(10px, env(safe-area-inset-top)); }
.lb-close, .lb-nav { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 50%; width: 46px; height: 46px; font-size: 26px; cursor: pointer; }
.lb-close { font-size: 18px; width: 40px; height: 40px; }
.lb-nav { position: fixed; top: 50%; transform: translateY(-50%); }
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb-stage { max-width: 100vw; max-height: 100vh; overflow: auto; display: flex; align-items: center; justify-content: center; }
#lbImg { max-width: 92vw; max-height: 86vh; object-fit: contain; background: #fff; cursor: zoom-in; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
#lbImg.zoom { max-width: none; max-height: none; cursor: zoom-out; }
#lbVideo { max-width: 92vw; max-height: 84vh; background: #000; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.lb-link { background: #fff; border-radius: 14px; padding: 28px; max-width: min(520px, 90vw); text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.lb-link-ic { font-size: 40px; }
.lb-link-title { font-weight: 700; font-size: 16px; }
.lb-link-url { font-size: 12px; color: var(--muted); word-break: break-all; }
.lightbox:has(#lbImg.zoom) .lb-stage { width: 100vw; height: 100vh; align-items: flex-start; justify-content: flex-start; }

/* ---- モーダル ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-wide { max-width: 980px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-body p { margin: 0 0 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.chk-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* 取り込み */
.import-top { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.import-top .field { grid-column: auto; }
h3.sub { font-size: 14px; margin: 16px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 16px; }
.map-row { display: grid; grid-template-columns: 5.5em 1fr; align-items: center; gap: 8px; }
.map-row span { font-weight: 600; font-size: 13px; }
.map-row select { padding: 5px 6px; border: 1px solid var(--line2); border-radius: 6px; min-width: 0; width: 100%; background: #fff; }
.import-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 13px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
table.preview { width: 100%; border-collapse: collapse; font-size: 12px; }
table.preview th, table.preview td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; }
table.preview th { background: #f8fafc; white-space: nowrap; }

/* ---- トースト / 処理中 ---- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 200;
  background: #111827; color: #fff; padding: 10px 18px; border-radius: 10px; transition: .2s; max-width: calc(100vw - 32px); box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: #166534; } .toast.error { background: #991b1b; }
.busy { position: fixed; inset: 0; z-index: 150; background: rgba(255,255,255,.6); display: flex; align-items: center; justify-content: center; }
.busy-box { background: #fff; padding: 20px 28px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); display: flex; align-items: center; gap: 14px; }
.spinner { width: 24px; height: 24px; border: 3px solid #dbeafe; border-top-color: var(--pri-2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== レスポンシブ ===== */
@media (max-width: 1100px) {
  :root { --detail-w: min(520px, 100vw); }
  body.detail-open main { margin-right: 0; }
  .detail { top: 0; z-index: 47; }
  .backdrop { z-index: 46; }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.35); }
}

@media (max-width: 760px) {
  .hide-sm { display: none; }
  .brand-text { display: none; }
  .topbar { padding-left: 10px; padding-right: 10px; gap: 8px; }
  .tabs { top: 48px; padding: 0 8px; }
  .tab { flex: 1; }
  main { padding: 10px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 8px 10px; }
  .stat-val { font-size: 24px; }
  .grid2 { grid-template-columns: 1fr; }
  .dash-head h1 { font-size: 18px; }
  .filters select { flex: 1 1 30%; max-width: none; }
  .filters input[type=search] { max-width: none; flex-basis: 100%; }
  .toolbar-right { width: 100%; justify-content: space-between; }

  /* 表 → カード */
  .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  table.items, table.items tbody { display: block; }
  table.items thead { display: none; }
  table.items tbody tr {
    display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: center;
    background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow);
  }
  table.items td { display: block; padding: 0; border: 0; min-width: 0; }
  table.items td.c-no { grid-column: 1; }
  table.items td.c-major { grid-column: 2; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
  table.items td.c-res { grid-column: 3; grid-row: 1; }
  table.items td.c-minor { grid-column: 1 / -1; font-weight: 600; }
  table.items td.c-exp { grid-column: 1 / -1; font-size: 12px; min-width: 0; }
  table.items td.c-asg, table.items td.c-date { grid-column: auto; font-size: 12px; color: var(--muted); }
  table.items td.c-asg:empty, table.items td.c-date:empty { display: none; }
  table.items td.c-ev { grid-column: 1 / -1; }
  table.items tbody tr.warn td.c-ev { background: none; }
  .thumbs { min-width: 0; }

  .form-grid { grid-template-columns: 1fr; }
  .field.half { grid-column: 1 / -1; }
  .import-top { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 14px 14px 0 0; }
  .ev-grid { grid-template-columns: repeat(2, 1fr); }
  .lb-nav { width: 40px; height: 40px; font-size: 22px; }
}

/* ===== 表形式エディタ（PC） ===== */
body.view-list main { max-width: none; }
.only-mobile { display: none; }
.grid-tools { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 8px; }
.grid-tools .tool-group { display: flex; gap: 4px; }
.seg { display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: #fff; }
.seg-label { font-size: 12px; color: var(--muted); padding: 0 6px 0 10px; }
.seg button { border: 0; border-left: 1px solid var(--line2); background: #fff; padding: 4px 12px; cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--pri-2); color: #fff; }
.grid-host { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.g-wrap { position: relative; overflow: auto; height: 60vh; outline: none; }
.g-inner { position: relative; width: max-content; min-width: 100%; }
table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; user-select: none; -webkit-user-select: none; }
table.grid th, table.grid td { border-right: 1px solid #e8eaee; border-bottom: 1px solid #e8eaee; padding: 4px 6px; vertical-align: top; text-align: left; background: #fff; overflow: hidden; }
table.grid thead th { position: sticky; top: 0; z-index: 3; background: #f3f5f8; font-size: 12px; color: #374151; font-weight: 600; white-space: nowrap; height: 30px; }
table.grid thead th.csel { background: #dbe4ff; }
table.grid .g-rh { position: sticky; left: 0; z-index: 2; background: #f3f5f8; color: var(--muted); font-size: 11px; text-align: center; font-weight: 400; cursor: grab; }
table.grid thead .g-rh { z-index: 4; cursor: pointer; }
table.grid tr.rsel .g-rh { background: #dbe4ff; color: var(--pri); font-weight: 700; }
table.grid td.g-stick { position: sticky; z-index: 1; font-weight: 600; }
table.grid thead th.g-stick { z-index: 4; }
table.grid td.sel { background: #eaf0ff; }
table.grid td.act { box-shadow: inset 0 0 0 2px var(--pri-2); }
.g-wrap:not(.focused) table.grid td.act { box-shadow: inset 0 0 0 2px #93a4c8; }
table.grid td.g-warn { background: var(--warn-bg); }
table.grid td.g-warn.sel { background: #fde9d4; }
.g-v { white-space: pre-wrap; word-break: break-word; max-height: 6.2em; overflow: hidden; line-height: 1.55; min-height: 1.55em; }
.g-na { font-size: 11px; color: var(--na); margin-top: 2px; line-height: 1.4; }
.g-thumbs { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; }
.g-thumbs img { width: 40px; height: 30px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; cursor: zoom-in; background: #f3f4f6; }
.g-rs { position: absolute; right: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 5; }
table.grid thead th { position: sticky; }
table.grid thead th > .g-rs { position: absolute; }
table.grid tr.drop-before td, table.grid tr.drop-before th { box-shadow: inset 0 3px 0 var(--pri-2); }
table.grid tr.drop-after td, table.grid tr.drop-after th { box-shadow: inset 0 -3px 0 var(--pri-2); }
table.grid tr.file-drop td { background: #e0f2fe; }
.row-dragging, .row-dragging * { cursor: grabbing !important; }
.g-editor {
  position: absolute; z-index: 6; margin: 0; padding: 4px 6px; border: 2px solid var(--pri-2); border-radius: 0;
  font: 13px/1.55 var(--font); resize: none; background: #fff; opacity: 0; pointer-events: none; overflow: hidden; outline: none;
}
.g-editor.on { opacity: 1; pointer-events: auto; box-shadow: 0 6px 20px rgba(0,0,0,.18); overflow: auto; }
.g-sugg { position: absolute; z-index: 7; background: #fff; border: 1px solid var(--line2); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 260px; overflow: auto; max-width: 520px; padding: 4px; }
.g-sg { padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; white-space: pre-wrap; word-break: break-word; border-bottom: 1px dashed #f0f0f0; }
.g-sg:hover, .g-sg.on { background: var(--pri-soft); }
.g-sg.snip { color: var(--pri); font-weight: 600; }
.g-sg-empty { padding: 8px; color: var(--muted); font-size: 12px; }
.g-empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.g-status { display: flex; gap: 16px; align-items: center; padding: 5px 10px; border-top: 1px solid var(--line); background: #f8fafc; font-size: 12px; color: var(--muted); min-height: 28px; }
.g-pos { font-weight: 600; color: var(--fg); white-space: nowrap; }
.g-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-menu { position: absolute; width: 250px; z-index: 70; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ctx-menu small { color: var(--muted); float: right; }
kbd { border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-size: 12px; background: #fff; }
.kbd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kbd-table th, .kbd-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.kbd-table th { white-space: nowrap; width: 15em; }

/* 共通手順 */
.snip-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.snip-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 8px; align-items: start; }
.snip-row input, .snip-row textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--line2); border-radius: 8px; }
.snip-q { width: 100%; padding: 6px 8px; border: 1px solid var(--line2); border-radius: 8px; margin-bottom: 8px; }
.snip-pick { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; }
.snip-cand { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.snip-cand:hover { border-color: var(--pri-2); background: var(--pri-soft); }
.snip-g { font-size: 11px; color: var(--muted); }
.snip-cand .pre { font-size: 12px; color: #374151; }
.chk.opt { align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px; white-space: normal; }
.chk.opt input { margin-top: 4px; }

@media (pointer: coarse) { .hide-touch { display: none; } }
@media (max-width: 760px) {
  .only-mobile { display: inline-flex; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .result-seg { grid-template-columns: repeat(3, 1fr); }
  .snip-row { grid-template-columns: 1fr; }
}

/* ===== 取り込み後の「要確認」・AI 雛形 ===== */
:root { --ai-bg: #f3e8ff; --ai-line: #c4b5fd; --ai-fg: #6d28d9; }
table.grid td.g-ai { background: var(--ai-bg); }
table.grid td.g-ai.sel { background: #e4d4fd; }
table.grid tr.ai-row .g-rh { box-shadow: inset 3px 0 0 #8b5cf6; color: var(--ai-fg); }
.alert-ai { background: #faf5ff; border-color: var(--ai-line); color: #5b21b6; }
.ai-tag { font-size: 10px; background: var(--ai-bg); color: var(--ai-fg); border: 1px solid var(--ai-line); border-radius: 4px; padding: 0 4px; font-weight: 600; vertical-align: 1px; }
.field.ai input, .field.ai textarea { background: var(--ai-bg); border-color: var(--ai-line); }
.field.ai > span::after { content: " 要確認"; color: var(--ai-fg); font-weight: 400; }
.btn-ai { border-color: var(--ai-line); color: var(--ai-fg); background: #faf5ff; }
.btn-ai:hover { background: var(--ai-bg); }
.ti-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ti-aspects { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; margin: 8px 0; }
.ti-count { max-width: 200px; }
.ti-copy { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 10px 0 6px; }
.ti-prompt textarea, #tiPaste { width: 100%; font: 12px/1.5 ui-monospace, Consolas, monospace; padding: 8px; border: 1px solid var(--line2); border-radius: 8px; }
.ti-prompt summary { cursor: pointer; color: var(--muted); margin-bottom: 6px; }
#tiPreview { margin-top: 10px; }
@media (max-width: 760px) { .ti-mode { grid-template-columns: 1fr; } }
