/* ==========================================================================
   옥션뷰 — 컴포넌트 스타일
   oh-my-auction content.css 의 컴포넌트를 av- 프리픽스로 옮기고 모바일 기준으로 조정
   ========================================================================== */

/* ---------- reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--text-body);
  color: var(--text);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  overscroll-behavior-y: none;
}

h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

/* hidden 속성이 컴포넌트 display 규칙에 눌리지 않도록 */
[hidden] {
  display: none !important;
}

/* ---------- shell ---------- */
.av-main {
  min-height: 100dvh;
  padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 8px);
}

body[data-screen="detail"] .av-main {
  padding-bottom: calc(var(--safe-bottom) + 16px);
}

.av-screen {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 8px) var(--page-x) 24px;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  animation: av-fade 0.24s var(--ease);
}

@keyframes av-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 하단 탭바 ---------- */
.av-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  height: calc(var(--tabbar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
}

.av-tabbar[hidden] {
  display: none;
}

.av-tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: var(--text-micro);
  font-weight: 600;
  color: var(--text-faint);
  transition: color 0.15s;
}

.av-tabbar-icon {
  font-size: 18px;
  line-height: 1;
  opacity: 0.75;
}

.av-tabbar-item.is-active {
  color: var(--blue);
}

.av-tabbar-item.is-active .av-tabbar-icon {
  opacity: 1;
}

/* ---------- 페이지 헤더 ---------- */
.av-page-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 2px 4px;
}

.av-page-title {
  font-size: var(--text-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-strong);
}

.av-page-desc {
  font-size: var(--text-caption);
  color: var(--text-faint);
}

/* ---------- 카드 ---------- */
.av-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: var(--card-pad);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.av-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.av-card-title {
  flex-shrink: 0;
  font-size: var(--text-body);
  font-weight: 700;
  white-space: nowrap;
  color: var(--text-strong);
}

.av-card-caption {
  min-width: 0;
  font-size: var(--text-caption);
  color: var(--text-faint);
  text-align: right;
}

/* ---------- 기본 타이포 조각 ---------- */
.av-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.av-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.av-label {
  font-size: var(--text-label);
  font-weight: 500;
  color: var(--text-weak);
}

/* 한글은 단어 중간에서 끊지 않되, 넘칠 때만 강제로 나눔 */
.av-row-label,
.av-hint,
.av-sub,
.av-card-caption,
.av-case-addr,
.av-detail-addr,
.av-callout-desc,
.av-empty {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.av-big-num {
  font-size: clamp(22px, 7vw, 30px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.av-big-num.is-blue {
  color: var(--blue);
}

.av-big-num.is-sm {
  font-size: clamp(18px, 5.5vw, 22px);
}

.av-sub {
  font-size: var(--text-caption);
  color: var(--text-faint);
}

.av-hint {
  font-size: var(--text-caption);
  line-height: 1.55;
  color: var(--text-faint);
}

.av-blue { color: var(--blue); }
.av-warn { color: var(--red); font-weight: 700; }
.av-doc-error { color: var(--red); }
.is-faint { color: var(--text-faint); }
.is-neg { color: var(--red) !important; }

/* ---------- 배지 ---------- */
.av-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: var(--text-micro);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.av-badge--grey { background: var(--fill); color: var(--text-sub); }
.av-badge--blue { background: var(--blue-weak); color: var(--blue); }
.av-badge--green { background: var(--green-weak); color: var(--green); }
.av-badge--orange { background: var(--orange-weak); color: var(--orange); }
.av-badge--red { background: var(--red-weak); color: var(--red); }
.av-badge--purple { background: var(--purple-weak); color: var(--purple); }
.av-badge--teal { background: var(--teal-weak); color: var(--teal); }

.av-badge--lg {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
}

.av-type-badge {
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}

/* ---------- 리스트 ---------- */
.av-list {
  display: flex;
  flex-direction: column;
}

.av-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  font-size: var(--text-body);
}

.av-row:first-child { padding-top: 0; }
.av-row:last-child { padding-bottom: 0; }

.av-row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 1;
  min-width: 0;
  color: var(--text-weak);
}

.av-row-sub {
  font-size: var(--text-micro);
  color: var(--text-faint);
  line-height: 1.4;
}

.av-row-value {
  flex-shrink: 0;
  max-width: 58%;
  text-align: right;
  font-weight: 600;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.av-row-value small {
  display: block;
  margin-top: 2px;
  font-size: var(--text-micro);
  font-weight: 500;
  color: var(--text-faint);
}

/* ---------- 칩 ---------- */
.av-chips,
.av-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.av-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(var(--page-x) * -1);
  padding: 0 var(--page-x);
  -webkit-overflow-scrolling: touch;
}

.av-chips::-webkit-scrollbar { display: none; }

.av-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--fill);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-sub);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.av-chip.is-active {
  background: var(--blue);
  color: #fff;
}

