/* 写真報告書デモ。色と部品は equip（備品貸出デモ）にそろえている */
:root {
  --navy: #173458; --navy-900: #0d2138; --accent: #e2612e; --ink: #15212e; --ink-soft: #465569;
  --line: #e2e6ec; --paper: #fff; --paper-2: #f4f6f9; --paper-3: #eef1f6;
  --warn: #b7791f; --warn-bg: #fdf8ec; --danger: #c2362b; --ok: #1b7f4b; --radius: 4px; --maxw: 1180px;
  --body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--body); color: var(--ink); background: var(--paper-2); font-size: 14px; line-height: 1.7; }
[x-cloak] { display: none !important; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.grow { flex: 1; }

header.head { background: var(--navy-900); color: #fff; padding: 20px 0; }
header.head .wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
header.head h1 { margin: 0; font-size: 20px; }
header.head .lead { margin: 4px 0 0; font-size: 12.5px; color: rgba(255,255,255,.72); }
.back { border: 1px solid rgba(255,255,255,.45); color: #fff; text-decoration: none; border-radius: var(--radius);
        padding: 8px 14px; font-size: 12.5px; white-space: nowrap; }
.back:hover { background: rgba(255,255,255,.12); }

main { padding: 20px 0 48px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.step { padding: 16px 18px; margin-bottom: 16px; }
.step-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.step-head h2 { margin: 0; font-size: 16px; }
.step-head .no { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700;
                 display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.badge { background: var(--paper-3); border-radius: 999px; padding: 1px 10px; font-size: 12px; color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 12.5px; margin: 6px 0 0; }
.note { font-size: 12px; color: var(--ink-soft); }
.err { color: var(--danger); font-size: 13px; }

.btn { border: 0; border-radius: var(--radius); padding: 10px 18px; font-family: inherit; font-size: 14px; font-weight: 700;
       cursor: pointer; text-decoration: none; display: inline-block; text-align: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }
.btn.big { padding: 14px 28px; font-size: 16px; }
.btn-go { background: var(--accent); color: #fff; }
.btn-go:hover:not(:disabled) { background: #c9501f; }
.btn-sub { background: var(--paper-3); color: var(--ink); border: 1px solid var(--line); }
.btn-sub:hover:not(:disabled) { background: #e3e8f0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn.armed { background: var(--accent); color: #fff; border-color: var(--accent); }
.icon { border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius); width: 32px; height: 32px;
        cursor: pointer; font-size: 14px; color: var(--ink-soft); flex: none; }
.icon:disabled { opacity: .35; cursor: not-allowed; }

/* ひな形（報告書の見本の画像つきカード） */
.tpl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tpl-card { display: flex; flex-direction: column; gap: 4px; text-align: left; border: 2px solid var(--line); background: var(--paper);
            border-radius: 6px; padding: 8px 8px 10px; font-family: inherit; color: var(--ink); cursor: pointer; }
.tpl-card:hover { border-color: #b9c3d1; }
.tpl-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(226,97,46,.15); }
.tpl-img { display: block; aspect-ratio: 800 / 520; background: var(--paper-3); border-radius: 4px; overflow: hidden; }
.tpl-img img { width: 100%; height: 100%; display: block; }
.tpl-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.tpl-check { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px;
             display: inline-flex; align-items: center; justify-content: center; }
.tpl-desc { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; }

/* 写真 */
.sample-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 2px dashed #b9c3d1;
        border-radius: 6px; padding: 22px 12px; text-align: center; cursor: pointer; background: var(--paper-2); color: var(--ink-soft); }
.drop b { color: var(--ink); font-size: 15px; }
.drop span { font-size: 12.5px; }
.drop.over { border-color: var(--accent); background: #fff4ee; }
.drop input { display: none; }
.split { margin: 10px 0 0; font-size: 13px; background: var(--paper-3); padding: 6px 10px; border-radius: var(--radius); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.ph { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.ph.err { border-color: var(--danger); }
.ph-img { aspect-ratio: 4 / 3; background: var(--paper-3); display: flex; align-items: center; justify-content: center; }
.ph-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-state { font-size: 12px; color: var(--ink-soft); padding: 6px; text-align: center; }
.ph.err .ph-state { color: var(--danger); }
.ph figcaption { display: flex; align-items: center; gap: 6px; padding: 5px 6px; font-size: 12px; }
.ph .t { color: var(--ink-soft); white-space: nowrap; }
.side { border: 0; border-radius: 3px; padding: 1px 7px; font-family: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.side.before { background: #e8eef7; color: var(--navy); }
.side.after { background: #fdeee6; color: #a3431b; }
.geo { white-space: nowrap; font-size: 10.5px; color: var(--ok); border: 1px solid #b9dcc8; border-radius: 3px; padding: 0 4px; }
.ph { position: relative; }
.ph .x { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
         background: rgba(255,255,255,.92); color: var(--ink); font-size: 16px; line-height: 26px; padding: 0; box-shadow: 0 1px 3px rgba(0,0,0,.25); }

/* 組と図 */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; align-items: start; }
.sticky { position: sticky; top: 12px; }
.item { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-top: 12px; }
.item.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(226,97,46,.18); }
.item-head { display: flex; align-items: center; gap: 8px; }
.num, .pin-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; flex: none;
                 display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.pin-dot.off { background: #c3c9d3; }
.item-head .title { flex: 1; min-width: 0; }
input[type=text], input[type=number], input[type=date], select, textarea {
  font-family: inherit; font-size: 14px; border: 1px solid #cdd4de; border-radius: var(--radius); padding: 7px 9px; background: #fff; color: var(--ink); width: 100%; }
textarea { resize: vertical; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; position: relative; }
.slot-img { aspect-ratio: 4 / 3; background: var(--paper-3); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.slot-img img { width: 100%; height: 100%; object-fit: cover; }
.slot-img .empty { font-size: 12px; color: var(--ink-soft); }
.slot select { font-size: 12.5px; padding: 5px 6px; }
.swap { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%;
        border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 15px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--ink-soft); }
.field.wide { grid-column: 1 / -1; }
.pinrow { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft); }

.diagram { position: relative; cursor: default; user-select: none; }
.diagram svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: var(--radius); }
.diagram.armed, .map.armed { cursor: crosshair; outline: 3px solid rgba(226,97,46,.45); outline-offset: 2px; border-radius: var(--radius); }
.diagram.car svg { max-width: 360px; margin: 0 auto; }
.dpin { position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
        color: #fff; border: 2px solid #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center;
        box-shadow: 0 1px 3px rgba(0,0,0,.35); pointer-events: none; }
.diagram.car .dpin { margin-left: 0; }
.map { height: 360px; border: 1px solid var(--line); border-radius: var(--radius); }
.mpin span { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid #fff; font-weight: 700;
             display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.4); font-size: 14px; }

.download { text-align: center; }
.download .step-head { justify-content: center; }

/* ダイアログ */
.modal { position: fixed; inset: 0; background: rgba(13,33,56,.55); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.modal-box { background: #fff; border-radius: 6px; padding: 20px; width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; }
.modal-box.wide { max-width: 760px; }
.modal-box p { margin: 0 0 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.ed-group { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
.ed-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ed-row { display: grid; grid-template-columns: 1fr 150px 32px; gap: 6px; margin-bottom: 8px; align-items: start; }
.ed-row textarea { grid-column: 1 / 3; font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--navy-900); color: #fff; padding: 10px 18px;
         border-radius: 6px; font-size: 13.5px; z-index: 3000; max-width: calc(100% - 32px); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.toast.warn { background: #7a4a0a; }

@media (max-width: 999px) {
  .cols { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  /* 3枚を縦に積むと長くなるので、横に送る */
  .tpl-cards { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 78%; overflow-x: auto;
               scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .tpl-card { scroll-snap-align: start; }
  .step { padding: 14px 12px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .ed-row { grid-template-columns: 1fr 32px; }
  .ed-row select { grid-column: 1 / 2; }
  .ed-row textarea { grid-column: 1 / -1; }
  .btn.big { width: 100%; }
}
