/* ---------- CarePhoto 独自の部品（共通の style.css の後に読み込む） ---------- */
.series { display: block; font-size: .72rem; color: var(--theme-dark); }
.series-foot { font-size: .8rem; color: var(--muted); text-align: center; margin: 4px 0 8px; }
.series-foot a { color: var(--theme-dark); }
.tabs { grid-template-columns: 1fr 1fr 1fr; }
.tab { font-size: 1rem; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.panel { max-width: 1440px; margin: 0 auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 12px; }
.row-buttons .btn-big { font-size: 1.05rem; padding: 6px 8px; }
.count-line { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 8px; }
.count-badge { font-weight: 700; color: var(--theme-dark); }
.empty-card { text-align: center; color: var(--muted); padding: 28px 14px; border: 2px dashed var(--line); border-radius: var(--radius); background: #fff; }
.empty-card .btn { margin-top: 10px; }

/* 写真の一覧 */
.photo-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 760px) { .photo-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1180px) { .photo-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.photo-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.photo-top { display: flex; gap: 10px; align-items: flex-start; }
.photo-thumb { width: 120px; height: 90px; object-fit: contain; background: #eef0f3; border-radius: 8px; flex: none; border: 1px solid var(--line); }
.photo-meta { flex: 1; min-width: 0; }
.photo-no { display: inline-block; background: var(--theme); color: #fff; border-radius: 6px; padding: 0 8px; font-weight: 700; font-size: .9rem; }
.photo-sub { font-size: .8rem; color: var(--muted); }
.photo-card .field { margin: 4px 0; }
.photo-card .field > .label { margin-bottom: 2px; font-size: .9rem; }
.photo-card textarea { min-height: 72px; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mini-grid .btn { min-height: 46px; padding: 4px 6px; font-size: .88rem; }

/* 書き込み画面 */
.edit-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "strip" "stage" "side"; }
.edit-strip { grid-area: strip; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; -webkit-overflow-scrolling: touch; }
.strip-item { flex: none; border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 3px; cursor: pointer; position: relative; min-height: 48px; }
.strip-item img { display: block; width: 76px; height: 57px; object-fit: contain; background: #eef0f3; border-radius: 6px; }
.strip-item span { position: absolute; left: 4px; top: 4px; background: var(--theme); color: #fff; font-size: .72rem; border-radius: 4px; padding: 0 5px; font-weight: 700; }
.strip-item[aria-current="true"] { border-color: var(--theme); box-shadow: 0 0 0 2px var(--theme); }
.strip-item:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.edit-stage { grid-area: stage; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-width: 0; }
.stage-nav { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.stage-title { text-align: center; font-weight: 700; overflow-wrap: anywhere; line-height: 1.3; }
.stage-wrap { display: flex; align-items: center; justify-content: center; background: #e9ebef; border-radius: 10px; min-height: 240px; height: 50vh; overflow: hidden; }
.stage-wrap canvas { display: block; touch-action: manipulation; cursor: pointer; }
.stage-wrap.drag-mode { outline: 2px dashed var(--theme); outline-offset: -2px; }
.stage-wrap.drag-mode canvas { touch-action: none; cursor: grab; }
.stage-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; margin-top: 6px; }
.edit-side { grid-area: side; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tool-grid .btn { flex-direction: column; min-height: 62px; padding: 4px 2px; font-size: .86rem; gap: 0; }
.tool-grid .btn .ic { font-size: 1.25rem; line-height: 1.2; }
.style-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.style-row .label { font-size: .85rem; font-weight: 700; color: var(--theme-dark); flex-basis: 100%; }
.swatch-btn { min-width: 60px; min-height: 48px; border-radius: 10px; border: 2px solid var(--line); background: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; font-weight: 700; font-size: .9rem; color: var(--text); }
.swatch-btn .dot { width: 20px; height: 20px; border-radius: 50%; border: 1px solid #555; display: inline-block; }
.swatch-btn .bar { width: 22px; background: #333; border-radius: 3px; display: inline-block; }
.swatch-btn[aria-pressed="true"] { border-color: var(--theme); background: var(--theme-light); box-shadow: 0 0 0 1px var(--theme); }
.swatch-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sel-panel { border: 2px solid var(--theme); border-radius: 10px; padding: 8px 10px 10px; background: var(--theme-light); }
.sel-panel.is-empty { border: 1px dashed var(--line); background: #fff; }
.sel-hint { margin: 2px 0; font-size: .88rem; color: var(--muted); }
.sel-head { display: flex; align-items: center; gap: 8px; }
.sel-title { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.sel-row { margin-top: 8px; }
.sel-label { font-size: .82rem; font-weight: 700; color: var(--theme-dark); margin-bottom: 4px; }
.pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; }
.sel-panel .btn-small { min-height: 48px; padding: 4px 6px; font-size: .9rem; background: #fff; }
.sel-panel .btn-small:hover { background: var(--theme-light); }

@media (min-width: 960px) {
  .edit-layout { grid-template-columns: 120px minmax(0, 1fr) 360px; grid-template-areas: "strip stage side"; align-items: start; }
  .edit-strip { flex-direction: column; overflow-x: visible; overflow-y: auto; max-height: calc(100vh - 230px); position: sticky; top: 92px; }
  .strip-item img { width: 100px; height: 75px; }
  .edit-stage { position: sticky; top: 92px; }
  .stage-wrap { height: calc(100vh - 380px); min-height: 340px; }
}

/* 報告書 */
.report-layout { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .report-layout { grid-template-columns: 460px minmax(0, 1fr); align-items: start; }
  .preview-card { position: sticky; top: 92px; max-height: calc(100vh - 190px); overflow: auto; }
}
.report-form .field { margin: 12px 0; }
.preview-pages { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; }
.preview-pages img { width: 100%; max-width: 560px; height: auto; border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.08); background: #fff; }
.preview-cap { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }

/* 切り抜きの小窓 */
.crop-view { display: flex; justify-content: center; background: #e9ebef; border-radius: 10px; padding: 6px; }
.crop-view canvas { max-width: 100%; height: auto; display: block; }
.crop-pad { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.crop-pad .btn { min-height: 46px; font-size: .88rem; padding: 4px; }
.crop-pad .sel-label { grid-column: 1 / -1; margin: 4px 0 0; }

@media (max-width: 480px) {
  .tab { font-size: .92rem; min-height: 54px; }
  .photo-thumb { width: 96px; height: 72px; }
  .tool-grid .btn { font-size: .8rem; }
  .stage-wrap { height: 44vh; }
  .pad .btn-small, .sel-grid .btn-small { font-size: .84rem; }
  .swatch-btn { min-width: 54px; padding: 4px 8px; }
}
@media (max-width: 400px) {
  .brand { gap: 6px; }
  .brand-name { font-size: 1.08rem; }
  .brand-kana { font-size: .72rem; }
  #btn-help { padding: 4px 8px; }
}
@media print {
  #print-area img { page-break-after: always; break-after: page; }
  #print-area img:last-child { page-break-after: auto; break-after: auto; }
}
.choice-cols-1 { display: grid; grid-template-columns: 1fr; }
.tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.swatch-btn .dot-red { background: #d32f2f; }
.swatch-btn .dot-yellow { background: #fbc02d; }
.swatch-btn .dot-blue { background: #1565c0; }
.swatch-btn .dot-white { background: #ffffff; }
.swatch-btn .bar-s { height: 3px; }
.swatch-btn .bar-m { height: 6px; }
.swatch-btn .bar-l { height: 10px; }
.btn-edit { margin-top: 6px; }
/* スマホ：選んだ書き込みを動かすボタンを、写真のすぐ下に出す */
@media (max-width: 959px) {
  .edit-side .sel-panel { order: -1; }
  body.has-sel .stage-wrap { height: 34vh; min-height: 200px; }
}
