/* 무료 진단 — 비회원 /diagnose(메인 home2.css 결: .h2m·.h2-title·.h2-lead 위에 입력 띠·결과 카드·흐린 자리표시)와
   회원 /customer/diagnose(회원 앱 부품 ap-box·ap-table 위에 가게 카드·표 칸). 그리기는 diagnose.js */
.dg { --r-xl: 40px; --r-lg: 24px; --r-md: 16px; }   /* 모서리는 메인(.h2m)과 같은 값. 메인처럼 그림자 없이 선과 바탕색으로만 나눈다 */
.dg-hero { max-width: calc(var(--w, 1200px) - 48px); margin: 24px auto 0; padding: 72px 24px 64px; border-radius: var(--r-xl); background: var(--primary-bg); text-align: center; }   /* 메인 배너처럼 연보라 큰 칸 */
.dg-hero .h2-lead { margin-bottom: 32px; }
.dg-form:not(.ks-form) { display: flex; gap: 10px; max-width: 680px; margin: 0 auto; padding: 8px; background: var(--surface); border: 1px solid var(--primary-line); border-radius: 999px; }
.dg-form:not(.ks-form) input { flex: 1; min-width: 0; height: 52px; padding: 0 20px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font-size: 16px; outline: none; box-shadow: none; }
.dg-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 28px; border: 0; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 16px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; }
.dg-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.dg-btn:disabled { opacity: .6; cursor: progress; }
.dg-hero .msg { max-width: 680px; margin: 12px auto 0; text-align: left; }

