/* 鑑定サポートの作業画面。左に依頼の列、中央に写真と AI の下調べ、右に判定・価格・返信。 */
:root {
  --bg: #eef0f3; --surface: #ffffff; --sunken: #e6e9ee; --line: #d2d7df; --fg: #18202b; --muted: #5b6676;
  --accent: #3446b8; --accent-bg: #e4e8fa; --on-accent: #ffffff;
  --ok: #17703f; --ok-bg: #dff1e6; --ng: #b0261e; --ng-bg: #fae3e1; --hold: #8a5a00; --hold-bg: #fbedcd;
  --bubble-shop: #dfe7f5; --bubble-support: #ffffff; --phone-bg: #e9ecf1;
  --font-body: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-data: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a; --surface: #182029; --sunken: #131a22; --line: #2d3845; --fg: #e5eaf1; --muted: #97a3b2;
    --accent: #9eacff; --accent-bg: #222b4d; --on-accent: #0e1320;
    --ok: #6bd39a; --ok-bg: #143526; --ng: #ff8f86; --ng-bg: #43201d; --hold: #f0c262; --hold-bg: #3a2e13;
    --bubble-shop: #24324d; --bubble-support: #1f2833; --phone-bg: #11171e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a; --surface: #182029; --sunken: #131a22; --line: #2d3845; --fg: #e5eaf1; --muted: #97a3b2;
  --accent: #9eacff; --accent-bg: #222b4d; --on-accent: #0e1320;
  --ok: #6bd39a; --ok-bg: #143526; --ng: #ff8f86; --ng-bg: #43201d; --hold: #f0c262; --hold-bg: #3a2e13;
  --bubble-shop: #24324d; --bubble-support: #1f2833; --phone-bg: #11171e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: 1440px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* ---- 上の帯 ---- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding-block: 12px; }
.title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.title h1 { font-size: 20px; letter-spacing: .04em; }
.demo-badge { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0; }
.stats div { display: flex; align-items: baseline; gap: 8px; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-weight: 700; font-size: 17px; }
.code-btn { margin-left: auto; }

.notice { background: var(--sunken); border-bottom: 1px solid var(--line); font-size: 13px; }
.notice-in { display: flex; flex-wrap: wrap; gap: 4px 24px; padding-block: 8px; }
.notice-in p { flex: 1 1 360px; min-width: 0; }
.mode-line { color: var(--muted); }
.mode-line.live { color: var(--accent); font-weight: 700; }
.mode-line.warn { color: var(--hold); font-weight: 700; }

.code-panel { background: var(--accent-bg); border-bottom: 1px solid var(--line); }
.code-in { display: grid; gap: 8px; padding-block: 14px; }
.code-in h2 { font-size: 15px; }
.code-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.code-form .f { flex: 1 1 220px; max-width: 360px; }

/* ---- 部品 ---- */
.btn { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 600; line-height: 1.4; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.send { background: var(--fg); border-color: var(--fg); color: var(--surface); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.f { display: grid; gap: 4px; min-width: 0; }
.f > span, legend { font-size: 13px; font-weight: 600; color: var(--muted); }
.f input, .f select, .f textarea { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.f textarea { resize: vertical; line-height: 1.6; }
.pill { display: inline-block; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.7; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.ng { background: var(--ng-bg); color: var(--ng); }
.pill.hold { background: var(--hold-bg); color: var(--hold); }
.pill.new { background: var(--accent-bg); color: var(--accent); }
.pill.late { background: var(--hold-bg); color: var(--hold); }
.pill.mute { background: var(--sunken); color: var(--muted); }
.src { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 4px; letter-spacing: .04em; white-space: nowrap; }
.src.sample { background: var(--sunken); color: var(--muted); border: 1px dashed var(--line); }
.src.ai { background: var(--accent); color: var(--on-accent); }

/* ---- 3 列 ---- */
.desk { display: grid; gap: 16px; padding-block: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 820px) { .desk { grid-template-columns: 260px minmax(0, 1fr); } .col-decide { grid-column: 2; } }
@media (min-width: 1240px) { .desk { grid-template-columns: 280px minmax(0, 1fr) 380px; } .col-decide { grid-column: auto; } }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.col-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.col-head h2, .work-head h2 { font-size: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.card-head h3 { font-size: 15px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.step { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .06em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.status { font-size: 13px; color: var(--muted); min-height: 1.4em; }
.status.warn { color: var(--hold); font-weight: 600; }

/* ---- 依頼の列 ---- */
.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 819px) { .queue { max-height: 300px; overflow-y: auto; padding-right: 2px; } }
.q { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; align-items: start; }
.q[aria-current="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.q img { width: 52px; height: 39px; object-fit: cover; border-radius: 6px; display: block; }
.q .t { font-weight: 700; font-size: 13px; line-height: 1.4; }
.q .s { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }

/* ---- 中央 ---- */
.work-head { display: grid; gap: 2px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 210px)); gap: 10px; align-items: start; }
@media (max-width: 519px) { .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.shot { margin: 0; display: grid; gap: 4px; min-width: 0; align-content: start; }
.shot .zoom { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 8px; display: block; width: 100%; }
.shot img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--sunken); display: block; }
.shot.wide img { aspect-ratio: 4 / 3; }
.shot.target img { outline: 3px solid var(--accent); outline-offset: 1px; }
.viewer { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface); color: var(--fg); max-width: min(92vw, 760px); max-height: 92vh; }
.viewer::backdrop { background: rgba(0, 0, 0, .6); }
.viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-weight: 700; }
.viewer img { display: block; max-width: 100%; max-height: calc(92vh - 90px); margin: 0 auto; border-radius: 8px; }
.shot figcaption { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.shop-msg { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.shop-msg .label { font-size: 12px; color: var(--muted); font-weight: 600; }
#shop-msg { white-space: pre-line; }

.reading { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid var(--line); }
.reading > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.reading dt { font-size: 12px; color: var(--muted); font-weight: 600; padding-top: 1px; }
.reading dd { margin: 0; min-height: 1.6em; }
.reading dd.empty { color: var(--muted); }
.reading dd.pending { background: linear-gradient(90deg, var(--sunken) 0%, var(--line) 50%, var(--sunken) 100%); background-size: 200% 100%; border-radius: 4px; color: transparent; animation: shimmer 1.2s linear infinite; }
.reading dd.filled { animation: fadein .35s ease-out; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes fadein { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.checks { background: var(--hold-bg); border-radius: 10px; padding: 10px 12px; }
.checks h4 { font-size: 13px; color: var(--hold); }
.checks ul { margin: 4px 0 0; padding-left: 1.2em; }
.checks li { margin: 2px 0; }

.similar { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.similar li { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; }
.similar .row1 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 700; font-size: 14px; }
.similar .why { font-size: 13px; }
.similar .meta { font-size: 12px; color: var(--muted); }

/* ---- 右 ---- */
.decide { display: grid; gap: 12px; margin: 0; }
.verdicts { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.verdicts legend { margin-bottom: 4px; padding: 0; }
.v { position: relative; display: block; cursor: pointer; }
.v input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.v span { display: block; text-align: center; padding: 8px 4px; border-radius: 8px; border: 1px solid var(--line); font-weight: 700; background: var(--surface); }
.v input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.v.ok input:checked + span { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.v.ng input:checked + span { background: var(--ng-bg); color: var(--ng); border-color: var(--ng); }
.v.hold input:checked + span { background: var(--hold-bg); color: var(--hold); border-color: var(--hold); }
.v input:disabled + span { opacity: .6; cursor: not-allowed; }
.prices { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.prices-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.prices dl { margin: 6px 0 0; display: grid; gap: 2px; }
.prices dl div { display: flex; justify-content: space-between; gap: 10px; }
.prices dt { font-size: 13px; }
.prices dd { margin: 0; font-weight: 700; }
.prices dl div.key dd { color: var(--accent); }

/* ---- 店舗側の画面 (ただの吹き出しのチャット) ---- */
.phone { max-width: 340px; width: 100%; margin: 0 auto; border: 8px solid var(--fg); border-radius: 28px; background: var(--phone-bg); overflow: hidden; display: flex; flex-direction: column; }
.phone-top { background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 14px; font-size: 13px; font-weight: 700; text-align: center; }
.chat { list-style: none; margin: 0; padding: 12px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 260px; max-height: 440px; overflow-y: auto; }
.chat li { max-width: 82%; display: grid; gap: 2px; }
.chat li.shop { align-self: flex-end; }
.chat li.support { align-self: flex-start; }
.chat .who { font-size: 11px; color: var(--muted); }
.chat li.shop .who { text-align: right; }
.chat .b { padding: 8px 11px; border-radius: 14px; white-space: pre-line; font-size: 13px; line-height: 1.55; }
.chat li.shop .b { background: var(--bubble-shop); border-bottom-right-radius: 4px; }
.chat li.support .b { background: var(--bubble-support); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat .imgs { display: flex; gap: 4px; justify-content: flex-end; }
.chat .imgs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; }
.chat .time { font-size: 10px; color: var(--muted); }
.chat li.shop .time { text-align: right; }
.chat li.new .b { animation: fadein .35s ease-out; }
.phone-input { margin: 0 10px 10px; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* ---- たまるデータ ---- */
.data { display: grid; gap: 10px; padding-block: 8px 24px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; background: var(--sunken); white-space: nowrap; }
.table tr.added td { background: var(--accent-bg); }
@media (max-width: 719px) {
  .table thead { display: none; }
  .table, .table tbody { display: block; width: 100%; }
  .table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
  .table td { display: block; border: 0; padding: 0; font-size: 12px; color: var(--muted); }
  .table td.verdict { order: -2; }
  .table td.item { order: -1; flex: 1 1 calc(100% - 80px); font-size: 14px; font-weight: 600; color: var(--fg); }
  .table td.lbl::before { content: attr(data-label) " "; }
}

/* ---- 下 ---- */
.foot { padding-block: 16px 40px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: grid; gap: 12px; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 32px; }
.foot h2 { font-size: 13px; color: var(--fg); margin-bottom: 4px; }
.foot ul { margin: 0; padding-left: 1.2em; }
.credit { color: var(--fg); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reading dd.pending { color: var(--muted); background: var(--sunken); }
}
