:root {
  color-scheme: light;
  --navy: #172554;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --ink: #172033;
  --muted: #687386;
  --line: #e5eaf1;
  --surface: #fff;
  --bg: #f5f7fb;
  --danger: #dc2626;
  --success: #047857;
  font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--ink); background: var(--bg); min-height: 100vh; padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-header { position: sticky; top: 0; z-index: 20; background: linear-gradient(145deg, var(--navy), #1e3a8a); color: #fff; padding: max(14px, env(safe-area-inset-top)) 16px 16px; box-shadow: 0 8px 30px rgba(23, 37, 84, .18); }
.brand-row, .list-heading, .page-title, .detail-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #fff; color: var(--navy); font-weight: 900; }
.brand strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.brand small { display: block; opacity: .72; font-size: 11px; margin-top: 1px; }
.search-bar { display: flex; gap: 8px; margin-top: 14px; }
.search-bar input { min-width: 0; flex: 1; border: 0; border-radius: 12px; padding: 12px 14px; outline: 0; }
.search-bar button { border: 0; border-radius: 12px; padding: 0 16px; background: #facc15; color: #422006; font-weight: 800; }

main { width: min(100%, 820px); margin: 0 auto; }
.view { display: none; padding: 16px; }
.view.active { display: block; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.summary-grid > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; box-shadow: 0 3px 12px rgba(15, 23, 42, .04); }
.summary-grid strong { display: block; font-size: 20px; color: var(--navy); }
.summary-grid span { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }

.category-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 10px; scrollbar-width: none; }
.category-scroll::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #475569; padding: 9px 14px; font-weight: 700; }
.chip.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.filter-panel { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.filter-panel select { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px; background: #fff; }
.outline-button { border: 1px solid #93c5fd; border-radius: 10px; padding: 9px 12px; background: var(--blue-soft); color: #1d4ed8; font-weight: 800; white-space: nowrap; }

.list-heading { margin: 20px 0 10px; }
h1 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.list-heading span, .muted { color: var(--muted); font-size: 13px; }
.auction-list { display: grid; gap: 12px; }
.auction-card { display: grid; grid-template-columns: 118px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 5px 20px rgba(15, 23, 42, .05); }
.auction-card:active { transform: scale(.995); }
.card-image { position: relative; min-height: 168px; overflow: hidden; background: linear-gradient(145deg, #dbeafe, #e0e7ff); }
.card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.category-placeholder { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; text-align: center; color: var(--navy); font-weight: 900; }
.category-placeholder span { font-size: 34px; }
.card-body { min-width: 0; padding: 13px; }
.badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.badge { border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 800; background: var(--blue-soft); color: #1d4ed8; }
.badge.status-sold, .badge.status-reauction { background: #fff7ed; color: #c2410c; }
.badge.status-failed { background: #fef2f2; color: #b91c1c; }
.case-number { margin-left: auto; color: var(--muted); font-size: 11px; }
.card-title { margin: 9px 0 5px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-address { min-height: 34px; margin: 0; color: #566173; font-size: 12px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price-row { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-top: 10px; }
.price-row strong { color: var(--danger); font-size: 17px; }
.price-row small { color: var(--muted); }
.date-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: #475569; }
.load-more { width: 100%; margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; font-weight: 800; }
.empty-state { padding: 44px 20px; border: 1px dashed #cbd5e1; border-radius: 16px; background: #fff; color: var(--muted); text-align: center; }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 820px); display: grid; grid-template-columns: repeat(3, 1fr); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.bottom-nav button { border: 0; background: transparent; color: #7b8494; font-size: 11px; font-weight: 700; }
.bottom-nav span { display: block; font-size: 21px; line-height: 1.1; }
.bottom-nav button.active { color: var(--blue); }

.page-title { margin-bottom: 16px; }
.stack-list { display: grid; gap: 10px; }
.stack-item { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 14px; }
.stack-item p { margin: 6px 0; line-height: 1.5; }
.stack-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.text-button, .icon-button { border: 0; padding: 7px; background: transparent; color: inherit; font-weight: 800; text-decoration: none; }

.detail-dialog { width: min(100%, 820px); height: 100dvh; max-width: none; max-height: none; margin: 0 auto; padding: 0; border: 0; background: var(--bg); }
.detail-dialog::backdrop { background: rgba(15, 23, 42, .54); }
.detail-shell { min-height: 100%; }
.detail-header { position: sticky; top: 0; z-index: 5; height: 58px; padding: 0 12px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(12px); }
.detail-content { padding: 14px 14px 36px; }
.detail-hero { overflow: hidden; border-radius: 18px; background: #dbeafe; aspect-ratio: 16 / 10; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-title { margin: 15px 0 4px; font-size: 21px; }
.detail-meta { color: var(--muted); font-size: 13px; }
.detail-price { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.detail-price div { border: 1px solid var(--line); border-radius: 13px; background: #fff; padding: 12px; }
.detail-price span { display: block; color: var(--muted); font-size: 11px; }
.detail-price strong { display: block; margin-top: 4px; font-size: 17px; }
.detail-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 18px 0 10px; }
.detail-tabs button { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 9px 11px; font-size: 12px; font-weight: 800; }
.detail-tabs button.active { background: var(--navy); color: #fff; }
.detail-panel { display: none; }
.detail-panel.active { display: block; }
.info-card { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 14px; }
.info-card h3 { margin: 0 0 10px; font-size: 15px; }
.info-table { display: grid; grid-template-columns: 100px 1fr; gap: 8px 12px; margin: 0; font-size: 13px; line-height: 1.5; }
.info-table dt { color: var(--muted); }
.info-table dd { margin: 0; word-break: break-word; }
.timeline { display: grid; gap: 9px; }
.timeline-item { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding-left: 12px; border-left: 3px solid #bfdbfe; }
.document-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.document-grid button { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 14px 9px; font-weight: 800; }
.ai-box { border: 1px solid #c7d2fe; border-radius: 14px; background: #eef2ff; padding: 14px; }
.ai-box ul { padding-left: 18px; }
.primary-button { width: 100%; border: 0; border-radius: 12px; padding: 13px; background: var(--blue); color: #fff; font-weight: 900; }
.skeleton { min-height: 90px; border-radius: 14px; background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 90px; transform: translate(-50%, 18px); max-width: calc(100% - 32px); padding: 11px 15px; border-radius: 11px; background: #111827; color: #fff; opacity: 0; pointer-events: none; transition: .2s; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .filter-panel .outline-button { grid-column: 1 / -1; }
}

@media (min-width: 720px) {
  .auction-list { grid-template-columns: 1fr 1fr; }
  .auction-card { grid-template-columns: 120px minmax(0, 1fr); }
}
