/* 竹北市實價登錄查詢 — 淺色背景、高對比、大字；海軍藍 #1d2b4a ＋ 金 #c9a96a 僅作點綴 */
:root {
  --navy: #1d2b4a; --navy-soft: #2a3a5e;
  --gold: #c9a96a; --gold-soft: #f3ead8; --bronze: #7a5716;
  --paper: #faf8f4; --card: #ffffff; --line: #ddd5c6; --line-soft: #ece6da;
  --ink: #1a2133; --ink-2: #3d4558; --muted: #565e70;
  --up: #b42318; --down: #17663a;
  --radius: 8px;
  --sans: "Noto Sans TC", "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 18px; line-height: 1.65; color: var(--ink); background: var(--paper); }
a { color: var(--navy); }
h1, h2 { margin: 0; }
.wrap { max-width: 1560px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: 8px 14px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- header ---------- */
.site-header { background: #fff; border-bottom: 4px solid var(--gold); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 14px; }
.site-header h1 { font-size: 30px; line-height: 1.3; letter-spacing: .04em; }
.site-header h1 a { color: var(--navy); text-decoration: none; }
.site-header .meta { margin: 4px 0 0; font-size: 16px; color: var(--ink-2); }
.header-contact { display: flex; gap: 10px; flex-shrink: 0; }
.btn-line, .btn-tel { display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px; border-radius: var(--radius); font-weight: 700; font-size: 17px; text-decoration: none; white-space: nowrap; }
.btn-line { background: var(--navy); color: #fff; }
.btn-tel { border: 2px solid var(--gold); color: var(--navy); background: #fff; }

main { padding-top: 20px; padding-bottom: 28px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }

/* ---------- search ---------- */
.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 20px; padding: 12px 14px; border: 2px solid #b9ae98; border-radius: var(--radius); color: var(--ink); background: #fff; }
.search-row input:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(201,169,106,.45); }
.btn-primary { font: inherit; font-size: 19px; font-weight: 700; padding: 0 30px; min-height: 52px; border: 0; border-radius: var(--radius); background: var(--navy); color: #fff; cursor: pointer; letter-spacing: .1em; }
.btn-primary:hover { background: var(--navy-soft); }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-top: 14px; }
.field { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; color: var(--ink-2); }
select { font: inherit; font-size: 17px; color: var(--ink); padding: 8px 34px 8px 12px; min-height: 46px; border: 1.5px solid #b9ae98; border-radius: var(--radius); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231d2b4a' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center; -webkit-appearance: none; appearance: none; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; color: var(--ink-2); cursor: pointer; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--navy); }
.chips { margin-top: 10px; font-size: 17px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { font: inherit; font-size: 17px; border: 1.5px solid var(--gold); background: #fff; color: var(--navy); border-radius: 999px; padding: 4px 16px; cursor: pointer; min-height: 40px; }
.chip:hover, .chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.hint { margin: 8px 0 0; font-size: 16px; color: var(--muted); }

/* ---------- loading ---------- */
.loading { margin-top: 16px; display: flex; align-items: center; gap: 14px; font-size: 18px; color: var(--ink-2); }
.loading.error { border-color: var(--up); color: var(--up); }
.loading[hidden] { display: none; }
.spinner { width: 26px; height: 26px; border: 4px solid var(--gold-soft); border-top-color: var(--navy); border-radius: 50%; animation: spin .9s linear infinite; flex-shrink: 0; }
.loading.error .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.panel { order: -1; }
@media (min-width: 1800px) {
  .wrap { max-width: 1840px; }
  .layout { grid-template-columns: minmax(0, 1fr) 460px; align-items: start; }
  .panel { order: 2; position: sticky; top: 12px; }
}
.card h2 { font-size: 22px; color: var(--navy); margin-bottom: 10px; padding-left: 12px; border-left: 5px solid var(--gold); line-height: 1.3; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.list-head h2 { margin-bottom: 8px; }
.sort-field { display: none; margin-bottom: 8px; }
.status .sub { font-size: 16px; color: var(--muted); }
.site-header .seg { white-space: nowrap; }
.site-header .sep { color: var(--gold); margin: 0 4px; }
.nw { white-space: nowrap; }
.status { font-size: 17px; color: var(--ink-2); margin-bottom: 10px; }
.status b { color: var(--ink); }
.note { font-size: 16px; color: var(--muted); line-height: 1.6; margin: 10px 0 0; }
.note sup, td sup { color: var(--bronze); }

/* ---------- table (desktop) ---------- */
.tablewrap { overflow: auto; max-height: 78vh; border: 1px solid var(--line-soft); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th { position: sticky; top: 0; z-index: 1; background: #f1ece3; color: var(--navy); cursor: pointer; white-space: nowrap; padding: 10px 10px; text-align: left; user-select: none; font-weight: 700; border-bottom: 2px solid var(--gold); }
th.nosort { cursor: default; }
th:not(.nosort):hover { background: #e8e0d0; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; vertical-align: top; }
td.num, th.num { text-align: right; }
td.addr { white-space: normal; min-width: 210px; }
td.proj { white-space: normal; min-width: 110px; }
td.tags { white-space: normal; min-width: 120px; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #f7f3ea; }
tr.sel td { background: #fbefd2 !important; }
tr.excl td { color: #6b7280; }
td .sub { font-size: 14px; color: var(--muted); }
.up { color: var(--up); font-weight: 700; } .down { color: var(--down); font-weight: 700; }
.tag { display: inline-block; font-size: 14px; line-height: 1.5; padding: 1px 8px; border-radius: 999px; margin: 1px 4px 1px 0; background: #eef0f4; color: #3d4558; white-space: nowrap; }
.tag.warn { background: #fdecea; color: #9b1c1c; }
.tag.pre { background: #e7ecf6; color: var(--navy); font-weight: 700; }
.more { display: block; margin: 14px auto 0; font: inherit; font-size: 17px; padding: 10px 26px; border: 2px solid var(--navy); color: var(--navy); background: #fff; border-radius: var(--radius); cursor: pointer; font-weight: 700; }

/* ---------- cards (mobile) ---------- */
.cards { list-style: none; margin: 0; padding: 0; }
.tx { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: #fff; cursor: pointer; }
.tx.sel { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); background: #fffaf0; }
.tx.excl { background: #f8f8f8; }
.tx .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 16px; color: var(--ink-2); }
.tx .addr { font-size: 18px; font-weight: 700; color: var(--ink); margin-top: 2px; line-height: 1.45; word-break: break-all; }
.tx .proj { font-size: 17px; color: var(--navy); }
.tx .prices { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; align-items: baseline; }
.tx .price-unit { font-size: 22px; font-weight: 800; color: var(--navy); }
.tx .price-unit small, .tx .price-total small { font-size: 15px; font-weight: 400; color: var(--ink-2); }
.tx .price-total { font-size: 18px; font-weight: 700; }
.tx .specs { font-size: 16px; color: var(--ink-2); margin-top: 4px; }
.tx .basis, .tx .remark { font-size: 15px; color: var(--muted); margin-top: 4px; }
.tx.excl .addr, .tx.excl .price-unit { color: #555c6b; }

/* ---------- panel ---------- */
.panel .gname { font-size: 20px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 17px; color: var(--ink-2); }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 900px) and (max-width: 1799px) { .panel-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px; } }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.stat { background: #f7f4ee; border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px 12px; }
.stat .k { font-size: 15px; color: var(--muted); }
.stat .v { font-size: 19px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.stat.hero { grid-column: 1 / -1; background: var(--navy); border-color: var(--navy); }
.stat.hero .k { color: #d9dfea; }
.stat.hero .v { color: #fff; font-size: 30px; }
.stat.hero .v small { font-size: 17px; font-weight: 400; color: var(--gold); margin-left: 4px; }
.callout { font-size: 16px; background: var(--gold-soft); border-left: 4px solid var(--gold); padding: 8px 12px; border-radius: 4px; margin: 8px 0; line-height: 1.6; }
.chart-title { font-size: 17px; font-weight: 700; color: var(--navy); margin: 4px 0 4px; }

/* chart */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--sans); fill: #3d4558; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 15px; color: var(--ink-2); margin-top: 4px; justify-content: center; }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 6px; }
.legend i.dash { border-top-style: dashed; }
.legend i.bar { height: 12px; border: 0; background: #e6dbc4; width: 14px; }
.tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(29,43,74,.15); border-radius: 6px; padding: 8px 12px; font-size: 15px; line-height: 1.5; white-space: nowrap; z-index: 2; }
.tip b { color: var(--navy); }

/* ---------- footer ---------- */
.site-footer { background: #fff; border-top: 4px solid var(--gold); margin-top: 12px; }
.footer-inner { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px; padding-top: 24px; padding-bottom: 36px; }
.site-footer h2 { font-size: 20px; color: var(--navy); margin-bottom: 8px; }
.site-footer p { margin: 0 0 8px; font-size: 16px; color: var(--ink-2); }
.site-footer .disclaimer { font-weight: 700; color: var(--ink); background: var(--gold-soft); padding: 8px 12px; border-radius: 4px; }
.footer-contact .org { font-weight: 700; color: var(--ink); }
.footer-contact .person { font-size: 22px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.footer-contact .tel { font-size: 22px; font-weight: 700; text-decoration: none; }
.footer-contact a { font-size: 17px; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .wrap { padding: 0 14px; }
  .header-inner { flex-direction: column; align-items: stretch; gap: 10px; padding-top: 12px; }
  .site-header h1 { font-size: 25px; }
  .site-header .meta { font-size: 15px; }
  .header-contact a { flex: 1; justify-content: center; }
  .card { padding: 14px; }
  .search-row input { font-size: 18px; }
  .btn-primary { padding: 0 18px; }
  .filter-row { gap: 10px; }
  .field { width: 100%; justify-content: space-between; }
  .field select { flex: 1; max-width: 72%; }
  .has-results .sort-field { display: inline-flex; width: auto; }
  .sort-field select { max-width: none; }
  .footer-inner { grid-template-columns: 1fr; gap: 16px; }
  .card h2 { font-size: 21px; }
}
td.tags .tag { white-space: normal; }
@media (max-width: 1360px), (min-width: 1800px) and (max-width: 1960px) { th, td { padding-left: 6px; padding-right: 6px; } td.addr { min-width: 180px; } }
@media (max-width: 760px) { .site-header .sep { display: none; } .site-header .seg { display: block; } }
