  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f5f6fa; color: #2c3e50; line-height: 1.6; }
  .container { max-width: 1400px; margin: 0 auto; padding: 20px; }
  header { background: linear-gradient(135deg, #1a5276 0%, #2980b9 100%); color: white; padding: 30px 20px; border-radius: 12px; margin-bottom: 24px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
  header h1 { font-size: 1.6rem; margin-bottom: 8px; }
  header .subtitle { opacity: 0.9; font-size: 0.95rem; }
  header .meta { margin-top: 12px; font-size: 0.85rem; opacity: 0.8; }
  .nav { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
  .nav-btn { padding: 10px 20px; border: 2px solid #2980b9; background: white; color: #2980b9; border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.2s; font-family: inherit; }
  .nav-btn:hover { background: #ebf5fb; }
  .nav-btn.active { background: #2980b9; color: white; }
  .section-title { font-size: 1.3rem; font-weight: 700; margin: 30px 0 16px; color: #1a5276; border-left: 4px solid #2980b9; padding-left: 12px; }
  .section-title.sub { font-size: 1rem; margin: 4px 0 12px; border-left-width: 3px; }
  .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
  .stat-card { background: white; padding: 24px; border-radius: 12px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
  .stat-card .number { font-size: 2.4rem; font-weight: 700; }
  .stat-card .label { font-size: 0.95rem; color: #7f8c8d; margin-top: 6px; }
  .stat-card .label-sub { font-size: 0.82rem; color: #a6b1b8; margin-top: 3px; }
  .stat-card.size-card .number { font-size: clamp(1.2rem, 3.2vw, 2.2rem); }
  .stat-card.size-card.empty { opacity: 0.5; box-shadow: none; }
  .stat-card.blue .number { color: #2980b9; }
  .stat-card.green .number { color: #27ae60; }
  .stat-card.red .number { color: #e74c3c; }
  .stat-card.orange .number { color: #f39c12; }
  .stat-card.purple .number { color: #8e44ad; }
  .chart-container { background: white; padding: 24px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); margin-bottom: 24px; }
  .chart-container h3 { margin-bottom: 16px; color: #2c3e50; }
  .chart-empty { font-size: 0.9rem; color: #7f8c8d; line-height: 1.8; text-align: center; padding: 28px 12px; }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
  .ranking-table { width: 100%; min-width: 820px; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
  .ranking-table th { background: #2980b9; color: white; padding: 14px; text-align: left; font-weight: 600; white-space: nowrap; }
  .ranking-table td { padding: 14px; border-bottom: 1px solid #ecf0f1; white-space: nowrap; }
  .scroll-hint { display: none; font-size: 0.75rem; color: #95a5a6; margin: -6px 0 8px 2px; }
  .ranking-table tr:hover { background: #f8f9fa; }
  .ranking-table .rank { font-weight: 700; font-size: 1.1rem; }
  .ranking-table .rank-1 { color: #f1c40f; }
  .ranking-table .rank-2 { color: #bdc3c7; }
  .ranking-table .rank-3 { color: #cd7f32; }
  .ranking-table .num { text-align: right; font-variant-numeric: tabular-nums; }
  .ranking-table .clickable { cursor: pointer; }
  .badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
  .badge-hos { background: #d5f5e3; color: #1e8449; }
  .badge-sold { background: #f8d7da; color: #c0392b; }
  .badge-sel { background: #e9d5ff; color: #8e44ad; }
  .badge-avail { background: #ebf5fb; color: #2980b9; }
  .estate-selector { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
  .estate-btn { padding: 12px 24px; border: 2px solid #2980b9; background: white; color: #2980b9; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: 600; transition: all 0.2s; font-family: inherit; }
  .estate-btn:hover { background: #ebf5fb; }
  .estate-btn.active { background: #2980b9; color: white; border-color: #2980b9; }
  .block-tabs { display: flex; flex-wrap: nowrap; gap: 8px; margin-bottom: 20px; border-bottom: 2px solid #ddd; padding-bottom: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .block-tab { flex: 0 0 auto; white-space: nowrap; padding: 10px 20px; border: none; background: none; color: #666; cursor: pointer; font-size: 1rem; font-weight: 500; border-radius: 6px 6px 0 0; transition: all 0.2s; font-family: inherit; }
  .block-tab:hover { background: #f0f0f0; color: #2980b9; }
  .block-tab.active { background: #2980b9; color: white; }
  .matrix-table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.06); margin-bottom: 24px; }
  .matrix-table th { background: #34495e; color: white; padding: 10px 6px; text-align: center; font-weight: 600; font-size: 0.85rem; position: sticky; top: 0; }
  .matrix-table td { padding: 8px 4px; text-align: center; border: 1px solid #ecf0f1; }
  .matrix-table .floor-label { background: #ecf0f1; font-weight: 600; color: #2c3e50; width: 50px; }
  .unit-cell { width: 72px; height: 72px; vertical-align: middle; cursor: pointer; transition: all 0.15s; border-radius: 6px; font-size: 0.85rem; font-weight: 500; }
  .unit-cell:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 10; position: relative; }
  .unit-cell .unit-num { font-size: 0.85rem; font-weight: 700; white-space: nowrap; }
  .unit-cell .unit-status { font-size: 0.7rem; margin-top: 2px; }
  .unit-cell .unit-date { font-size: 0.6rem; margin-top: 1px; opacity: 0.8; white-space: nowrap; letter-spacing: -0.02em; }
  .unit-cell.available.small { background: #d4edda; color: #155724; }
  .unit-cell.available.medium { background: #d1ecf1; color: #0c5460; }
  .unit-cell.available.large { background: #fff3cd; color: #856404; }
  .unit-cell.selected { background: #e9d5ff; color: #5b21b6; }
  .unit-cell.sold { background: #f8d7da; color: #721c24; }
  .unit-cell.na { background: #f8f9fa; color: #adb5bd; }
  .unit-cell.filtered-out { opacity: .18; filter: grayscale(1); }
  .legend { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; font-size: 0.9rem; }
  .legend-item { display: flex; align-items: center; gap: 6px; }
  .legend-box { width: 20px; height: 20px; border-radius: 4px; border: 1px solid #ccc; }
  .info-table.estate-info, .info-table.block-info { margin-bottom: 20px; }
  .info-table { width: 100%; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border-collapse: separate; border-spacing: 0; overflow: hidden; font-size: 0.95rem; }
  .info-table caption { text-align: left; font-size: 0.82rem; font-weight: 600; color: #7f8c8d; padding: 12px 16px 4px; letter-spacing: 0.4px; }
  .info-table th { text-align: left; font-weight: 600; color: #7f8c8d; padding: 9px 16px; width: 88px; white-space: nowrap; vertical-align: top; background: #fafbfc; border-top: 1px solid #f0f2f4; }
  .info-table td { padding: 9px 16px; color: #2c3e50; border-top: 1px solid #f0f2f4; }
  .info-table tbody tr:first-child th, .info-table tbody tr:first-child td { border-top: none; }
  .info-table .kd, .info-table .hos { color: #1a5276; border-bottom: 1px dotted #7fb3d5; cursor: help; }
  .info-table .v-selected { color: #f39c12; font-weight: 600; }
  .info-table .v-sold { color: #e74c3c; font-weight: 600; }
  .hidden { display: none !important; }
  .progress-bar { display: flex; height: 8px; background: #ecf0f1; border-radius: 4px; overflow: hidden; margin-top: 8px; }
  .progress-sel { height: 100%; background: #f39c12; transition: width 0.5s; }
  .progress-sold { height: 100%; background: #e74c3c; transition: width 0.5s; }
  /* Modal */
  .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center; z-index: 1000; }
  .modal-overlay.active { display: flex; }
  .modal-content { background: white; padding: 28px; border-radius: 16px; max-width: 420px; width: 90%; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
  .modal-content h3 { margin-bottom: 16px; color: #1a5276; font-size: 1.3rem; }
  .modal-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #eee; gap: 12px; }
  .modal-row:last-child { border-bottom: none; }
  .modal-label { color: #7f8c8d; font-size: 0.95rem; }
  .modal-value { font-weight: 600; color: #2c3e50; text-align: right; }
  .modal-value.pending { font-weight: 500; color: #95a5a6; }
  .modal-close { margin-top: 20px; width: 100%; padding: 12px; background: #2980b9; color: white; border: none; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; }
  .modal-close:hover { background: #1a5276; }
  .unit-filter-bar { background: white; padding: 16px 18px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,0.06); margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: flex-end; }
  .uf-group { display: flex; flex-direction: column; gap: 6px; }
  .uf-label { font-size: 0.78rem; font-weight: 600; color: #7f8c8d; letter-spacing: 0.3px; }
  .uf-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .uf-select, .uf-input { padding: 7px 10px; border: 1px solid #d5dbe0; border-radius: 8px; font-size: 0.9rem; color: #2c3e50; background: #fff; font-family: inherit; }
  .uf-select:focus, .uf-input:focus { outline: none; border-color: #2980b9; box-shadow: 0 0 0 2px rgba(41,128,185,0.15); }
  .uf-input { width: 76px; }
  .uf-range-sep { color: #95a5a6; font-size: 0.85rem; }
  .size-toggle { padding: 7px 16px; border: 2px solid #2980b9; background: white; color: #2980b9; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: all 0.2s; font-family: inherit; }
  .size-toggle:hover { background: #ebf5fb; }
  .size-toggle.active { background: #2980b9; color: white; }
  .uf-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
  .uf-count { font-size: 0.88rem; color: #1a5276; font-weight: 600; white-space: nowrap; }
  .uf-clear { padding: 8px 16px; border: 2px solid #e67e22; background: white; color: #e67e22; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 600; transition: all 0.2s; font-family: inherit; }
  .uf-clear:hover { background: #fdf2e9; }
  .loading { text-align: center; padding: 60px 20px; color: #7f8c8d; }
  .loading .spinner { width: 34px; height: 34px; border: 4px solid #ecf0f1; border-top-color: #2980b9; border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 14px; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .noscript-warn { margin: 0 0 18px; padding: 16px 20px; background: #fff4e5; border: 2px solid #e67e22; border-radius: 12px; color: #8a4b0a; font-size: 0.9rem; line-height: 1.8; }
  .site-footer { max-width: 1400px; margin: 44px auto 0; padding: 22px 20px 44px; border-top: 1px solid #dfe6e9; color: #7f8c8d; font-size: 0.85rem; line-height: 1.95; }
  .site-footer p { margin-bottom: 6px; }
  .site-footer a { color: #2980b9; text-decoration: none; }
  .site-footer a:hover { text-decoration: underline; }
  .site-footer .disclaimer { color: #e67e22; font-weight: 600; }
  .site-footer .footer-note { color: #a6b1b8; font-size: 0.78rem; }
  .update-note { font-size: 0.85rem; color: #7f8c8d; margin-top: 4px; }
  @media (max-width: 600px) {
    body { overflow-x: hidden; }
    .container { padding: 12px; }
    header { padding: 18px 14px; }
    header h1 { font-size: 1.15rem; }
    header .meta { font-size: 0.78rem; }
    .nav { gap: 8px; }
    .nav-btn { padding: 8px 14px; font-size: 0.9rem; flex: 1 1 auto; }
    .section-title { font-size: 1.05rem; margin: 22px 0 12px; }
    .section-title.sub { font-size: 0.92rem; margin: 0 0 10px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
    .stat-card { padding: 14px 10px; }
    .stat-card .number { font-size: 1.75rem; }
    .stat-card .label { font-size: 0.82rem; }
    .stat-card .label-sub { font-size: 0.75rem; }
    .stat-card.total { grid-column: 1 / -1; }
    .chart-container { padding: 12px; }
    .info-table.estate-info, .info-table.block-info { margin-bottom: 16px; }
    .info-table { font-size: 0.86rem; }
    .info-table caption { padding: 10px 12px 3px; font-size: 0.78rem; }
    .info-table th { width: 74px; padding: 8px 12px; }
    .info-table td { padding: 8px 12px; }
    .estate-selector { gap: 8px; }
    .estate-btn { padding: 9px 14px; font-size: 0.9rem; }
    .block-tab { padding: 8px 14px; font-size: 0.9rem; }
    .legend { font-size: 0.78rem; gap: 10px; }
    .unit-cell { width: 56px; height: 56px; font-size: 0.75rem; }
    .unit-cell .unit-num { font-size: 0.8rem; }
    .unit-cell .unit-date { font-size: 0.5rem; }
    .modal-content { padding: 20px; }
    .unit-filter-bar { padding: 12px; gap: 10px; }
    .uf-input { width: 62px; }
    .uf-actions { margin-left: 0; width: 100%; justify-content: space-between; }
  }

/* ── 平面圖 PDF ─────────────────────────────────────────── */
.pdf-btn {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  border: 1px solid #2980b9;
  color: #2980b9;
  background: #fff;
  text-decoration: none;
  transition: all 0.15s;
}
.pdf-btn:hover { background: #2980b9; color: #fff; }
.pdf-btn.disabled {
  border-color: #ccc;
  color: #ccc;
  cursor: not-allowed;
  pointer-events: none;
}
.pdf-btn-link { margin-left: 6px; }
.modal-row-pdf { border-top: 2px solid #ecf0f1; margin-top: 4px; padding-top: 12px; }
.modal-row-pdf .modal-value { display: flex; align-items: center; }
.pdf-overlay { z-index: 1100; }
.pdf-modal-content { max-width: 1100px; width: 94%; padding: 20px; }
.pdf-modal-content h3 { font-size: 1.05rem; margin-bottom: 12px; }
.pdf-frame-wrap {
  width: 100%;
  height: 72vh;
  background: #f4f6f7;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #dfe6e9;
}
#pdfFrame { width: 100%; height: 100%; border: none; display: block; }
.pdf-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.pdf-btn-solid {
  display: inline-block;
  padding: 11px 16px;
  background: #2980b9;
  color: #fff;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}
.pdf-btn-solid:hover { background: #1a5276; }
.pdf-actions .modal-close { margin-top: 0; width: auto; flex: 1; }
