:root {
  --bg: #f6f7f9;
  --fg: #1f2933;
  --muted: #687385;
  --line: #d9dee7;
  --soft: #eef1f5;
  --card: #fff;
  --primary: #176b87;
  --primary-dark: #0f4f64;
  --danger: #c93535;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", Arial, sans-serif; background: var(--bg); color: var(--fg); font-size: 14px; line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 24px; background: #24313a; color: white; }
.topbar nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.topbar a { color: white; padding: 7px 8px; border-radius: 6px; }
.topbar a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.brand a { font-weight: 800; white-space: nowrap; }
.container { width: min(1440px, 100%); margin: 20px auto; padding: 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(24,39,75,.04); }
h1, h2 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); line-height: 1.6; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.stack { display: grid; gap: 12px; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; font: inherit; color: var(--fg); background: white; }
textarea { resize: vertical; overflow-wrap: anywhere; }
.checkbox { display: flex; align-items: center; gap: 8px; }
.checkbox input { width: auto; }
button, .button { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 38px; background: var(--primary); color: white; border: 0; border-radius: 6px; padding: 9px 13px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .button:hover { background: var(--primary-dark); text-decoration: none; }
.button.secondary, button.secondary { background: #6f7785; }
.button.secondary:hover, button.secondary:hover { background: #555e6b; }
button.danger, .button.danger { background: var(--danger); color: white; }
button.danger:hover, .button.danger:hover { background: #9f2727; }
.table-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 960px; background: white; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 9px; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
th { background: var(--soft); font-size: 13px; color: #374151; }
tr:last-child td { border-bottom: 0; }
td small { color: var(--muted); }
.badge { display: inline-block; background: #e4f3f5; color: #0f4f64; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.off { background: #f0f2f5; color: #4b5563; }
.badge.err { background: #fee2e2; color: #991b1b; }
details { margin-top: 4px; color: var(--muted); font-size: 13px; max-width: 520px; }
summary { cursor: pointer; }
.empty { text-align: center; padding: 32px; color: var(--muted); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.45; }
code { background: #f3f4f6; border: 1px solid var(--line); padding: 1px 4px; border-radius: 4px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions.vertical { align-items: stretch; flex-direction: column; }
.actions form { margin: 0; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-actions form { margin: 0; }
.secondary-btn { background: #6f7785; }
.danger-btn { background: var(--danger); }
.danger-btn:hover { background: #9f2727; }
.breakable { word-break: break-all; }
.subtle { background: #f9fafb; }
td .code { width: 320px; max-width: 100%; min-height: 120px; }
.card.subtle { background: #f8fafc; }

@media (max-width: 1000px) {
  .grid.two { grid-template-columns: 1fr; }
  table { min-width: 860px; }
}

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; padding: 10px 14px; }
  .topbar nav { justify-content: flex-start; }
  .container { margin: 14px auto; padding: 0 12px; }
  .card { padding: 14px; }
  .filters { grid-template-columns: 1fr; }
  button, .button { width: 100%; white-space: normal; }
  .table-wrap { overflow-x: visible; border: 0; border-radius: 0; }
  table { min-width: 0; border-collapse: separate; border-spacing: 0 10px; background: transparent; }
  thead { display: none; }
  tbody, tr, td { display: block; width: 100%; }
  tr { background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
  tr { padding: 12px; }
  td { border-bottom: 0; padding: 3px 0; }
  td::before { content: none; }
  td[data-label="출처"] { display: flex; align-items: center; gap: 8px; }
  td[data-label="출처"] br { display: none; }
  td[data-label="지역/단지"] { padding-top: 8px; }
  td[data-label="지역/단지"] strong { font-size: 16px; }
  td[data-label="전용"],
  td[data-label="금액"],
  td[data-label="준공"],
  td[data-label="세대수"],
  td[data-label="층"] { display: inline-block; margin-right: 12px; }
  td[data-label="전용"]::after { content: " 전용"; color: var(--muted); font-size: 12px; }
  td[data-label="준공"]::before { content: "준공 "; color: var(--muted); font-size: 12px; font-weight: 700; }
  td[data-label="세대수"]::before { content: "세대수 "; color: var(--muted); font-size: 12px; font-weight: 700; }
  td[data-label="층"]::before { content: "층 "; color: var(--muted); font-size: 12px; font-weight: 700; }
  td[data-label="중개/연락"],
  td[data-label="최근 갱신"],
  td[data-label="원문"] { color: var(--muted); font-size: 12px; }
  td.empty { display: block; border: 1px solid var(--line); border-radius: 8px; }
  td.empty::before { content: none; }
  td details { max-width: 100%; }
}
