/* MST PROPERTY MANAGER: 業務用に「見やすい・間違えにくい」ことを優先したシンプルなスタイル */
:root {
  --accent: #b3122e; --accent-dark: #8d0e24; --ink: #1f2328; --muted: #6a7078; --line: #d9dce1;
  --bg: #f4f5f7; --card: #fff; --ok: #1d6b2c; --ok-bg: #e3f3e6; --warn: #8a5a00; --warn-bg: #fff3d9;
  --err: #a31818; --err-bg: #fde6e6; --info: #1d4f91; --info-bg: #eaf2fc;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.6; font-size: 15px; }
a { color: var(--info); }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 17px; margin: 0 0 12px; padding-left: 10px; border-left: 4px solid var(--accent); }
h2 small { font-weight: normal; color: var(--muted); font-size: 13px; }
h3 { font-size: 15px; }
main { max-width: 1280px; margin: 0 auto; padding: 16px 16px 120px; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--ink); color: #fff; padding: 10px 16px; }
.topbar a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; letter-spacing: .04em; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 14px; }
.who { color: #c9ced6; }
.devbanner { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: 13px; padding: 4px 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 0 0 16px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.inline { display: inline; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0; }
.req { color: #fff; background: var(--accent); font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-left: 4px; font-weight: normal; }

.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 16px;
  border-radius: 8px; font-size: 15px; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { border-color: #9aa1aa; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--err); border-color: #e7b2b2; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.wide { width: 100%; padding: 14px; font-size: 17px; margin-top: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
button.link { background: none; border: none; color: #fff; cursor: pointer; font-size: 14px; padding: 0; text-decoration: underline; }

input[type=text], input[type=url], input[type=password], input[type=month], input:not([type]), select, textarea {
  width: 100%; font-size: 16px; padding: 8px 10px; border: 1px solid #b9bec6; border-radius: 6px; background: #fff; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 3px solid #b9cfee; border-color: var(--info); }
label.stack { display: block; margin-bottom: 12px; font-weight: 600; }
label.stack input { margin-top: 4px; font-weight: normal; }

.alert { border-radius: 8px; padding: 10px 14px; margin: 0 0 12px; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #f0d9a6; }
.alert.error { background: var(--err-bg); color: var(--err); border-color: #f0b9b9; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }
.alert .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #eceef1; color: var(--muted); font-weight: normal; vertical-align: middle; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.review { background: var(--warn-bg); color: var(--warn); }
.badge.parsed { background: var(--info-bg); color: var(--info); }
.badge.image_failed { background: var(--err-bg); color: var(--err); }
.owner-badge { display: inline-block; font-weight: 700; padding: 2px 10px; border-radius: 6px; border: 2px solid var(--info); color: var(--info); }
.owner-badge.daito { border-color: var(--accent); color: var(--accent); }
.mark { font-size: 10px; background: var(--info-bg); color: var(--info); padding: 0 4px; border-radius: 3px; }

/* ---- トップ画面 */
fieldset { border: none; padding: 0; margin: 0 0 18px; }
legend { font-weight: 700; margin-bottom: 8px; font-size: 16px; }
.step { display: inline-block; width: 24px; height: 24px; line-height: 24px; text-align: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; margin-right: 4px; }
.owner-choice { display: flex; flex-wrap: wrap; gap: 10px; }
.owner-choice legend { width: 100%; }
.owner-option { flex: 1 1 180px; display: flex; align-items: center; gap: 10px; border: 2px solid var(--line); border-radius: 10px; padding: 14px 16px; cursor: pointer; font-size: 17px; font-weight: 700; }
.owner-option:has(input:checked) { border-color: var(--accent); background: #fff5f6; }
.owner-option input { width: 20px; height: 20px; }
.owner-choice .hint { width: 100%; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 150px;
  border: 3px dashed #b9bec6; border-radius: 12px; background: #fafbfc; cursor: pointer; padding: 16px; text-align: center; }
.dropzone.small { min-height: 90px; margin-top: 12px; }
.dropzone.over, .dropzone.has-file { border-color: var(--accent); background: #fff5f6; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dz-main { font-weight: 700; font-size: 16px; }
.dz-sub { color: var(--muted); font-size: 13px; }
.dz-file { color: var(--accent); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px; text-align: center; }
.stat .num { display: block; font-size: 26px; font-weight: 700; }
.stat.muted { color: var(--muted); }
.rows { list-style: none; padding: 0; margin: 0; }
.rows li a { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }

/* ---- 一覧 */
.table-wrap { overflow-x: auto; }
table.list, table.kv { border-collapse: collapse; width: 100%; }
table.list th, table.list td, table.kv th, table.kv td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
table.kv th { width: 11em; background: #fafbfc; font-weight: 600; }

/* ---- 確認画面 */
.page-head .meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.detail-side { position: sticky; top: 12px; }
.pdf-view img { width: 100%; border: 1px solid var(--line); display: block; margin-top: 8px; }
.pdf-view summary { font-weight: 700; cursor: pointer; }
.field { padding: 10px 0; border-bottom: 1px dashed #eceef1; }
.field:last-child { border-bottom: none; }
.field .label { display: block; font-weight: 600; margin-bottom: 4px; }
.field.review { background: #fffaf0; margin: 0 -10px; padding: 10px; border-radius: 6px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border: 2px solid var(--err); background: var(--err-bg); }
.control { display: flex; align-items: center; gap: 8px; }
.control input.num { max-width: 220px; text-align: right; }
.unit { color: var(--muted); white-space: nowrap; }
.raw { color: var(--muted); font-size: 12px; margin: 4px 0 0; word-break: break-all; }
.note { color: var(--warn); font-size: 12px; margin: 2px 0 0; }
.err { color: var(--err); font-weight: 700; font-size: 13px; margin: 4px 0 0; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { width: 18px; height: 18px; }
.check.big { font-size: 16px; font-weight: 600; margin: 4px 0 12px; }
.check.small { font-size: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.pet-card { border: 2px solid var(--accent); }
.pet-summary { font-size: 18px; font-weight: 700; color: var(--accent); margin: 0 0 8px; }
.rulebox { background: var(--info-bg); border: 1px solid #b9cfee; color: var(--info); padding: 8px 12px; border-radius: 6px; }
.evidence { background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin-bottom: 8px; }
.evidence summary { cursor: pointer; font-weight: 600; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.photo-grid.mini { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); margin-top: 8px; }
.photo { margin: 0; border: 3px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.photo.main { border-color: var(--accent); }
.photo.off { opacity: .55; }
.photo.overflow { border-style: dashed; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #eceef1; }
.photo .handle { background: #f1f2f4; padding: 4px 8px; cursor: grab; font-size: 13px; user-select: none; touch-action: none; }
.photo.main .handle { background: var(--accent); color: #fff; font-weight: 700; }
.photo figcaption { padding: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.photo figcaption select { font-size: 14px; padding: 4px 6px; }
.photo .src { color: var(--muted); font-size: 12px; }
.photo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sortable-ghost { opacity: .3; }
.hidden-photos { margin-top: 16px; }
.hidden-photos summary { cursor: pointer; color: var(--muted); }

.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; z-index: 10;
  box-shadow: 0 -2px 8px rgba(0,0,0,.06); }
.busy { position: fixed; inset: 0; background: rgba(255,255,255,.75); display: flex; align-items: center; justify-content: center; z-index: 20; }
.busy[hidden] { display: none; }
.busy-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 20px 28px; text-align: center; font-weight: 700; box-shadow: 0 4px 20px rgba(0,0,0,.1); }

@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
  .detail-side { position: static; order: -1; }
  .pdf-view:not([open]) img { display: none; }
}
@media (max-width: 480px) {
  main { padding: 12px 12px 150px; }
  .card { padding: 14px; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .savebar .btn { flex: 1 1 30%; padding: 10px 6px; font-size: 14px; }
  .savebar .btn:disabled { display: none; }
  .control input.num { max-width: none; }
}

.btn.primary-outline { border: 2px solid var(--accent); color: var(--accent); font-weight: 700; }
.done-card { border: 2px solid var(--ok); }
.done-title { font-size: 22px; font-weight: 700; margin: 0; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.status { font-weight: 700; white-space: nowrap; }
.status.published { color: var(--ok); } .status.draft { color: var(--warn); } .status.ended { color: var(--muted); }
.badge.registered, .badge.applied { background: var(--ok-bg); color: var(--ok); }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
table.diff td.old { color: var(--muted); text-decoration: line-through; }
table.diff td.new { background: #f3fbf4; }
tr.muted-row td, tr.muted-row th { background: #fafafa; }
tr.price-row td { background: #fffaf0; }
.dup ul { list-style: none; padding: 0; }
.dup li { padding: 6px 0; border-top: 1px dashed #f0d9a6; }
.lowres { color: var(--err); font-size: 12px; font-weight: 700; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: var(--ink); font-size: 14px; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
td.ops { white-space: nowrap; }
.end-card { border: 2px solid var(--err); }
fieldset.has-error { border-left: 3px solid var(--err); padding-left: 8px; }
table.batch td { font-size: 14px; }
table.batch td.pet { max-width: 260px; }
tr.ng-row td { background: #fff7f7; }
tr.done-row td { background: #f3fbf4; }
code.pw { font-size: 20px; background: #fff; padding: 2px 10px; border: 1px solid var(--line); border-radius: 6px; letter-spacing: .05em; user-select: all; }
.badge.auto { background: #efe8fb; color: #5b2a9a; }
.badge.rule { background: var(--info); color: #fff; }
.note.manual { color: var(--info); }
ul.spots { list-style: none; padding: 0; margin: 0 0 8px; }
ul.spots li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #eceef1; }
ul.spots li.on b { color: var(--ok); }
.spot-ops { margin-left: auto; display: inline-flex; gap: 4px; }
.manual-add { margin: 12px 0; }
ul.links { margin: 4px 0 8px; }
