:root {
    --bg: #f3f6f1;
    --surface: rgba(255,255,255,.92);
    --surface-strong: #fff;
    --text: #173126;
    --muted: #627269;
    --line: #d9e2dc;
    --brand: #176b45;
    --brand-2: #2d8b5f;
    --brand-soft: #e5f3eb;
    --danger: #a23a35;
    --shadow: 0 22px 60px rgba(20,55,39,.12);
    --radius: 26px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-height: 100vh; font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif; color: var(--text); background:
    radial-gradient(circle at 10% 5%, rgba(92,167,114,.18), transparent 31rem),
    radial-gradient(circle at 95% 15%, rgba(238,185,74,.14), transparent 26rem), var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
.page-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 30px 0 70px; }
.hero { min-height: 250px; border-radius: 34px; padding: clamp(30px, 5vw, 66px); display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; color: white; overflow: hidden; position: relative; box-shadow: var(--shadow); background:
    linear-gradient(125deg, rgba(7,69,42,.96), rgba(35,124,78,.88)),
    radial-gradient(circle at 80% 20%, #f4bd4d 0 6%, transparent 6.3%);
}
.hero::after { content: ""; position: absolute; width: 420px; height: 420px; right: -80px; top: -180px; border-radius: 50%; border: 56px solid rgba(255,255,255,.08); }
.hero-copy { position: relative; z-index: 1; max-width: 760px; }
.eyebrow { display: block; letter-spacing: .18em; font-size: 12px; font-weight: 800; opacity: .74; margin-bottom: 10px; }
h1 { margin: 0 0 14px; font-size: clamp(36px, 6vw, 68px); line-height: 1.03; letter-spacing: -.04em; }
.hero p { margin: 0; max-width: 720px; color: rgba(255,255,255,.82); font-size: clamp(16px, 2vw, 20px); line-height: 1.8; }
.icon-button { position: relative; z-index: 2; flex: none; width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255,255,255,.28); color: white; background: rgba(255,255,255,.12); font-size: 24px; backdrop-filter: blur(8px); }
main { margin-top: -24px; position: relative; z-index: 2; }
.search-card, .info-card { background: var(--surface); border: 1px solid rgba(255,255,255,.8); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.search-card { padding: clamp(20px, 4vw, 34px); }
.mode-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.mode-row input { position: absolute; opacity: 0; pointer-events: none; }
.mode-row span { display: inline-flex; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 14px; }
.mode-row input:checked + span { background: var(--brand-soft); color: var(--brand); border-color: #a7cdb7; font-weight: 700; }
.search-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.search-form input, .inline-form input, .field-label input { min-width: 0; width: 100%; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 16px; padding: 16px 18px; outline: none; transition: .2s; }
.search-form input { font-size: 18px; }
input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 4px rgba(45,139,95,.12); }
button { border: 1px solid var(--line); border-radius: 14px; padding: 11px 16px; color: var(--text); background: #fff; transition: transform .15s, box-shadow .15s, background .15s; }
button:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(28,65,47,.1); }
.primary-button { color: #fff; border-color: var(--brand); background: linear-gradient(135deg, var(--brand), var(--brand-2)); font-weight: 800; }
.search-form .primary-button { padding-inline: 28px; }
.quick-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.quick-row button { padding: 7px 11px; font-size: 13px; color: var(--brand); background: #f7fbf8; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0; }
.stats-grid article { padding: 22px; border-radius: 20px; background: rgba(255,255,255,.78); border: 1px solid rgba(255,255,255,.82); box-shadow: 0 12px 30px rgba(26,62,45,.07); }
.stats-grid strong { display: block; font-size: clamp(28px, 4vw, 42px); line-height: 1; color: var(--brand); }
.stats-grid span { display: block; color: var(--muted); margin-top: 9px; font-size: 14px; }
.info-card { padding: clamp(24px, 4vw, 40px); }
.info-card h2 { margin: 0 0 22px; font-size: 28px; }
.info-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.info-columns b { font-size: 18px; }
.info-columns p { color: var(--muted); line-height: 1.75; margin: 8px 0 0; }
.last-update { border-top: 1px solid var(--line); margin: 28px 0 0; padding-top: 18px; color: var(--muted); white-space: pre-wrap; font-size: 13px; }
.modal { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 18px; background: rgba(13,29,22,.58); backdrop-filter: blur(10px); }
.modal.open { display: grid; }
.modal-panel { width: min(1120px, 98vw); max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; border-radius: 26px; background: var(--surface-strong); box-shadow: 0 30px 100px rgba(0,0,0,.25); }
.modal-panel.fullscreen { width: 100vw; height: 100vh; max-height: none; border-radius: 0; }
.modal-header { flex: none; display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 22px 24px 17px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 25px; }
.modal-header p { color: var(--muted); margin: 6px 0 0; }
.modal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.close-button { width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 26px; line-height: 1; }
.modal-body { min-height: 0; overflow: auto; }
.tab-bar { display: flex; gap: 8px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: #fbfcfb; }
.tab-bar button { padding: 8px 13px; }
.tab-bar button.active { color: white; background: var(--brand); border-color: var(--brand); }
.tab-panel { display: none; padding: 24px; }
.tab-panel.active { display: block; }
.summary-section { margin-bottom: 28px; }
.summary-section h3 { margin: 0 0 13px; font-size: 20px; }
.summary-card { border: 1px solid var(--line); border-radius: 17px; padding: 16px; margin-bottom: 12px; background: #fbfdfb; }
.summary-card h4 { margin: 0 0 10px; color: var(--brand); font-size: 18px; }
.summary-card p { margin: 6px 0; line-height: 1.65; }
.summary-card .city-label { font-weight: 800; }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 16px; max-height: calc(94vh - 230px); }
.fullscreen .table-wrap { max-height: calc(100vh - 220px); }
table { border-collapse: separate; border-spacing: 0; min-width: 1700px; width: 100%; font-size: 13px; }
th, td { padding: 11px 12px; text-align: left; vertical-align: top; border-right: 1px solid #e8eeea; border-bottom: 1px solid #e8eeea; }
th { position: sticky; top: 0; z-index: 2; white-space: nowrap; color: #fff; background: var(--brand); cursor: pointer; }
tbody tr:nth-child(even) { background: #f8fbf9; }
tbody tr:hover { background: #eef7f1; }
td:nth-child(10) { min-width: 360px; line-height: 1.55; }
td a { color: var(--brand); }
.missing-value { display: inline-block; white-space: nowrap; color: #8a5a16; background: #fff4d8; border: 1px solid #ead39f; border-radius: 999px; padding: 2px 7px; font-size: 12px; }
.data-badge { display: inline-block; margin-left: 7px; white-space: nowrap; color: #7c4d0f; background: #fff0c4; border-radius: 999px; padding: 2px 7px; font-size: 11px; font-weight: 800; }
.distribution-only-row { background: #fffdf7 !important; }
.distribution-only-row:hover { background: #fff8e8 !important; }
.admin-panel { width: min(820px, 98vw); }
.admin-body { padding: 22px; }
.field-label { display: grid; gap: 8px; font-weight: 800; }
.admin-section { margin-top: 18px; padding: 18px; border-radius: 18px; border: 1px solid var(--line); background: #fbfdfb; }
.admin-section h3 { margin: 0 0 6px; }
.admin-section p { color: var(--muted); margin: 0 0 13px; line-height: 1.5; }
.inline-form { display: grid; grid-template-columns: minmax(160px, 1fr) auto; gap: 10px; }
.inline-form.wide { grid-template-columns: minmax(220px, 1fr) auto; }
.danger-zone { border-color: #efc6c2; background: #fff9f8; }
.danger-zone button { color: var(--danger); border-color: #dba6a1; }
.admin-status { margin-top: 18px; padding: 14px; border-radius: 14px; background: #eef4f0; color: var(--muted); white-space: pre-wrap; }
.admin-status.loading { color: var(--brand); font-weight: 800; }
.admin-status.error { color: var(--danger); background: #fff0ef; }
.toast { position: fixed; z-index: 200; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 18px; border-radius: 999px; background: #173126; color: #fff; box-shadow: var(--shadow); transition: .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) {
    .page-shell { width: min(100% - 20px, 1180px); padding-top: 10px; }
    .hero { min-height: 230px; border-radius: 24px; padding: 28px 22px; }
    .hero .icon-button { position: absolute; right: 16px; top: 16px; }
    main { margin-top: -14px; }
    .search-form { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .info-columns { grid-template-columns: 1fr; gap: 18px; }
    .modal { padding: 0; }
    .modal-panel { width: 100vw; height: 100dvh; max-height: none; border-radius: 0; }
    .modal-header { padding: 17px 16px 13px; }
    .modal-actions button:not(.close-button) { padding: 8px 10px; font-size: 13px; }
    .tab-bar { padding-inline: 16px; overflow-x: auto; }
    .tab-panel { padding: 16px; }
    .table-wrap, .fullscreen .table-wrap { max-height: calc(100dvh - 205px); }
    .inline-form, .inline-form.wide { grid-template-columns: 1fr; }
}
