:root {
  color-scheme: light;
  font-family: "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  color: #142b40;
  background: #f1f5f8;
  font-size: 100%;
  --ink: #142b40;
  --muted: #506678;
  --line: #d8e2ea;
  --teal: #00665c;
  --navy: #112b40;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #1f8c84; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.125rem; letter-spacing: .04em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
.shell { width: min(100% - 3rem, 93rem); margin-inline: auto; }
.masthead { background: var(--navy); color: #fff; border-bottom: 3px solid #319a8b; }
.masthead-inner, .brand { display: flex; align-items: center; gap: .8rem; }
.masthead-inner { min-height: 4.3rem; justify-content: space-between; }
.byline { margin-top: .2rem; color: #c4dbe5; font-size: .82rem; }
.brand-icon {
  display: grid; place-items: center; width: 2.15rem; aspect-ratio: 1; border-radius: .55rem;
  background: #b9e6dd; color: #133d3b; font-size: .95rem; font-weight: 800;
}
main { padding-block: 1.75rem 3.5rem; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: .85rem; }
.gate { max-width: 27rem; margin: clamp(1rem, 11vh, 8rem) auto 0; padding: 2rem; }
.gate h2 { font-size: 1.45rem; margin-bottom: 1.3rem; }
.gate label { margin-bottom: .45rem; }
.gate .button { width: 100%; margin-top: .9rem; }
.gate-status { margin-top: .75rem; min-height: 1.4rem; color: #963c30; }
.overview {
  display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: .7rem 1.5rem;
  border: 1px solid #bbd9d4; border-radius: .85rem; padding: 1rem 1.4rem 1.2rem; background: #e5f3ef;
  margin-bottom: 1rem;
}
.count-label { color: #285552; font-weight: 650; font-size: .91rem; }
.count { line-height: 1.12; color: #123f3c; font-size: 1rem; margin-top: .3rem; }
.count strong { font-size: clamp(2.15rem, 5vw, 3.15rem); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.data-date { color: #365c5a; font-size: .875rem; }
.data-date time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.filters { margin-bottom: 1rem; padding: 1.2rem 1.4rem; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.panel-heading > span { color: var(--muted); font-size: .86rem; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .95rem; margin-top: 1rem; }
.wide { grid-column: span 2; }
label, legend { color: #243d54; font-size: .9rem; font-weight: 650; }
label { display: block; min-width: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: .35rem; }
label > input, label > select { display: block; margin-top: .35rem; }
input, select {
  min-width: 0; width: 100%; height: 2.55rem; padding: .45rem .62rem;
  border: 1px solid #bbcad6; border-radius: .45rem; background: #fff; color: var(--ink); font-weight: 400;
}
input::placeholder { color: #617589; opacity: 1; }
select {
  appearance: none; padding-right: 1.55rem;
  background-image: linear-gradient(45deg, transparent 50%, #496373 50%), linear-gradient(135deg, #496373 50%, transparent 50%);
  background-position: calc(100% - 14px) 53%, calc(100% - 9px) 53%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.range, .actions, .pager, .id-group { display: flex; align-items: center; gap: .45rem; }
.range span { flex: none; color: var(--muted); font-size: .82rem; }
.actions { flex-wrap: wrap; gap: .55rem; margin-top: 1rem; }
#filter-status { color: #963c30; font-size: .88rem; }
.button {
  border: 1px solid transparent; border-radius: .45rem; min-height: 2.4rem; padding: .4rem .75rem;
  font-size: .9rem; font-weight: 650; white-space: nowrap;
}
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover { background: #00554d; }
.button-secondary { background: #f0f5f8; color: #233e54; border-color: #ccdbe4; }
.button-secondary:hover:not(:disabled) { background: #e0ebf1; }
.button-outline { background: transparent; border-color: #6d899c; color: #fff; }
.button-outline:hover { background: #203f55; }
.results > .panel-heading { padding: .95rem 1.4rem; }
.page-size { display: flex; align-items: center; white-space: nowrap; gap: .4rem; }
.page-size select { width: auto; height: 2rem; margin: 0; padding-block: .1rem; }
.table-wrap { overflow-x: auto; }
.cards { display: none; }
table { width: 100%; border-collapse: collapse; font-size: .91rem; }
thead { background: #eaf0f5; color: #2e4b60; text-align: left; }
th, td { padding: .66rem .75rem; border-bottom: 1px solid #e0e8ee; vertical-align: middle; }
th, td:not(.address) { white-space: nowrap; }
th:first-child, td:first-child { padding-left: 1.4rem; }
th:last-child, td:last-child { padding-right: 1.4rem; }
td.address { min-width: 18rem; }
.address div + div { margin-top: .25rem; }
tbody tr:hover { background: #f5fafb; }
.numeric, .id-group { font-variant-numeric: tabular-nums; }
.id-group { gap: .65rem; }
.id-group span { font-weight: 650; }
.copy {
  border: 1px solid #b5d6d0; border-radius: .35rem; background: #eaf6f3;
  color: #075d53; font-size: .82rem; font-weight: 700; padding: .32rem .5rem;
}
.copy:hover { background: #d7eee9; }
.empty { color: var(--muted); text-align: center; padding-block: 2rem; }
.pagination {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: .6rem; padding: .8rem 1.4rem; color: var(--muted); font-size: .88rem;
}
.pager, #jump { display: flex; align-items: center; flex-wrap: wrap; gap: .3rem; }
#page { width: 4.6rem; height: 2.4rem; }
dialog {
  width: min(100% - 2rem, 38rem); max-height: 85vh; border: 1px solid var(--line);
  border-radius: .85rem; color: var(--ink); padding: 1.3rem;
}
dialog::backdrop { background: #0d2639aa; }
.dialog-title { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem .75rem; }
dt { font-weight: 650; }
dd { margin: 0; overflow-wrap: anywhere; }
dialog ul { margin-bottom: 0; padding-inline-start: 1.25rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 900px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .shell { width: min(100% - 1.2rem, 93rem); }
  main { padding-top: 1rem; }
  .filters, .overview, .results > .panel-heading, .pagination { padding-inline: .75rem; }
  .filter-grid { gap: .8rem .65rem; }
  input, select { font-size: 1rem; height: 2.75rem; }
  .button, .copy { min-height: 2.75rem; }
  .gate { padding: 1.3rem; }
  .actions { display: grid; grid-template-columns: 1.4fr 1fr; }
  #filter-status { grid-column: 1 / -1; }
  #filter-status:empty { display: none; }
  .page-size select { min-height: 2.75rem; }
  .table-wrap { display: none; }
  .cards {
    display: grid; list-style: none; gap: .65rem; margin: 0; padding: 0 .75rem;
  }
  .building-card {
    padding: .85rem; border: 1px solid var(--line); border-radius: .65rem;
    background: #fbfdfe;
  }
  .card-addresses { font-weight: 750; line-height: 1.45; overflow-wrap: anywhere; }
  .card-addresses p + p { margin-top: .25rem; }
  .card-key {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .25rem .7rem; padding: .3rem 0; color: #21455d; font-size: .9rem;
  }
  .card-key .id-group { gap: .5rem; }
  .card-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .62rem .75rem;
    border-top: 1px solid #e0e8ee; margin: .2rem 0 .5rem; padding-top: .65rem;
  }
  .card-fields dt { color: var(--muted); font-size: .875rem; }
  .card-fields dd { margin-top: .14rem; min-height: 1.2em; }
  .card-footer { display: flex; justify-content: flex-end; }
  .pagination { display: grid; grid-template-columns: minmax(0, 1fr); }
  .pager { display: grid; grid-template-columns: 1fr 1fr; }
  #first { grid-area: 2 / 1; }
  #last { grid-area: 2 / 2; }
  #previous { grid-area: 1 / 1; }
  #next { grid-area: 1 / 2; }
  #jump { grid-column: 1 / -1; justify-content: center; }
  #page { height: 2.75rem; }
}
@media (max-width: 410px) {
  .filter-grid fieldset { grid-column: 1 / -1; }
  .range input { flex: 1; }
}
