/* 디자인 토큰: Minimalism & Swiss(데이터 밀집형). 색은 보조 수단이고 숫자·글자를 항상 함께 표시한다. */
:root {
  color-scheme: light;
  --bg: #f4f6f8; --fg: #0f172a; --muted: #5b6577; --line: #e3e8ee; --line-strong: #cfd7e1;
  --card: #fff; --head: #0f2a3a; --head-fg: #e8f1f5;
  --primary: #0f766e; --primary-fg: #fff; --primary-soft: #e6f4f2;
  --accent: #0369a1;
  --low: #047857; --low-bg: #dcfce7;     /* 감정가 대비 50% 이하 */
  --mid: #0369a1; --mid-bg: #e0f2fe;     /* 50~70% */
  --high: #475569; --high-bg: #eef2f6;   /* 70% 초과 */
  --warn: #b45309; --warn-bg: #fef3c7;
  --urgent: #b91c1c; --urgent-bg: #fee2e2;
  --ring: #0f766e;
  --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 1px 1px rgb(15 23 42 / .04);
  --radius: 10px;
  font-family: Pretendard, "Pretendard Variable", system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1117; --fg: #e6edf3; --muted: #9aa7b6; --line: #1f2a35; --line-strong: #2c3a48;
    --card: #111a22; --head: #0a1f2b; --head-fg: #e6edf3;
    --primary: #2dd4bf; --primary-fg: #04201d; --primary-soft: #0f2e2b;
    --accent: #7cc4fa;
    --low: #4ade80; --low-bg: #0f2e1d;
    --mid: #7cc4fa; --mid-bg: #0c2638;
    --high: #b6c2cf; --high-bg: #1a2530;
    --warn: #fbbf24; --warn-bg: #33260a;
    --urgent: #fca5a5; --urgent-bg: #3a1414;
    --ring: #2dd4bf;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted, .empty { color: var(--muted); }

/* ---- 머리글 ---- */
.top { position: sticky; top: 0; z-index: 10; background: var(--head); color: var(--head-fg); }
.top-in { max-width: 1280px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 10px 16px; }
.top h1 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.top h1 a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.top h1 svg { width: 24px; height: 24px; color: #2dd4bf; flex: none; }
.top h1 small { font-weight: 500; font-size: 12px; opacity: .65; }
.tabs { display: flex; gap: 2px; background: rgb(255 255 255 / .08); padding: 3px; border-radius: 999px; }
.tabs button { border: 0; background: transparent; color: inherit; opacity: .8; padding: 6px 16px; min-height: 34px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; transition: background-color .15s, opacity .15s; }
.tabs button:hover { opacity: 1; }
.tabs button[aria-selected="true"] { background: #fff; color: #0f2a3a; opacity: 1; }
.asof { margin: 0 0 0 auto; font-size: 12px; opacity: .7; }

/* ---- 필터 ---- */
main { max-width: 1280px; margin: 0 auto; padding: 16px 16px 32px; }
.filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px 6px; }
.filters fieldset { display: flex; flex-wrap: wrap; gap: 10px 12px; border: 0; padding: 0; margin: 0 0 10px; }
.filters fieldset + fieldset { border-top: 1px dashed var(--line); padding-top: 12px; }
body[data-tab="listings"] fieldset[data-tab="results"], body[data-tab="results"] fieldset[data-tab="listings"] { display: none; }
.filters label { display: flex; flex-direction: column; font-size: 12px; font-weight: 600; color: var(--muted); gap: 4px; }
.filters label.wide { flex: 1 1 260px; }
.filters label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--fg); align-self: flex-end; min-height: 38px; cursor: pointer; }
.filters input, .filters select { font: inherit; font-size: 14px; height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); color: var(--fg); min-width: 120px; transition: border-color .15s, box-shadow .15s; }
.filters input:hover, .filters select:hover { border-color: var(--muted); }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.filters input[type="number"] { width: 130px; min-width: 0; }
.filters input[type="checkbox"] { width: 18px; height: 18px; min-width: 0; padding: 0; accent-color: var(--primary); flex: none; }
.listbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 2px 8px; }
.summary { color: var(--muted); margin: 0; font-size: 14px; }
.psize { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.psize select { font: inherit; font-size: 14px; height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); color: var(--fg); cursor: pointer; }
.summary strong { color: var(--fg); font-size: 18px; margin-right: 1px; }