.av-chip-count {
  font-size: 11px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

/* ---------- 세그먼트 ---------- */
.av-segmented {
  display: flex;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--fill);
}

.av-segmented--inline {
  width: auto;
  padding: 2px;
}

.av-seg {
  flex: 1;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-weak);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.av-segmented--inline .av-seg {
  min-width: 56px;
}

.av-seg.is-active {
  background: var(--surface);
  color: var(--text-strong);
  box-shadow: var(--shadow-sm);
}

:root[data-theme="dark"] .av-seg.is-active {
  background: var(--fill-hover);
}

/* ---------- 입력 ---------- */
.av-input {
  width: 100%;
  max-width: 200px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--fill);
  color: var(--text-strong);
  font-size: var(--text-body);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.av-input:focus {
  border-color: var(--blue);
  background: var(--surface);
}

.av-input--sm {
  width: 72px;
}

.av-input--plain {
  max-width: none;
  text-align: left;
  font-weight: 500;
  background: var(--surface-sub);
  border-color: var(--line);
}

.av-input-unit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-caption);
  color: var(--text-weak);
}

.av-input-unit .av-input {
  width: 72px;
}

.av-select {
  min-height: 36px;
  padding: 6px 30px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: var(--surface-sub);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-strong);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95a1' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.av-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sub);
  font-size: var(--text-caption);
  line-height: 1.5;
  color: var(--text-strong);
  resize: vertical;
  outline: none;
}

.av-textarea:focus {
  border-color: var(--blue);
  background: var(--surface);
}

.av-range {
  width: 100%;
  accent-color: var(--blue);
  cursor: pointer;
}

.av-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  font-size: var(--text-caption);
  color: var(--text-sub);
  cursor: pointer;
}

.av-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.av-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-weak);
}

/* ---------- 버튼 ---------- */
.av-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--blue);
  font-size: var(--text-body);
  font-weight: 700;
  color: #fff;
  transition: filter 0.15s, opacity 0.15s;
}

.av-btn:active { filter: brightness(0.94); }
.av-btn:disabled { opacity: 0.45; cursor: default; }

.av-btn--secondary {
  background: var(--fill);
  color: var(--text-strong);
}

.av-btn--ghost {
  background: transparent;
  color: var(--text-faint);
}

.av-btn--sm {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: var(--text-caption);
}

.av-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.av-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  font-size: 18px;
  color: var(--text-sub);
}

.av-icon-btn:active { background: var(--fill); }
.av-icon-btn.is-on { color: #f5a623; }

.av-text-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--blue);
}

/* ---------- 게이지 ---------- */
.av-gauge-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-sub);
}

.av-gauge-track {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--fill-hover);
}

.av-gauge-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--blue);
  transition: width 0.6s var(--ease);
}

.av-gauge-mid {
  position: absolute;
  top: -3px;
  bottom: -3px;
  left: 50%;
  width: 2px;
  border-radius: 2px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  transform: translateX(-50%);
}

.av-gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-micro);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- 표 (실거래) ---------- */
.av-table-wrap {
  margin: 0 -8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.av-table-wrap::-webkit-scrollbar { display: none; }

.av-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-label);
  font-variant-numeric: tabular-nums;
}