.dg-out { scroll-margin-top: 96px; }   /* 결과로 내려갈 때 고정 머리에 가게 카드가 가리지 않게 */
.dg-out.is-busy { opacity: .5; pointer-events: none; transition: opacity .2s; }   /* 다시 재는 동안 보던 결과는 흐리게 남긴다 */
.dg-out:not(.dg-out--app) { max-width: 960px; margin: 0 auto; padding: 48px 24px 96px; display: flex; flex-direction: column; gap: 20px; }
/* 맨 위 한 카드: 가게 + 요약 3칸(선으로 나눈 띠) */
.dg-report { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.dg-report .dg-place { padding: 24px 28px; }
.dg-report .dg-sum { gap: 0; border-top: 1px solid var(--line); }
.dg-report .dg-sum-t { padding: 20px 28px; border-radius: 0; background: none; }
.dg-report .dg-sum-t + .dg-sum-t { border-left: 1px solid var(--line); }
.dg-h { margin: 20px 0 0; font-size: 20px; font-weight: 700; line-height: 1.5; letter-spacing: -.02em; color: var(--ink-strong, var(--ink)); }
.dg-verdict h2 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.5; letter-spacing: -.02em; color: var(--ink-strong, var(--ink)); word-break: keep-all; }
.dg-verdict p { margin: 4px 0 0; font-size: 16px; line-height: 1.5; color: var(--ink2); word-break: keep-all; }
/* 재는 동안 자리표시 */
.dg-wait { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dg-wait i { height: 220px; border-radius: var(--r-lg); background: var(--soft); animation: dg-wait 1.2s ease-in-out infinite alternate; }
.dg-wait i:first-child { grid-column: 1 / -1; height: 140px; }
@keyframes dg-wait { to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .dg-wait i { animation: none; } }
.dg-place { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 14px; }
.dg-place img { grid-row: span 2; width: 64px; height: 64px; object-fit: cover; border-radius: 12px; background: var(--soft); }
.dg-place div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dg-place b { font-size: 18px; color: var(--ink); }
.dg-place:not(:has(> img)) { grid-template-columns: minmax(0, 1fr); }   /* 사진 없는 가게 */
.dg-place:not(:has(> img)) .dg-stats { grid-column: 1; }
.dg-place small { font-size: 14px; color: var(--ink3); word-break: keep-all; }
.dg-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.dg-cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dg-card { display: flex; flex-direction: column; gap: 20px; padding: 28px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.dg-card p { margin: 0; }
.dg-card-hd { display: flex; flex-direction: column; gap: 8px; }
.dg-card-hd > div { display: flex; align-items: baseline; gap: 10px; }
.dg-kw { font-size: 16px; font-weight: 700; color: var(--ink2); }
.dg-rank { font-size: 44px; font-weight: 700; line-height: 1.1; color: var(--ink-strong, var(--ink)); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dg-rank.is-top { color: var(--primary); }
.dg-rank.is-out { font-size: 26px; color: var(--ink2); }
.dg-total { font-size: 14px; color: var(--ink3); }
.dg-total b { color: var(--ink2); font-weight: 700; }
.dg-gap { font-size: 16px; line-height: 1.55; color: var(--ink2); }


/* 1위 대비 칩 */
.dg-gaps { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dg-gaps small { margin-right: 4px; font-size: 14px; color: var(--ink3); }
.dg-chip { display: inline-flex; align-items: center; gap: 3px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--soft); color: var(--ink2); font-size: 14px; font-weight: 500; white-space: nowrap; }
.dg-chip b { font-weight: 700; font-variant-numeric: tabular-nums; }

/* 맨 위 요약 3칸 */
.dg-sum { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 12px; }
.dg-sum-t { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 20px 22px; border-radius: var(--r-md); background: var(--soft); }
.dg-sum-t span { font-size: 14px; font-weight: 500; color: var(--ink3); }
.dg-sum-t b { font-size: 26px; font-weight: 700; line-height: 1.2; color: var(--ink-strong, var(--ink)); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dg-sum-t b em { font-style: normal; font-size: 18px; font-weight: 700; color: var(--ink3); }
.dg-sum-t small { overflow: hidden; font-size: 14px; color: var(--ink2); text-overflow: ellipsis; white-space: nowrap; }
.dg-sum-t.is-warn small { color: var(--amber); }   /* 사람이 채울 것 = 주황 */

/* 점검 진행 막대 */
.dg-prog { height: 6px; margin-top: 12px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.dg-prog i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }
.dg-note { margin: 0; font-size: 14px; color: var(--ink3); }

/* 가게 카드의 내 공개 수치 한 줄 */
.dg-stats { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 14px; color: var(--ink2); }
.dg-stats b { font-size: 14px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* 1~3위와 내 매장 비교표 — 카드 안은 선으로만 나눈다(카드 안에 카드 금지) */
.dg-cmp-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.dg-cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
.dg-cmp th { padding: 10px 8px; font-size: 12px; font-weight: 500; color: var(--ink3); text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.dg-cmp th:first-child { text-align: left; }
.dg-cmp td { padding: 10px 8px; color: var(--ink); border-bottom: 1px solid var(--line); }
.dg-cmp td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dg-cmp-name { max-width: 0; width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-cmp-name em { display: inline-block; min-width: 40px; margin-right: 4px; font-style: normal; font-weight: 700; color: var(--ink2); }
.dg-cmp-name a { color: var(--ink); text-decoration: none; }
.dg-cmp-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.dg-cmp tr.is-me td { background: var(--primary-bg); font-weight: 700; }
.dg-cmp tr.is-me td:first-child { border-radius: 8px 0 0 8px; }
.dg-cmp tr.is-me td:last-child { border-radius: 0 8px 8px 0; }
.dg-cmp tbody tr:last-child td { border-bottom: 0; }
.ap-table .dg-cmp th { height: auto; padding: 10px 8px; font-size: 12px; font-weight: 500; color: var(--ink3); text-align: right; background: none; }
.ap-table .dg-cmp th:first-child { text-align: left; }
.ap-table .dg-cmp td { height: auto; padding: 10px 8px; }
.dg-cmp-btn { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; }
.dg-cmp-btn:hover { border-color: var(--ink3); }
[data-dg-cmp] { min-width: 88px; justify-content: center; }

/* 매장 정보 점검 — 채움 초록 · 빠짐 주황(사람이 고칠 것) · 안 씀 회색 */
.dg-check { margin-top: 20px; padding: 28px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.dg-out--app .dg-check-hd h2 { font-size: 16px; }
.dg-out--app .dg-check { margin-top: 16px; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.dg-check-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dg-check-hd h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--ink); }
.dg-check-hd span { font-size: 14px; color: var(--ink2); white-space: nowrap; }
.dg-check-hd b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dg-check-sub { margin: 6px 0 14px; font-size: 14px; color: var(--ink3); }
.dg-check h3 { margin: 20px 0 8px; font-size: 16px; font-weight: 700; color: var(--ink); }
.dg-chk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; padding: 0; list-style: none; }
.dg-chk li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.dg-chk li div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dg-chk b { font-size: 14px; font-weight: 500; color: var(--ink); }
.dg-chk small { font-size: 12px; line-height: 1.5; color: var(--ink2); }
.dg-chk em { font-style: normal; font-size: 12px; font-weight: 500; line-height: 24px; white-space: nowrap; }
.dg-chk-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; font-weight: 700; }
.dg-chk-ok { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 24px; color: var(--ink2); word-break: keep-all; }
.dg-chk-ok .dg-chk-mark { flex: none; background: var(--green-bg); color: var(--green-ink); }
.dg-chk-ok b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dg-chk .is-miss .dg-chk-mark { background: var(--amber-bg); color: var(--amber); }
.dg-chk .is-miss em { color: var(--amber); }
.dg-chk .is-off .dg-chk-mark { background: var(--soft); color: var(--ink3); }
.dg-chk .is-off em { color: var(--ink3); }

/* 비회원: 나머지 검색어는 흐린 자리표시(진짜 값 아님) + 가입 권유(위쪽에 붙인다 — 휴대폰에서 결과로 내려간 첫 화면에 버튼이 아래 탭 위로 오게) */
.dg-msg-link { font-weight: 700; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.dg-lock.h2-cta { max-width: none; margin: 20px 0 0; padding: 0; }   /* 메인 맨 아래 CTA 부품(.h2-cta-in·.h2-cta-btn) 그대로 — 결과 칸 폭에 맞추고 흐린 자리표시만 얹는다 */
.dg-lock .h2-cta-in > :not(.dg-fake) { position: relative; }
.dg-lock h2 { word-break: keep-all; }
.dg-fake { position: absolute; inset: 0; margin: 0; padding: 4px 72px; list-style: none; filter: blur(6px); opacity: .3; user-select: none; pointer-events: none; }
.dg-fake li { display: grid; grid-template-columns: 1fr auto auto; gap: 20px; padding: 12px 0; font-size: 16px; }
.dg-fake em { font-style: normal; }

/* 다음 기능으로 가는 버튼 줄 — 버튼 모양은 공용(.dg-cmp-btn·.ap-btn·.m-btn), 여기는 배치만 */
.dg-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dg-card .dg-acts { margin-top: auto; }   /* 두 카드의 버튼 줄이 같은 높이에 오게 */
.dg-verdict .dg-acts { margin-top: 14px; }
.dg-verdict .dg-note { margin-top: 8px; font-size: 14px; color: var(--ink3); }
.dg-check { scroll-margin-top: 96px; }   /* '빠진 정보 보기'로 내려올 때 고정 머리에 가리지 않게 */
.dg-next { margin-top: 16px; padding-top: 20px; border-top: 1px solid var(--line); }
.dg-next h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.dg-next p { margin: 4px 0 12px; font-size: 14px; color: var(--ink2); word-break: keep-all; }
.dg-next-acts { display: flex; flex-wrap: wrap; gap: 8px; }
body.m .dg-next-acts { flex-direction: column; gap: 0; }   /* 휴대폰은 .m-btn 전체 폭(버튼 사이 간격은 m.css) */
/* 최근 진단한 매장(이 브라우저에 남긴 것) — 입력 칸 아래 한 줄 */
.dg-recent { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; max-width: 680px; margin: 14px auto 0; }
.dg-recent[hidden] { display: none; }
.dg-recent small { margin-right: 4px; font-size: 14px; color: var(--ink3); }
.dg-recent .dg-chip { border: 0; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; background: var(--surface); }
.ap-box .dg-recent { justify-content: flex-start; max-width: none; margin: 12px 0 0; }
.ap-box .dg-recent .dg-chip { background: var(--soft); }

/* 회원 표(휴대폰은 m.css .m-list) */
.dg-mlist { margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); }
.dg-mlist .m-item { align-items: flex-start; flex-wrap: wrap; }
.dg-mlist .m-s { word-break: keep-all; }
.dg-mlist .m-t, .dg-mlist .m-s { margin: 0; }
.dg-mact { margin-top: 10px; }
.dg-out--app .dg-place { margin-bottom: 14px; }
.dg-out--app .dg-note { margin-top: 10px; }
.dg-table td:last-child { white-space: nowrap; }
.dg-td-act { display: flex; justify-content: flex-end; gap: 6px; }   /* 비교 버튼이 없는 줄(못 잰 검색어)도 주문·추적 버튼이 윗줄과 같은 세로줄에 */
/* 순위 추적 결과 한 줄 — 누른 줄 바로 아래(초록 = 됨, 빨강 = 안 됨). PC 표는 따로 한 줄(.dg-track-row)이라 누른 줄의 버튼이 움직이지 않는다 */
.dg-track-msg { margin: 6px 0 0; font-size: 12px; line-height: 1.5; white-space: normal; word-break: keep-all; }
.dg-track-msg.is-ok { color: var(--green-ink); }
.dg-track-msg.is-err { color: var(--red-ink); }
.dg-track-msg a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.ap-table .dg-track-row > td { height: auto; padding: 0 10px 10px; text-align: right; white-space: normal; }
.ap-table .dg-track-row .dg-track-msg { margin: 0; }
.dg-table tr:has(+ .dg-track-row:not([hidden])) > td { border-bottom-color: transparent; }   /* 줄과 그 아래 문구를 한 덩어리로 */
.dg-td-act > * { flex: none; }
.dg-td-act > :last-child { min-width: 8.6em; }   /* '순위 추적에 추가' → '추적 중 · 순위 보기'로 바뀌어도 칸 폭이 그대로(버튼 줄이 옆으로 밀리지 않게) */
.dg-out--app .dg-wait { margin-top: 14px; }
.dg-sub > td { padding: 0 16px 12px; }
.dg-sub .dg-cmp-wrap { margin-top: 0; border-top: 0; }
.dg-mact { display: flex; flex-wrap: wrap; gap: 6px; }
.dg-msub { margin-top: 10px; }
.dg-mlist .dg-msub { flex: 0 0 100%; }   /* 회원 휴대폰: 목록 줄 아래 전체 폭 */
.dg-card .dg-msub { margin-top: 0; }
.dg-out--app ul.dg-mlist.m-list { border: 0; background: none; box-shadow: none; }   /* 진단 결과 상자 안 — 상자 안 상자 금지 */
.ap-table .dg-td-gap { min-width: 140px; padding-block: 8px; font-size: 14px; color: var(--ink2); white-space: normal; word-break: keep-all; }   /* 버튼 3개 줄이 들어가도 표가 옆으로 넘치지 않게 문장 칸이 줄어든다 */

@media (max-width: 860px) {
  .dg-out { scroll-margin-top: 60px; }
  .dg-hero { margin: 0; padding: 40px 16px 32px; border-radius: 16px; }
  .dg-hero .h2-lead { margin-bottom: 24px; }
  .dg-form:not(.ks-form) { flex-direction: column; border-radius: 16px; }
  .dg-form:not(.ks-form) input { height: 48px; padding: 0 12px; font-size: 16px; }
  .dg-btn { height: 48px; width: 100%; }
  .dg-fake { padding: 0 20px; }
  .dg-wait { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .dg-wait i { height: 120px; }
  .dg-verdict h2 { font-size: 20px; }
  .dg-verdict p { font-size: 14px; }
  .dg-out:not(.dg-out--app) { padding: 16px 16px 64px; gap: 12px; }   /* 결과로 내려간 첫 화면에 가게 카드·검색어 2개·가입 버튼이 다 들어오게 */
  .dg-cards--2 { grid-template-columns: minmax(0, 1fr); }
  .dg-h { margin-top: 8px; font-size: 16px; }
  .dg-card { padding: 18px; }
  .dg-card-hd { gap: 2px; }
  .dg-rank { font-size: 26px; }
  .dg-rank.is-out { font-size: 20px; }
  .dg-place { gap: 2px 12px; }
  .dg-report .dg-place { padding: 14px 16px; }
  .dg-place img { grid-row: auto; width: 48px; height: 48px; }
  .dg-place > div > b { font-size: 16px; }
  .dg-stats { grid-column: 1 / -1; margin-top: 6px; gap: 2px 12px; }
  .dg-card { gap: 12px; }
  .dg-kw { font-size: 14px; }
  .dg-check { scroll-margin-top: 60px; }
  .dg-verdict .dg-acts { margin-top: 10px; }
  .dg-chip { height: 26px; padding: 0 8px; font-size: 12px; }
  .dg-sum { gap: 8px; }
  .dg-sum-t, .dg-report .dg-sum-t { gap: 4px; padding: 12px; }
  .dg-sum-t span, .dg-sum-t small { font-size: 12px; }
  .dg-sum-t small { white-space: normal; }
  .dg-sum-t b { font-size: 20px; }
  .dg-sum-t b em { font-size: 14px; }
  .dg-fake li { grid-template-columns: 1fr auto; }
  .dg-fake em { display: none; }
  .dg-cmp { font-size: 12px; }
  .dg-cmp th, .dg-cmp td, .ap-table .dg-cmp th, .ap-table .dg-cmp td { padding: 8px 4px; }
  .dg-cmp th { white-space: normal; }
  .dg-cmp-name { min-width: 96px; }
  .dg-cmp-name em { min-width: 48px; margin-right: 4px; }
  .dg-cmp-photo { display: none; }
  .dg-check { margin-top: 8px; padding: 18px 16px; }
  .dg-check-hd h2 { font-size: 16px; }
  .dg-chk { grid-template-columns: minmax(0, 1fr); }
}
