/* Standalone HDB Valuation Widget v3.6.3
   All selectors are prefixed with .hdbv to minimise clashes with host-site CSS.
*/

.hdbv,
.hdbv * {
  box-sizing: border-box;
}

.hdbv {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #17312b;
  line-height: 1.5;
}

.hdbv-card {
  width: 100%;
  background: #ffffff;
  border: 1px solid #dce7e2;
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 14px 40px rgba(17, 55, 45, 0.08);
}

.hdbv-header {
  margin-bottom: 22px;
}

.hdbv-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #51756b;
}

.hdbv h2 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: #16372f;
}

.hdbv-intro {
  max-width: 700px;
  margin: 11px 0 0;
  font-size: 15px;
  color: #61736e;
}

.hdbv-form {
  margin-top: 20px;
}

.hdbv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.hdbv-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: #29483f;
}

.hdbv-field small {
  min-height: 18px;
  font-size: 12px;
  font-weight: 500;
  color: #81918c;
}

.hdbv input,
.hdbv select,
.hdbv button {
  font: inherit;
}

.hdbv input,
.hdbv select {
  width: 100%;
  min-height: 50px;
  border: 1px solid #cbdad5;
  border-radius: 12px;
  background: #fbfdfc;
  padding: 0 14px;
  color: #17312b;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.hdbv input:focus,
.hdbv select:focus {
  border-color: #3a7665;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(58, 118, 101, 0.12);
}

.hdbv-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.hdbv-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 220px;
  min-height: 54px;
  border: 0;
  border-radius: 13px;
  padding: 0 26px;
  background: #215d4e;
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    opacity 0.16s ease,
    background 0.16s ease;
}

.hdbv-submit:hover:not(:disabled) {
  background: #194c40;
  transform: translateY(-1px);
}

.hdbv-submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

.hdbv-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 54px;
  border: 1px solid #b9cec7;
  border-radius: 13px;
  padding: 0 22px;
  background: #ffffff;
  color: #285a4d;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.hdbv-reset:hover {
  border-color: #7ea699;
  background: #f5faf8;
  transform: translateY(-1px);
}

.hdbv-reset:focus-visible,
.hdbv-sort:focus-visible {
  outline: 3px solid rgba(58, 118, 101, 0.22);
  outline-offset: 2px;
}

.hdbv-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: hdbv-spin 0.75s linear infinite;
}

.hdbv-loading .hdbv-spinner {
  display: inline-block;
}

@keyframes hdbv-spin {
  to {
    transform: rotate(360deg);
  }
}

.hdbv-error {
  margin: 14px 0 0;
  border: 1px solid #efcccc;
  border-radius: 10px;
  background: #fff7f7;
  padding: 11px 13px;
  color: #9b2c2c;
  font-size: 14px;
}

.hdbv-result {
  margin-top: 20px;
  border: 1px solid #cfdfd9;
  border-radius: 18px;
  background: #f7faf8;
  padding: 22px;
}

.hdbv-result-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.hdbv-result-label {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.025em;
  color: #567169;
}

.hdbv-estimate {
  margin-top: 4px;
  font-size: clamp(40px, 7vw, 60px);
  line-height: 0.98;
  font-weight: 900;
  letter-spacing: -0.045em;
  color: #173d33;
}

.hdbv-range {
  margin: 11px 0 0;
  font-size: 14px;
  color: #60756e;
}

.hdbv-confidence {
  flex: 0 0 auto;
  min-width: 118px;
  border-radius: 999px;
  padding: 8px 14px;
  text-align: center;
  border: 1px solid transparent;
}

.hdbv-confidence span,
.hdbv-confidence strong {
  display: inline;
  font-size: 12px;
}

.hdbv-confidence span {
  margin-right: 5px;
  font-weight: 600;
}

.hdbv-confidence strong {
  font-weight: 850;
}

.hdbv-confidence-high {
  background: #eef9f2;
  border-color: #d0ead9;
  color: #236b45;
}

.hdbv-confidence-medium {
  background: #fff9ea;
  border-color: #efe1b9;
  color: #8b651c;
}

.hdbv-confidence-low {
  background: #fff2ef;
  border-color: #efd7d1;
  color: #9a493c;
}

.hdbv-section {
  margin-top: 22px;
  border-top: 1px solid #dbe6e2;
  padding-top: 18px;
}

.hdbv-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hdbv-section-heading h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  color: #183d33;
}

.hdbv-section-heading p {
  margin: 4px 0 0;
  font-size: 13px;
  color: #6d7f79;
}

.hdbv-property-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.hdbv-property-summary > p {
  margin-top: 4px;
}

.hdbv-section-heading .hdbv-approx-size {
  margin-top: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.hdbv-section-heading .hdbv-approx-size strong {
  color: #25473e;
}

.hdbv-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.hdbv-stat,
.hdbv-evidence > div {
  border: 1px solid #dde8e4;
  border-radius: 12px;
  background: #ffffff;
  padding: 12px;
}

.hdbv-stat span,
.hdbv-evidence span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #7b8b86;
}

.hdbv-stat strong,
.hdbv-evidence strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: #25473e;
}