/* ---- 목록 ---- */
#list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
#list:has(> .empty) { padding: 40px 16px; text-align: center; }
#list:empty { display: none; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list th { background: var(--card); font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom-color: var(--line-strong); }
table.list .r { text-align: right; }
table.list .c { text-align: center; }
table.list td { font-size: 14px; }
/* 한 줄 고정: 물건 칸이 남는 폭을 차지하고 넘치면 …로 자른다(전체 이름은 title과 상세 창). */
table.list td { white-space: nowrap; }
table.list td.namecol { width: 100%; max-width: 0; }
.namecell { display: flex; align-items: center; gap: 6px; min-width: 0; }
.namecell .name { overflow: hidden; text-overflow: ellipsis; margin-right: 0; }
.namecell .chip { flex: none; }
table.list tbody tr { cursor: pointer; transition: background-color .12s; }
table.list tbody tr:hover { background: var(--primary-soft); }
table.list tbody tr:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; background: var(--primary-soft); }
.name { font-weight: 600; }
.price { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.deadline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.chip { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; line-height: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; vertical-align: 1px; }
.chip.t-low { color: var(--low); background: var(--low-bg); }
.chip.t-mid { color: var(--mid); background: var(--mid-bg); }
.chip.t-high { color: var(--high); background: var(--high-bg); }
.chip.warn { color: var(--warn); background: var(--warn-bg); }
.chip.urgent { color: var(--urgent); background: var(--urgent-bg); }
.chip.info { color: var(--accent); background: var(--mid-bg); }
.chip.muted { color: var(--muted); background: var(--high-bg); font-weight: 600; }

.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 20px 0; }
.pager button { font: inherit; font-size: 14px; min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); background: var(--card); color: var(--fg); border-radius: 8px; cursor: pointer; font-variant-numeric: tabular-nums; transition: border-color .15s, background-color .15s; }
.pager button:hover:not(:disabled) { border-color: var(--primary); }
.pager button.cur { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); font-weight: 700; }
.pager button:disabled:not(.cur) { opacity: .4; cursor: default; }

/* ---- 상세 ---- */
dialog.item { width: min(880px, 100vw - 24px); max-height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: 14px; padding: 24px; background: var(--card); color: var(--fg); box-shadow: 0 20px 50px rgb(0 0 0 / .25); }
dialog.item::backdrop { background: rgb(8 15 25 / .55); }
dialog.item .close { position: sticky; top: 0; float: right; font: inherit; font-size: 14px; height: 36px; border: 1px solid var(--line-strong); background: var(--card); color: var(--fg); border-radius: 8px; padding: 0 14px; cursor: pointer; }
dialog.item .close:hover { border-color: var(--primary); }
dialog.item h2 { margin: 4px 0 16px; font-size: 20px; line-height: 1.35; padding-right: 72px; letter-spacing: -0.01em; }
dialog.item h3 { margin: 24px 0 8px; font-size: 14px; color: var(--muted); font-weight: 700; }
.sub { margin: 0; color: var(--muted); font-size: 13px; padding-right: 72px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 0 0 12px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.tile strong { font-size: 18px; }
.tile .chip { align-self: flex-start; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 16px 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
table.mini { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
table.mini th, table.mini td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; }
table.mini th { color: var(--muted); font-weight: 600; font-size: 12px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 12px 0; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--line); display: block; }
.pre { white-space: pre-wrap; margin: 0; font-size: 14px; }
.cta { margin: 24px 0 0; }
.cta a { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 8px; background: var(--primary); color: var(--primary-fg); font-weight: 700; text-decoration: none; }
.cta a:hover { filter: brightness(1.08); }

.foot { max-width: 1280px; margin: 0 auto; padding: 20px 16px 32px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- 휴대폰: 표 → 카드 ---- */
@media (max-width: 640px) {
  .top-in { gap: 8px 12px; }
  .asof { margin-left: 0; width: 100%; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; min-height: 40px; }
  .filters { padding: 12px 12px 4px; }
  .filters fieldset { gap: 10px; }
  .filters label { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .filters label.wide { flex-basis: 100%; }
  .filters input, .filters select, .filters input[type="number"] { width: 100%; min-width: 0; height: 44px; font-size: 16px; }
  .filters label.check { flex: 1 1 100%; white-space: nowrap; align-self: auto; min-height: 44px; }
  #list { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; padding: 10px 0; }
  table.list td, table.list td.r, table.list td.c { border: 0; padding: 3px 14px; text-align: left; white-space: normal; }
  table.list td.namecol { max-width: none; }
  .namecell .name { white-space: normal; overflow-wrap: anywhere; }
  table.list td::before { content: attr(data-label); display: inline-block; min-width: 72px; color: var(--muted); font-size: 12px; }
  table.list td:first-child::before, table.list td[data-label="물건"]::before { display: none; }
  table.list td[data-label="물건"] { padding-bottom: 6px; font-size: 15px; }
  dialog.item { padding: 18px; }
  dialog.item h2 { font-size: 18px; }
}

/* 낙찰 전망 */
.outlook { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; margin: 14px 0; background: var(--bg); }
.outlook h3 { margin-top: 0; }
.outlook p { margin: 6px 0; line-height: 1.55; }
.outlook .small { font-size: 12px; }