.av-table th {
  padding: 0 8px 8px;
  font-size: var(--text-micro);
  font-weight: 500;
  color: var(--text-faint);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-weak);
}

.av-table td {
  padding: 10px 8px;
  color: var(--text-sub);
  white-space: nowrap;
  border-bottom: 1px solid var(--line-weak);
}

.av-table th.is-num,
.av-table td.is-num {
  text-align: right;
}

.av-table tr:last-child td { border-bottom: none; }

.av-table td.is-price {
  font-weight: 700;
  color: var(--text-strong);
}

.av-table tr.is-same td {
  background: var(--blue-weak);
  color: var(--text);
}

.av-table tr.is-same td:first-child { border-radius: 10px 0 0 10px; }
.av-table tr.is-same td:last-child { border-radius: 0 10px 10px 0; }
.av-table tr.is-same td.is-price { color: var(--blue-strong); }

.av-floor-cell {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 700;
}

.av-floor-pct {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.8;
}

/* ---------- 콜아웃 · 정보 박스 ---------- */
.av-callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-sm);
}

.av-callout-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.av-callout.is-safe { background: var(--green-weak); }
.av-callout.is-safe .av-callout-icon { background: var(--green); }
.av-callout.is-danger { background: var(--red-weak); }
.av-callout.is-danger .av-callout-icon { background: var(--red); }

.av-callout-title {
  margin-bottom: 2px;
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--text-strong);
}

.av-callout-desc {
  font-size: var(--text-caption);
  line-height: 1.5;
  color: var(--text-sub);
}

.av-info-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-sub);
}

.av-info-box b {
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--text-strong);
}

/* ---------- 등기부 행 ---------- */
.av-reg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-weak);
}

.av-reg-row:first-child { padding-top: 0; }
.av-reg-row:last-child { padding-bottom: 0; border-bottom: none; }

.av-reg-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.av-reg-name {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.av-reg-meta {
  font-size: var(--text-caption);
  color: var(--text-faint);
}

.av-reg-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.av-reg-amount {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.av-reg-row.is-risk .av-reg-name { color: var(--red); }

/* ---------- 등기부 원본 뷰어 ---------- */
.av-doc-toolbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-weak);
}

.av-doc-toolbar .av-hint {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.av-doc-toolbar .av-text-link {
  flex-shrink: 0;
}

.av-doc-host {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.av-doc-page {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.av-doc-frame {
  width: 100%;
  height: 70vh;
  border: 0;
  border-radius: 10px;
  background: #fff;
}

.av-doc-msg {
  padding: 24px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-sub);
  font-size: var(--text-caption);
  line-height: 1.6;
  text-align: center;
  color: var(--text-faint);
}

.av-doc-msg.is-error {
  color: var(--red);
}

/* ---------- 빈 상태 · 로딩 ---------- */
.av-empty {
  padding: 20px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-sub);
  font-size: var(--text-caption);
  line-height: 1.6;
  text-align: center;
  color: var(--text-faint);
}

.av-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 12px;
  font-size: var(--text-caption);
  color: var(--text-faint);
}

.av-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: av-spin 0.8s linear infinite;
}

@keyframes av-spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   S1 검색
   ========================================================================== */
.av-searchbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 52px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.av-searchbox-icon {
  font-size: 15px;
  opacity: 0.6;
}

.av-searchbox input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  font-size: var(--text-body);
  color: var(--text-strong);
}

.av-searchbox input::placeholder {
  color: var(--text-faint);
}

.av-searchbox-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--fill);
  font-size: 11px;
  color: var(--text-weak);
}

.av-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
  font-size: var(--text-caption);
  color: var(--text-faint);
}

.av-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 결과 카드 */
.av-case-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.12s var(--ease), box-shadow 0.12s;
}

.av-case-card:active {
  transform: scale(0.99);
  box-shadow: none;
}