.hdbv-evidence {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.hdbv-count-badge {
  flex: 0 0 auto;
  border: 1px solid #d8e6e1;
  border-radius: 999px;
  background: #ffffff;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 750;
  color: #45685e;
}

.hdbv-transactions-wrap {
  width: 100%;
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid #dde8e4;
  border-radius: 12px;
  background: #ffffff;
}

.hdbv-transactions {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.hdbv-transactions th,
.hdbv-transactions td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf2f0;
  vertical-align: middle;
  text-align: left;
  font-size: 13px;
}

.hdbv-transactions th {
  background: #f5f8f7;
  font-size: 11px;
  font-weight: 800;
  color: #70827c;
}

.hdbv-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.hdbv-sort:hover {
  color: #285a4d;
}

.hdbv-sort-indicator {
  flex: 0 0 auto;
  min-width: 12px;
  font-size: 10px;
  line-height: 1;
  color: #93a39e;
}

.hdbv-transactions th[aria-sort="ascending"],
.hdbv-transactions th[aria-sort="descending"] {
  color: #285a4d;
}

.hdbv-transactions th[aria-sort="ascending"] .hdbv-sort-indicator,
.hdbv-transactions th[aria-sort="descending"] .hdbv-sort-indicator {
  color: #285a4d;
}

.hdbv-transactions tbody tr:last-child td {
  border-bottom: 0;
}

.hdbv-transactions td {
  color: #425d55;
}

.hdbv-transactions td strong,
.hdbv-transactions td span {
  display: block;
}

.hdbv-transactions td strong {
  color: #25473e;
}

.hdbv-transactions td span {
  margin-top: 1px;
  font-size: 12px;
  color: #73847f;
}

.hdbv-transactions .hdbv-price {
  font-weight: 850;
  color: #173d33;
  white-space: nowrap;
}

.hdbv-show-more {
  margin-top: 12px;
  border: 0;
  background: transparent;
  padding: 4px 0;
  color: #215d4e;
  font-weight: 800;
  cursor: pointer;
}

.hdbv-show-more:hover {
  text-decoration: underline;
}

.hdbv-empty {
  margin-top: 14px;
  border: 1px dashed #d5e2dd;
  border-radius: 12px;
  background: #ffffff;
  padding: 16px;
  font-size: 13px;
  color: #71827c;
}

.hdbv-disclaimer {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12px;
  color: #7a8984;
}

@media (max-width: 720px) {
  .hdbv-card {
    border-radius: 18px;
    padding: 20px;
  }

  /* Mobile form: Postal Code + Floor first; Flat Type full-width below. */
  .hdbv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .hdbv-grid > .hdbv-field:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .hdbv-grid > .hdbv-field:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
  }

  .hdbv-grid > .hdbv-field:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .hdbv-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .hdbv-submit,
  .hdbv-reset {
    width: 100%;
    min-width: 0;
    padding-left: 12px;
    padding-right: 12px;
  }

  .hdbv-result-top {
    flex-direction: column;
  }

  .hdbv-confidence {
    min-width: 0;
    text-align: left;
  }

  .hdbv-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Evidence stays as two compact columns: same-block | same-town, then reference month | comparables. */
  .hdbv-evidence {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hdbv-section-heading {
    flex-direction: column;
    gap: 8px;
  }

  .hdbv-property-summary {
    display: block;
  }

  .hdbv-section-heading .hdbv-approx-size {
    margin-top: 3px;
  }

  .hdbv-count-badge {
    align-self: flex-start;
  }

  .hdbv-transactions-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    margin-top: 8px;
  }

  .hdbv-transactions,
  .hdbv-transactions tbody,
  .hdbv-transactions tr,
  .hdbv-transactions td {
    display: block;
    width: 100%;
  }

  .hdbv-transactions {
    min-width: 0;
  }

  .hdbv-transactions thead {
    display: none;
  }

  /* Mobile transaction card reading order:
     Month | Distance
     Block / Street | Lease Commence (label above year)
     Floor | Size
     Price (full width)
     Desktop remains a sortable seven-column table. */
  .hdbv-transactions tr {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(88px, 0.65fr);
    gap: 0 10px;
    margin-bottom: 18px;
    border: 1px solid #dde8e4;
    border-radius: 10px;
    background: #ffffff;
    padding: 5px 9px;
  }

  .hdbv-transactions tbody tr:last-child {
    margin-bottom: 0;
  }

  .hdbv-transactions td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    border: 0;
    padding: 3px 0;
    font-size: 12.5px;
    line-height: 1.2;
  }

  .hdbv-transactions td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 1px;
    font-size: 9.5px;
    line-height: 1.1;
    font-weight: 800;
    color: #7b8b86;
  }

  .hdbv-transactions td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .hdbv-transactions td:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
  }

  .hdbv-transactions td:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
    border-top: 1px solid #edf2f0;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .hdbv-transactions td:nth-child(2) strong {
    display: block;
    margin: 0;
    max-width: 100%;
    font-size: 12.5px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hdbv-transactions td:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
    border-top: 1px solid #edf2f0;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .hdbv-transactions td:nth-child(5) {
    grid-column: 1;
    grid-row: 3;
    border-top: 1px solid #edf2f0;
    padding-top: 4px;
  }

  .hdbv-transactions td:nth-child(6) {
    grid-column: 2;
    grid-row: 3;
    border-top: 1px solid #edf2f0;
    padding-top: 4px;
  }

  .hdbv-transactions td:nth-child(7) {
    grid-column: 1 / -1;
    grid-row: 4;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    border-top: 1px solid #edf2f0;
    padding-top: 5px;
    padding-bottom: 2px;
    font-size: 17px;
    line-height: 1.05;
    font-weight: 900;
    color: #173d33;
  }

  .hdbv-transactions td:nth-child(7)::before {
    flex: 0 0 auto;
    margin: 0;
  }

}

@media (max-width: 420px) {
  .hdbv-card {
    padding: 16px;
  }

  .hdbv-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Preserve both transaction-card columns on narrow phones. */
  .hdbv-transactions tr {
    gap: 0 8px;
    padding: 6px 9px;
  }
}