/* 共通の見た目。スマホ優先(幅 360px〜)。画面ごとの追加は各HTMLの <style> に書く。 */
:root {
  color-scheme: light dark;
  --bg: #f3f5f9; --card: #ffffff; --line: #dfe5ee; --text: #111827; --sub: #5f6b7e; --accent: #2563eb; --ok: #15803d; --err: #dc2626;
  --surface: #ffffff; --surface2: #eef2f8; --ink2: #4b5563; --accent-ink: #ffffff; --accent-soft: #e0eaff; --ok-soft: #dcfce7;
  --warn: #b45309; --ng: #dc2626; --warn-soft: #fef3c7; --err-soft: #fee2e2; --neutral-soft: #eef2f8;
  --on-text: #ffffff; --on-err: #ffffff; --hint-bg: #fef3c7; --hint-line: #f3dd9a; --ok-wash: #dcfce7; --reply-bg: #dcfce7;
  --veil: rgba(255, 255, 255, .55); --sand: #eef2f8; --sand2: #f7f9fc; --img-bg: #e5e9f0;
  --warn-ink: #b45309; --info-soft: #dbeafe; --info-ink: #0369a1; --limited: #dc2626; --sel: #2563eb;
  --over: #dc2626; --notice-bg: #fee2e2; --notice-line: #fca5a5; --notice-ink: #b91c1c;
  /* 印の色(キズの印の記号)。意味のある色なので、明暗で見分けがつく範囲で残す */
  --mk: #b04a22; --mk-red: #d0021b;
  --tabbar-h: 58px;
}
/* 暗い設定の端末は黒地に黄(CRSと同じ組)。<html data-theme-pref="light"> で明るい固定、"dark" で暗い固定にできる */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme-pref="light"]) {
    --bg: #0b0c0f; --card: #16181d; --line: #2b2f37; --text: #f3f4f6; --sub: #8b93a1; --accent: #ffd51f; --ok: #4ade80; --err: #f87171;
    --surface: #16181d; --surface2: #1f2229; --ink2: #c2c7d0; --accent-ink: #141414; --accent-soft: #2c2710; --ok-soft: #10301c;
    --warn: #fbbf24; --ng: #f87171; --warn-soft: #3a2c0b; --err-soft: #3a1616; --neutral-soft: #1f2229;
    --on-text: #111111; --on-err: #111111; --hint-bg: #3a2c0b; --hint-line: #5c4a16; --ok-wash: #10301c; --reply-bg: #10301c;
    --veil: rgba(11, 12, 15, .6); --sand: #1f2229; --sand2: #101216; --img-bg: #1f2229;
    --warn-ink: #fbbf24; --info-soft: #10243a; --info-ink: #74b9ff; --limited: #f87171; --sel: #74b9ff;
    --over: #f87171; --notice-bg: #3a1616; --notice-line: #5c1f1f; --notice-ink: #fca5a5;
    --mk: #d9683a; --mk-red: #ff7a70;
  }
}
:root[data-theme-pref="dark"] {
  color-scheme: dark;
  --bg: #0b0c0f; --card: #16181d; --line: #2b2f37; --text: #f3f4f6; --sub: #8b93a1; --accent: #ffd51f; --ok: #4ade80; --err: #f87171;
  --surface: #16181d; --surface2: #1f2229; --ink2: #c2c7d0; --accent-ink: #141414; --accent-soft: #2c2710; --ok-soft: #10301c;
  --warn: #fbbf24; --ng: #f87171; --warn-soft: #3a2c0b; --err-soft: #3a1616; --neutral-soft: #1f2229;
  --on-text: #111111; --on-err: #111111; --hint-bg: #3a2c0b; --hint-line: #5c4a16; --ok-wash: #10301c; --reply-bg: #10301c;
  --veil: rgba(11, 12, 15, .6); --sand: #1f2229; --sand2: #101216; --img-bg: #1f2229;
  --warn-ink: #fbbf24; --info-soft: #10243a; --info-ink: #74b9ff; --limited: #f87171; --sel: #74b9ff;
  --over: #f87171; --notice-bg: #3a1616; --notice-line: #5c1f1f; --notice-ink: #fca5a5;
  --mk: #d9683a; --mk-red: #ff7a70;
}
:root[data-theme-pref="light"] { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, "Noto Sans JP", sans-serif; font-size: 16px; line-height: 1.5; }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
header.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; background: var(--surface); color: var(--text); border-bottom: 1px solid var(--line); }
header.bar a { color: var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0; }
button, .button { display: inline-block; min-height: 44px; padding: 10px 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 16px; text-decoration: none; cursor: pointer; }
button.secondary, .button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
button:disabled { opacity: .5; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; background: var(--surface); }
label { display: block; margin: 10px 0 4px; font-weight: 600; }
.message { padding: 12px 16px; margin: 12px; border-radius: 8px; }
.message.error { background: var(--err-soft); color: var(--err); }
.message.ok { background: var(--ok-wash); color: var(--ok); }
.muted { color: var(--sub); font-size: 14px; }