.av-case-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.av-case-no {
  margin-right: auto;
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.av-case-addr {
  font-size: var(--text-label);
  line-height: 1.45;
  color: var(--text);
}

.av-case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: var(--text-micro);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.av-case-price {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line-weak);
}

.av-case-price div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.av-case-price-label {
  font-size: var(--text-micro);
  color: var(--text-faint);
}

.av-case-price b {
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.av-case-price b.is-blue {
  color: var(--blue);
}

.av-case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.av-case-tags:empty {
  display: none;
}

/* ==========================================================================
   S2 상세
   ========================================================================== */
.av-detail {
  padding-top: 0;
  gap: 10px;
}

.av-detail-head {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin: 0 calc(var(--page-x) * -1);
  padding: calc(var(--safe-top) + 6px) 8px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

.av-detail-head-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
}

.av-detail-case {
  display: flex;
  align-items: center;
  gap: 6px;
}

.av-case-copy {
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.av-detail-addr {
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.av-detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* 탭 */
.av-tabs {
  position: sticky;
  top: calc(var(--safe-top) + 84px);
  z-index: 15;
  display: flex;
  gap: 2px;
  margin: 0 calc(var(--page-x) * -1);
  padding: 0 var(--page-x) 8px;
  overflow-x: auto;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.av-tabs::-webkit-scrollbar { display: none; }

.av-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--text-weak);
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.av-tab.is-active {
  background: var(--text-strong);
  color: var(--surface);
}

.av-tab-count {
  font-size: 10px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.av-tab-body {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-height: 200px;
}

/* 지도 */
.av-map-host {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.av-map {
  position: relative;
  height: clamp(220px, 56vw, 320px);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-sub);
}

.av-map-canvas {
  width: 100%;
  height: 100%;
}

/* 네이버 SDK 타일이 사이트 CSS에 눌리지 않도록 */
.av-map-canvas img {
  max-width: none !important;
  max-height: none !important;
}

.av-map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 28px;
  background: var(--surface-sub);
  font-size: var(--text-caption);
  line-height: 1.55;
  text-align: center;
  color: var(--text-faint);
}

.av-map-overlay[hidden] {
  display: none;
}

.av-map-overlay .av-spinner[hidden] {
  display: none;
}

.av-map-overlay[data-tone="error"] {
  color: var(--text-sub);
}

/* 지도 위 물건 위치 핀 */
.av-map-pin {
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  background: var(--blue);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transform: rotate(-45deg);
}

/* 단지 평형 막대 */
.av-type-share {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.av-type-seg {
  min-width: 4px;
  background: var(--fill-hover);
}

.av-type-seg.is-on {
  background: var(--blue);
}

.av-type-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: var(--text-micro);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.av-type-legend .is-on {
  color: var(--blue);
  font-weight: 700;
}

/* ==========================================================================
   낙찰사례
   ========================================================================== */
.av-nearby-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-weak);
}

.av-nearby-row:first-child { padding-top: 0; }
.av-nearby-row:last-child { padding-bottom: 0; border-bottom: none; }

.av-nearby-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.av-nearby-case {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-label);
  font-weight: 600;
  color: var(--text-strong);
}

.av-nearby-addr {
  font-size: var(--text-micro);
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.av-nearby-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.av-nearby-pct {
  font-size: 16px;
  font-weight: 700;
  color: var(--blue);
}

.av-nearby-pct.is-over { color: var(--red); }

.av-nearby-price {
  font-size: var(--text-micro);
  color: var(--text-weak);
}

.av-ratio-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-weak);
}

.av-ratio-row:first-child { padding-top: 0; }
.av-ratio-row:last-child { padding-bottom: 0; border-bottom: none; }

.av-ratio-pct {
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.av-ratio-pct.is-over { color: var(--red); }

.av-ratio-track {
  position: relative;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--fill);
  overflow: hidden;
}

.av-ratio-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--blue);
  transition: width 0.5s var(--ease);
}

.av-ratio-fill.is-over { background: var(--red); }

.av-ratio-min {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--orange);
}

