:root {
  --bg: #fffbf7;
  --surface: #ffffff;
  --text: #2f3a3a;
  --muted: #6f7b7b;
  --brand: #2d5b5b;
  --accent: #fed8d5;
  --line: #ece4dc;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --ok: #2e7d4f;
  --ok-bg: #e8f5ee;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif; font-size: 14px; line-height: 1.6;
}
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--brand); font-weight: 600; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
input[type=text], input[type=password], input[type=search] {
  font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text);
}
select { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
input:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; color: var(--brand); }
.login-card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-card label { display: block; font-size: 13px; margin: 14px 0 6px; }
.login-card button { width: 100%; margin-top: 22px; padding: 11px; }
.note { font-size: 12px; color: var(--muted); margin-top: 16px; }
.error { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 10px 12px; margin-top: 14px; font-size: 13px; }

/* app */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .brand { font-weight: 700; color: var(--brand); }
header.top .shop { color: var(--muted); font-size: 13px; }
main { max-width: 1080px; margin: 0 auto; padding: 16px; }
nav.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
nav.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; color: var(--muted); white-space: nowrap; }
nav.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { max-width: 260px; }
.toolbar .spacer { flex: 1; }
.count { color: var(--muted); font-size: 13px; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fdf8f3; position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tr.selected td { background: #fff4f2; }
td.check, th.check { width: 40px; }
td.thumb { width: 84px; }
td.thumb button { padding: 0; border: none; background: none; border-radius: 6px; position: relative; display: block; }
td.thumb img { width: 64px; height: 80px; object-fit: cover; border-radius: 6px; background: var(--line); display: block; }
td.thumb button:hover img { outline: 2px solid var(--brand); }
td.thumb .more { position: absolute; right: 3px; bottom: 3px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 0 5px; border-radius: 4px; }
.search-form { display: flex; gap: 6px; }
.search-form input { width: 220px; }
.search-form button { white-space: nowrap; }
.more-wrap { text-align: center; margin: 14px 0; }
.more-wrap button { min-width: 240px; padding: 10px 18px; }
.photo-dlg { width: min(900px, calc(100vw - 32px)); background: #1d1d1d; color: #fff; }
.photo-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; }
.photo-head button { background: #333; color: #fff; border-color: #444; }
.photo-body { display: flex; gap: 10px; overflow-x: auto; padding: 0 14px 14px; justify-content: center; }
.photo-body img { max-height: 78vh; max-width: 100%; object-fit: contain; border-radius: 6px; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--line); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.fail { background: var(--danger-bg); color: var(--danger); }

dialog { border: none; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.4); }
.dlg-body { padding: 22px; }
.dlg-body h2 { margin: 0 0 8px; font-size: 18px; }
.dlg-list { max-height: 220px; overflow: auto; background: #fdf8f3; border-radius: 8px; padding: 8px 12px; margin: 12px 0; font-size: 13px; }
.dlg-list div { padding: 2px 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.warn { background: var(--danger-bg); color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.info { background: #eef4f4; color: var(--brand); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.progress { margin-top: 12px; color: var(--muted); }

@media (max-width: 640px) {
  header.top { padding: 10px 16px; }
  .hide-sm { display: none; }
  .toolbar input[type=search], .search-form input { max-width: none; }
  .search-form { flex: 1; }
}

/* リピート表示（sharmo と同じ赤いラベル） */
.repeat-filter { border-color: #b9c4c4; color: var(--muted); }
.repeat-filter[aria-pressed="true"] { background: #e04a3f; border-color: #e04a3f; color: #fff; font-weight: 600; }
td.thumb .repeat { position: absolute; top: 3px; right: 3px; background: #e04a3f; color: #fff; font-size: 10px; font-weight: 600; line-height: 1; padding: 3px 6px; border-radius: 999px; border: 1px solid #fff; }
.tag-repeat { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #fde6e4; color: #c0392b; margin-right: 4px; white-space: nowrap; }

/* 削除確認：件数が多くても見渡せるよう、集計＋写真付きリスト */
.confirm-dlg { width: min(720px, calc(100vw - 32px)); }
.summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.summary .chip { background: #f3eee8; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.summary .chip strong { font-variant-numeric: tabular-nums; }
.summary .chip.rep { background: #fde6e4; color: #c0392b; }
.confirm-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.confirm-row { display: grid; grid-template-columns: 44px minmax(40px, auto) 1fr auto; gap: 10px; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.confirm-row:last-child { border-bottom: none; }
.confirm-row .no { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; font-size: 12px; }
.confirm-row img { width: 40px; height: 50px; object-fit: cover; border-radius: 4px; background: var(--line); display: block; }
.confirm-row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-row .s { color: var(--muted); font-size: 12px; white-space: nowrap; }
.progress-bar { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 14px 0 8px; }
.progress-bar > div { height: 100%; width: 0; background: var(--brand); transition: width .3s; }
.progress-text { font-variant-numeric: tabular-nums; margin-bottom: 8px; }
@media (max-width: 640px) { .confirm-row { grid-template-columns: 40px 1fr; } .confirm-row .no, .confirm-row .s { display: none; } }

/* 選択件数と削除ボタンは、下へスクロールしても見えるようにヘッダーの下に固定 */
.selbar { position: sticky; top: var(--header-h, 58px); z-index: 4; background: var(--bg); padding: 8px 0; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
@media (max-width: 640px) {
  nav.tabs button { padding: 10px 9px; font-size: 13px; }
}