/* ここから下は画面担当Aが追加した共通の小物(添削者の画面でも使ってよい)。既存の形は変えていない。 */
img { max-width: 100%; }
h1 { font-size: 20px; margin: 8px 0; }
h2 { font-size: 18px; margin: 4px 0 8px; }
h3 { font-size: 16px; margin: 12px 0 6px; }
header.bar .title { font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
header.bar button { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.stack > * + * { margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row > .grow { flex: 1 1 140px; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--neutral-soft); color: var(--text); white-space: nowrap; }
.badge.in_stock { background: var(--neutral-soft); }
.badge.repairing { background: var(--warn-soft); color: var(--warn-ink); }
.badge.repaired { background: var(--info-soft); color: var(--info-ink); }
.badge.sold { background: var(--ok-wash); color: var(--ok); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button, .chip { min-height: 40px; padding: 6px 12px; border-radius: 999px; background: var(--surface); color: var(--text); border: 1px solid var(--line); font-size: 15px; }
.chips button[aria-pressed="true"], .chip[aria-pressed="true"] { background: var(--text); color: var(--on-text); border-color: var(--text); }
.danger { background: var(--err) !important; color: var(--on-err) !important; }
button.link { background: none; color: var(--accent); min-height: 0; padding: 4px; text-decoration: underline; }
.hint { background: var(--hint-bg); border: 1px solid var(--hint-line); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.draft-banner { background: var(--err-soft); color: var(--err); border: 2px dashed var(--err); border-radius: 8px; padding: 10px 12px; font-weight: 700; }
.reply { border-left: 4px solid var(--ok); background: var(--reply-bg); padding: 8px 12px; border-radius: 0 8px 8px 0; margin-top: 8px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.list-item { display: block; padding: 12px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.list-item:first-child { border-top: 0; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
dl.kv dt { color: var(--sub); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
/* display を指定したクラス(.grid2 など)でも hidden 属性で必ず隠れるように。 */
[hidden] { display: none !important; }
.grid2 > * { min-width: 0; }

/* 「ちら見せ」: 準備中の機能を、ぼかした見本と「近日公開」で見せる(売却・相場、2026-11-02) */
.teaser { position: relative; overflow: hidden; border-radius: 10px; min-height: 260px; }
.teaser .peek { filter: blur(4px); opacity: .75; pointer-events: none; user-select: none; display: grid; gap: 10px; padding: 8px 4px; }
.teaser .lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; text-align: center; background: var(--veil); }
.teaser .lock strong { font-size: 18px; }
.lock-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--text); color: var(--on-text); font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.peek-row { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 6px 0; }
.peek-big { font-size: 28px; font-weight: 700; color: var(--ok); }
.peek-bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.peek-bar i { display: block; height: 100%; background: var(--accent); }
/* 期間限定の表示(添削し放題など)。赤文字で点滅。動きを減らす設定の人には点滅させない */
.limited { display: inline-block; margin-left: 6px; color: var(--limited); font-weight: 700; font-size: 13px; vertical-align: middle; animation: limited-blink 1s steps(2, start) infinite; }
@keyframes limited-blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .limited { animation: none; } }
.soon { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--line); color: var(--sub); font-size: 11px; vertical-align: middle; }

/* ---- 新しい検品画面の土台(作業20, 2026-11-10) ---- */
/* 追加の色変数。ライト値は見本と同じ。既存の変数(--bg など)は変えない。 */

/* 全画面が端末の明暗に従う。ボタン・入力・上の帯も色変数だけで描く */
input, select, textarea { color: var(--text); }
/* ヘッダーの帯は上の header.bar で色変数だけで描いている */
.cen-entry { color: var(--text); }
.cen-entry small { color: var(--sub); }

/* 下タブ(public/js/bottom-tabs.js)。ログイン後の画面の下に固定。今いる画面は強調(明るい=青・暗い=黄) */
.btabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; padding: 0 4px env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
.btabs a { flex: 1 1 0; max-width: 160px; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--sub); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.btabs a svg { width: 24px; height: 24px; }
.btabs a.on { color: var(--accent); }
/* 本文・固定の保存バー・カード画面の5タブが、下タブの裏に隠れないようにする */
body.has-tabs { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
.cp.has-tabs .savebar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: 8px; }

/* 記号の凡例シート(public/js/legend.js) */
.leg { display: grid; grid-template-columns: 56px 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.leg-h { background: var(--surface2); font-size: 11px; font-weight: 700; color: var(--sub); padding: 6px 10px; }
.leg-sym { font-size: 24px; text-align: center; padding: 8px 0; border-top: 1px solid var(--line); font-weight: 400; color: var(--text); }
.leg-name { padding: 12px 10px; border-top: 1px solid var(--line); font-weight: 700; font-size: 14px; color: var(--text); }

/* ---- カード画面(card.html、<body class="cp">)。以前は card.html の内蔵CSS。色は変数(作業25) ---- */
.cp .tabs { display: flex; flex-wrap: nowrap; gap: 4px; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; }
.cp .tabs button { min-height: 44px; padding: 6px 3px; font-size: 13px; white-space: nowrap; flex: 1 1 auto; background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.cp .tabs button[aria-selected="true"] { background: var(--text); color: var(--accent-ink); border-color: var(--text); }
/* タブ(sticky、約60px)の裏に先頭が隠れないよう、パネルの中身に上余白を足す(作業35) */
.cp [data-panel] > * { scroll-margin-top: 72px; }
.cp .card-title { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cp .card-title h1 { overflow-wrap: anywhere; margin: 0; }
.cp .full { width: 100%; margin-top: 12px; }
.cp .required { color: var(--err); font-size: 13px; margin-left: 4px; }


/* 写真 */
.cp .compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cp .compare .col-head { font-weight: 700; text-align: center; font-size: 14px; }
.cp .photo-box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 4px; min-height: 80px; display: flex; flex-direction: column; gap: 4px; }
.cp .photo-box img { width: 100%; height: auto; border-radius: 6px; display: block; background: var(--surface2); }
.cp .photo-box .empty { color: var(--sub); font-size: 13px; text-align: center; margin: auto; padding: 12px 4px; }
.cp .photo-box button { min-height: 36px; padding: 4px 8px; font-size: 13px; }
.cp .file-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.cp .file-buttons label { margin: 0; font-weight: 400; }
.cp .file-buttons input[type=file] { display: none; }


/* キズの印 */
.cp .stage-wrap { display: flex; justify-content: center; }
.cp .stage { position: relative; width: 100%; max-width: 480px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.cp .stage img { width: 100%; display: block; border-radius: 6px; pointer-events: none; }
.cp .stage .blank { width: 100%; aspect-ratio: 63 / 88; border: 2px dashed var(--line); border-radius: 12px; background: var(--surface); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--sub); font-size: 14px; padding: 16px; }
.cp .stage.placing { outline: 3px solid var(--accent); border-radius: 8px; cursor: crosshair; }
.cp .mark { position: absolute; transform: translate(-50%, -50%); line-height: 1; color: var(--mk-red); text-shadow: 0 0 2px var(--surface), 0 0 3px var(--surface); font-weight: 700; touch-action: none; cursor: grab; padding: 4px; }
.cp .mark.selected { outline: 2px solid var(--sel); border-radius: 6px; background: rgba(128,128,128,.25); }
.cp .symbols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cp .symbols button { display: flex; gap: 6px; align-items: center; background: var(--surface); color: var(--text); border: 1px solid var(--line); text-align: left; padding: 6px 8px; font-size: 14px; }
.cp .symbols button .g { font-size: 22px; width: 28px; text-align: center; flex: none; }
.cp .symbols button[aria-pressed="true"] { background: var(--warn-soft); border-color: var(--accent); outline: 2px solid var(--accent); }
.cp .mark-row { display: flex; gap: 8px; align-items: flex-start; width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line); text-align: left; margin-top: 6px; }
.cp .mark-row .g { font-size: 22px; width: 28px; text-align: center; flex: none; color: var(--mk-red); }


/* 修復メモ */
.cp .choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cp .choice.four { grid-template-columns: 1fr 1fr; }
.cp .choice button { background: var(--surface); color: var(--text); border: 1px solid var(--line); padding: 8px 4px; font-size: 15px; }
.cp .choice button[aria-pressed="true"] { background: var(--text); color: var(--accent-ink); border-color: var(--text); }
.cp .memo { border-top: 1px solid var(--line); padding: 12px 0; }
.cp .memo:first-child { border-top: 0; }
.cp .memo .head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cp .rating-good { background: var(--ok-soft); color: var(--ok); }
.cp .rating-ok { background: var(--neutral-soft); }
.cp .rating-hard { background: var(--err-soft); color: var(--err); }

.cp .profit { font-size: 24px; font-weight: 700; }
.cp .profit.minus { color: var(--err); }

/* 検品の区切り(作業25) */
.cp .insp-photo { margin: 12px auto; max-width: 480px; }
.cp .insp-photo img { width: 100%; display: block; border-radius: 8px; }
.cp .insp-photo .blank { width: 100%; aspect-ratio: 63 / 88; border: 2px dashed var(--line); border-radius: 12px; background: var(--surface); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--sub); font-size: 14px; padding: 16px; }
.cp .file-buttons.one { grid-template-columns: 1fr; }
.cp .file-buttons .button { text-align: center; display: flex; align-items: center; justify-content: center; }
.cp .other-photos { margin: 12px 0; }
.cp .other-photos > summary { font-weight: 700; min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.cp .savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.cp .savebar button { display: block; width: 100%; max-width: 728px; margin: 0 auto; }
.cp main { padding-bottom: 88px; }

/* 印の記号シート(作業26) */
.cp .insp-photo { position: relative; }
.cp .insp-photo .mark-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cp .mark-pending { position: absolute; transform: translate(-50%, -50%); font-size: 28px; line-height: 1; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; animation: mark-blink 1s steps(2, start) infinite; }
@keyframes mark-blink { 50% { opacity: .15; } }
.msh-dim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; }
.msh-sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; z-index: 61; background: var(--surface); color: var(--text); border-radius: 20px 20px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,.25); padding: 8px 14px calc(14px + env(safe-area-inset-bottom)); }
.msh-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 8px; }
.msh-sheet h2 { margin: 0 0 8px; font-size: 18px; }
.msh-cur { font-weight: 400; color: var(--sub); font-size: 15px; }
.msh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.msh-grid button { display: flex; gap: 6px; align-items: center; background: var(--surface); color: var(--text); border: 1px solid var(--line); text-align: left; padding: 6px 8px; font-size: 14px; min-height: 48px; }
.msh-grid button .g { font-size: 22px; width: 28px; text-align: center; flex: none; }
.msh-grid button[aria-pressed="true"] { background: var(--warn-soft); border-color: var(--accent); outline: 2px solid var(--accent); }
.msh-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.msh-lab { font-weight: 700; font-size: 14px; }
.msh-legend { width: 100%; margin-top: 10px; }
.msh-foot { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-top: 12px; }
.msh-foot button:disabled { opacity: .4; }
.msh-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.msh-slot { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.msh-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msh-slot.empty { display: flex; align-items: center; justify-content: center; color: var(--sub); border-style: dashed; font-size: 13px; }
.msh-kind { position: absolute; left: 4px; bottom: 4px; padding: 2px 8px; min-height: 0; border-radius: 999px; font-size: 12px; border: 0; background: #1f6feb; color: #fff; }
.msh-kind.after { background: #1a7f37; }
.msh-x { position: absolute; right: 4px; top: 4px; width: 28px; min-height: 0; height: 28px; padding: 0; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; }
.msh-stage { margin-top: 6px; }
.msh-sheet textarea { width: 100%; box-sizing: border-box; }
.msh-cnt { text-align: right; font-size: 13px; color: var(--sub); }
.msh-cnt.over { color: var(--over); font-weight: 700; }
.msh-quick { margin-top: 8px; }
.msh-notice { background: var(--notice-bg); border: 1px solid var(--notice-line); color: var(--notice-ink); border-radius: 8px; padding: 8px 10px; font-size: 14px; margin: 0 0 8px; }
.msh-del { width: 100%; margin-top: 10px; color: var(--over); }
/* 撮影後の「ズレを直す」画面(作業33): 画面いっぱいに重ねる */
.fit-stage { position: fixed; inset: 0; z-index: 1000; overflow: auto; background: var(--bg); color: var(--text); padding: 12px 16px 28px; }
.fit-stage[hidden] { display: none; }
.fit-stage h2 { margin: 4px 0 10px; font-size: 18px; }
.fit-stage .fit-status { margin: 8px 0 0; font-size: 14px; color: var(--sub); }
.fit-stage.fit-busy .cf-bar { pointer-events: none; opacity: .5; }