.av-ratio-base {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--line);
}

.av-ratio-meta {
  font-size: var(--text-micro);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   조회수
   ========================================================================== */
.av-views-list {
  gap: 18px;
}

.av-views-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.av-views-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--fill);
  overflow: hidden;
}

.av-views-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.6s var(--ease);
}

.av-views-chart {
  display: block;
  width: 100%;
  height: 100px;
}

.av-views-log { font-size: var(--text-caption); }

.av-delta {
  margin-left: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
}

/* ==========================================================================
   수익 계산기
   ========================================================================== */
.av-calc {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.av-calc-result {
  gap: 16px;
}

.av-calc-group {
  margin-bottom: -6px;
  font-size: var(--text-micro);
  font-weight: 700;
  color: var(--text-faint);
}

.av-calc-row { padding: 8px 0; }

.av-calc-right { flex-shrink: 0; text-align: right; }

.av-calc-total {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.av-calc-total .av-row-value {
  font-size: 17px;
  color: var(--blue);
}

.av-calc-note {
  padding: 0 4px 8px;
}

/* ==========================================================================
   연락처
   ========================================================================== */
.av-agent-list {
  display: flex;
  flex-direction: column;
}

.av-agent {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-weak);
}

.av-agent:first-child { padding-top: 0; }
.av-agent:last-child { padding-bottom: 0; border-bottom: none; }

.av-agent-top {
  display: flex;
  gap: 10px;
}

.av-agent-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--blue-weak);
  font-size: 16px;
  font-weight: 700;
  color: var(--blue);
}

.av-agent-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.av-agent-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-label);
  font-weight: 600;
  color: var(--text-strong);
}

.av-agent-name a { color: inherit; }

.av-agent-sub {
  font-size: var(--text-micro);
  line-height: 1.45;
  color: var(--text-faint);
}

.av-agent-reviews {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.av-review-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-micro);
  font-weight: 600;
  color: var(--text-sub);
  background: var(--fill);
}

.av-review-chip span {
  font-weight: 700;
  opacity: 0.75;
}

.av-review-chip.is-kakao span { color: #b8912d; }
.av-review-chip.is-naver span { color: #03c75a; }
.av-review-chip.is-muted { color: var(--text-faint); }

.av-review-quote {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-sub);
  font-size: var(--text-micro);
  line-height: 1.5;
  color: var(--text-sub);
}

.av-review-quote span {
  display: block;
  margin-top: 3px;
  color: var(--text-faint);
}

.av-agent-phones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.av-agent-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--blue-weak);
  font-size: var(--text-micro);
  color: var(--text-sub);
}

.av-agent-phone b {
  font-size: var(--text-caption);
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   S4 1차 선정
   ========================================================================== */
.av-pick-card {
  gap: 10px;
}

.av-pick-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.av-pick-link {
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.av-pick-addr {
  font-size: var(--text-caption);
  line-height: 1.45;
  color: var(--text-weak);
}

.av-pick-price {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: var(--text-micro);
  color: var(--text-faint);
}

.av-pick-price b {
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--text-strong);
}

.av-pick-price b.av-blue { color: var(--blue); }

.av-pick-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.av-pick-fields .av-field { flex: 1; min-width: 140px; }

/* ==========================================================================
   S3 설정
   ========================================================================== */
.av-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 18px;
  list-style: decimal;
  font-size: var(--text-micro);
  line-height: 1.5;
  color: var(--text-faint);
}

.av-code {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--fill);
  font-size: var(--text-micro);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-sub);
}

/* ==========================================================================
   토스트 · 스켈레톤
   ========================================================================== */
.av-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 20px);
  z-index: 100;
  max-width: calc(100vw - 40px);
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(25, 31, 40, 0.92);
  font-size: var(--text-caption);
  font-weight: 600;
  color: #fff;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  pointer-events: none;
}

.av-toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.av-skeleton-line {
  display: block;
  width: 60%;
  height: 18px;
  border-radius: 6px;
  background: var(--fill);
  animation: av-pulse 1.2s ease-in-out infinite;
}

@keyframes av-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ==========================================================================
   반응형
   ========================================================================== */
@media (min-width: 720px) {
  .av-screen {
    padding-left: 24px;
    padding-right: 24px;
  }

  .av-tab-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .av-tab-body > .av-card--wide,
  .av-tab-body > .av-calc,
  .av-tab-body > .av-table-wrap {
    grid-column: 1 / -1;
  }

  .av-calc {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .av-calc > .av-calc-result,
  .av-calc > .av-calc-note {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 미리보기(OSM) 상태 */
.av-map-canvas {
  position: relative;
}

.av-map-pin.is-center {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -11px 0 0 -11px;
  z-index: 2;
}

.av-map-attr {
  position: absolute;
  right: 4px;
  bottom: 3px;
  z-index: 2;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 9px;
  color: #4e5968;
}

.av-map-note {
  position: absolute;
  left: 8px;
  bottom: 8px;
  right: 8px;
  z-index: 2;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(25, 31, 40, 0.72);
  font-size: 10.5px;
  line-height: 1.35;
  color: #fff;
  text-align: center;
}

.av-map-note[hidden] {
  display: none;
}

/* ==========================================================================
   통합검색 필터
   ========================================================================== */
.av-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.av-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--text-strong);
}

.av-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--blue);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.av-toolbar .av-select {
  margin-left: auto;
  min-height: 38px;
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
  border-color: transparent;
}

.av-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.av-active-filters:empty {
  display: none;
}

.av-filter-chip {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--blue-weak);
  font-size: var(--text-micro);
  font-weight: 600;
  color: var(--blue);
}

.av-more {
  padding: 8px 2px 0;
  text-align: center;
}

/* 바텀 시트 */
.av-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.42);
  animation: av-fade 0.18s var(--ease);
}

.av-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  display: flex;
  flex-direction: column;
  max-height: 86dvh;
  padding: 0 var(--page-x) calc(var(--safe-bottom) + 12px);
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  transform: translateY(100%);
  transition: transform 0.22s var(--ease);
}

.av-sheet.is-open {
  transform: translateY(0);
}

.av-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 8px;
}

.av-sheet-head h2 {
  font-size: var(--text-title);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}

.av-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 8px 0 16px;
}

.av-sheet-foot {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-weak);
}

.av-sheet-foot .av-btn {
  flex: 1;
}

.av-sheet-foot .av-btn--secondary {
  flex: 0 0 96px;
}

.av-filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.av-filter-label {
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--text-weak);
}

.av-filter-pair {
  display: flex;
  gap: 8px;
}

.av-filter-pair > * {
  flex: 1;
  min-width: 0;
}

.av-filter-pair .av-input {
  max-width: none;
}

.av-filter-pair .av-select {
  width: 100%;
}

/* 선택된 지역 칩 */
.av-selected-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.av-region-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--blue-weak);
  font-size: var(--text-micro);
  font-weight: 700;
  color: var(--blue);
}

.av-region-chip span {
  font-size: 10px;
  opacity: 0.75;
}

/* 지역 선택기 */
.av-picker-back {
  align-self: flex-start;
}

.av-picker-sidos {
  margin: 0 calc(var(--page-x) * -1);
  padding: 0 var(--page-x);
}

.av-check-list {
  display: flex;
  flex-direction: column;
  max-height: 44dvh;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  background: var(--surface-sub);
}

.av-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 14px;
  font-size: var(--text-body);
  color: var(--text-strong);
  text-align: left;
  border-bottom: 1px solid var(--line-weak);
}

.av-check-row:last-child {
  border-bottom: none;
}

.av-check-all {
  font-weight: 700;
}

.av-check-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  color: transparent;
}

.av-check-box.is-on {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.av-check-count {
  margin-left: auto;
  font-size: var(--text-micro);
  font-weight: 600;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* 로그인 진단 결과 */
.av-diag {
  max-height: 320px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--surface-sub);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-sub);
}
