* {
  box-sizing: border-box;
}


/* =========================
   GLOBAL
   ========================= */

:root {
  --toolbar-height: 58px;

  --border: #d9dee7;

  --text: #253043;

  --muted: #8d96a5;

  --surface: #ffffff;
}


html,
body {
  width: 100%;
  height: 100%;

  margin: 0;

  overflow: hidden;

  font-family:
    Arial,
    Helvetica,
    sans-serif;

  color: var(--text);

  background: #ffffff;
}


body {
  display: flex;

  flex-direction: column;
}


/* =========================
   TOOLBAR
   ========================= */

.toolbar {

  min-height: var(--toolbar-height);

  width: 100%;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 8px;

  padding: 7px 10px;

  background: #ffffff;

  border-bottom: 1px solid #e7eaf0;

  z-index: 10;
}


.toolbar-left {

  min-width: 0;

  display: flex;

  align-items: center;

  gap: 8px;

  flex: 1;
}


/* =========================
   TAG INPUT
   ========================= */

.tag-wrapper {

  position: relative;

  flex: 0 1 295px;

  min-width: 170px;
}


.tag-input {

  width: 100%;

  height: 38px;

  padding: 0 14px;

  border: 1px solid var(--border);

  border-radius: 9px;

  outline: none;

  font-size: 14px;

  color: var(--text);

  background: #ffffff;

  box-shadow:
    0 1px 3px rgba(30, 45, 65, 0.04);
}


.tag-input::placeholder {

  color: #9ca4b1;
}


.tag-input:focus {

  border-color: #7baef8;

  box-shadow:
    0 0 0 3px rgba(12, 107, 249, 0.10);
}


/* =========================
   COLOUR SELECTOR
   ========================= */

.color-selector {

  display: flex;

  align-items: center;

  gap: 8px;

  flex: 0 0 auto;
}


.color-btn {

  width: 24px;

  height: 24px;

  padding: 0;

  border: 0;

  border-radius: 50%;

  cursor: pointer;

  position: relative;

  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);

  transition:
    transform 120ms ease,
    box-shadow 120ms ease;
}

.color-btn.square {
  border-radius: 4px;
}


.color-btn:hover {

  transform: scale(1.08);
}


.color-btn.selected {

  box-shadow:
    0 0 0 3px #ffffff,
    0 0 0 5px currentColor;
}


/* =========================
   ADDRESS SEARCH
   ========================= */

.address-wrapper {

  position: relative;

  flex: 0 1 300px;

  min-width: 170px;
}


.address-autocomplete-host {

  width: 100%;

  height: 38px;
}


.address-autocomplete-host gmp-place-autocomplete {

  width: 100%;

  display: block;
}


.address-input {

  width: 100%;

  height: 38px;

  padding: 0 10px;

  border: 1px solid var(--border);

  border-radius: 9px;

  outline: none;

  font-size: 14px;

  color: var(--text);

  background: #ffffff;

  box-shadow:
    0 1px 3px rgba(30, 45, 65, 0.04);
}


.address-input::placeholder {

  color: #9ca4b1;
}


.address-input:focus {

  border-color: #7baef8;

  box-shadow:
    0 0 0 3px rgba(12, 107, 249, 0.10);
}


.address-search-btn {

  position: absolute;

  right: 6px;

  top: 6px;

  width: 40px;

  height: 40px;

  border: 0;

  border-radius: 7px;

  background: #f1f4f8;

  color: #526074;

  font-size: 23px;

  cursor: pointer;
}


.address-search-btn:hover {

  background: #e7ebf1;
}


/* =========================
   SETTINGS
   ========================= */

.settings-btn {

  width: 44px;

  height: 44px;

  flex: 0 0 auto;

  border: 0;

  background: transparent;

  color: #526074;

  font-size: 29px;

  cursor: pointer;

  line-height: 1;

  transition: transform 150ms ease;
}


.settings-btn:hover {

  color: #26364e;

  transform: rotate(20deg);
}


/* =========================
   MAP
   ========================= */

#map {

  flex: 1;

  min-height: 0;

  width: 100%;
}


/* =========================
   STATUS
   ========================= */

.status-message {

  position: fixed;

  left: 50%;

  bottom: 18px;

  transform: translateX(-50%);

  padding: 10px 16px;

  border-radius: 8px;

  background: rgba(31, 42, 57, 0.90);

  color: #ffffff;

  font-size: 14px;

  opacity: 0;

  pointer-events: none;

  transition: opacity 180ms ease;

  z-index: 20;
}


.status-message.visible {

  opacity: 1;
}


/* =========================
   MODAL
   ========================= */

.modal {

  position: fixed;

  inset: 0;

  z-index: 100;

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 24px;

  background: rgba(20, 30, 45, 0.45);
}


.modal.hidden {

  display: none;
}


.modal-card {

  width: min(1400px, 100%);

  max-height: min(850px, 92vh);

  display: flex;

  flex-direction: column;

  background: #ffffff;

  border-radius: 12px;

  box-shadow:
    0 20px 70px rgba(20, 30, 45, 0.25);

  overflow: hidden;
}


/* =========================
   MODAL HEADER
   ========================= */

.modal-header {

  display: flex;

  align-items: center;

  justify-content: space-between;

  padding: 18px 22px;

  border-bottom: 1px solid #e5e9ef;
}


.modal-header h2 {

  margin: 0;

  font-size: 21px;
}


.close-btn {

  border: 0;

  background: transparent;

  font-size: 31px;

  color: #667387;

  cursor: pointer;
}


/* =========================
   EXPORT SUMMARY
   ========================= */

.export-summary {

  display: flex;

  gap: 18px;

  padding: 12px 22px;

  color: #667387;

  font-size: 14px;
}


/* =========================
   EXPORT TABLE
   ========================= */

.table-container {

  overflow: auto;

  padding: 0 22px 18px;
}


#exportTable {

  width: 100%;

  border-collapse: collapse;

  font-size: 13px;
}


#exportTable th,
#exportTable td {

  padding: 10px 9px;

  text-align: left;

  border-bottom: 1px solid #e8ebf0;

  white-space: nowrap;
}


#exportTable th {

  position: sticky;

  top: 0;

  background: #f7f8fa;

  color: #4c596d;
}


/* =========================
   COLOUR CELL
   ========================= */

.colour-cell {

  display: inline-flex;

  align-items: center;

  gap: 7px;
}


.colour-swatch {

  width: 15px;

  height: 15px;

  border-radius: 50%;

  display: inline-block;

  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.10);
}


/* =========================
   MODAL BUTTONS
   ========================= */

.modal-actions {

  display: flex;

  justify-content: flex-end;

  gap: 10px;

  padding: 15px 22px;

  border-top: 1px solid #e5e9ef;
}


.primary-btn,
.danger-btn {

  min-height: 40px;

  padding: 0 17px;

  border-radius: 7px;

  border: 0;

  cursor: pointer;

  font-weight: 600;
}


.primary-btn {

  background: #0c6bf9;

  color: #ffffff;
}


.primary-btn:hover {

  background: #095bd5;
}


.danger-btn {

  background: #fbe8e7;

  color: #b62e28;
}


.danger-btn:hover {

  background: #f7d8d6;
}


/* =========================
   TABLET
   ========================= */

@media (max-width: 1050px) {

  .toolbar {

    padding: 10px 14px;
  }


  .toolbar-left {

    gap: 12px;
  }


  .color-selector {

    gap: 10px;
  }


  .color-btn {

    width: 25px;

    height: 25px;
  }


  .tag-wrapper {

    flex-basis: 210px;
  }


  .address-wrapper {

    flex-basis: 240px;
  }

}


/* =========================
   MOBILE
   ========================= */

@media (max-width: 780px) {

  :root {

    --toolbar-height: auto;
  }


  .toolbar {

    align-items: flex-start;

    padding: 10px;
  }


  .toolbar-left {

    flex-wrap: wrap;

    row-gap: 10px;
  }


  .tag-wrapper,
  .address-wrapper {

    flex: 1 1 230px;
  }


  .color-selector {

    order: 3;

    width: 100%;

    justify-content: center;

    gap: 16px;

    padding: 2px 0;
  }


  .settings-btn {

    position: absolute;

    right: 8px;

    top: 8px;
  }


  .tag-wrapper {

    padding-right: 40px;
  }

}


/* =========================
   SMALL MOBILE
   ========================= */

@media (max-width: 480px) {

  .toolbar-left {

    width: 100%;
  }


  .tag-wrapper,
  .address-wrapper {

    flex-basis: 100%;
  }


  .color-selector {

    gap: 11px;
  }


  .color-btn {

    width: 24px;

    height: 24px;
  }


  .modal {

    padding: 8px;
  }


  .modal-actions {

    flex-wrap: wrap;
  }

}
/* Batch 3 */
#exportTable th[data-sort] {
  cursor: pointer;
  user-select: none;
}

#exportTable th[data-sort]:hover {
  text-decoration: underline;
}

#exportTable tbody tr {
  cursor: pointer;
}

#exportTable tbody tr:hover {
  background: #f5f8fc;
}

.map-attribution {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 5;
  padding: 2px 6px;
  font-size: 10px;
  color: #596273;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  pointer-events: none;
}

/* =========================
   BATCH 4 RESPONSIVE POLISH
   ========================= */
.icon-button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #ffffff;
  color: #526074;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.icon-button:hover {
  background: #f5f7fa;
}

.icon-button:focus-visible,
.settings-btn:focus-visible,
.color-btn:focus-visible {
  outline: 3px solid rgba(12, 107, 249, 0.20);
  outline-offset: 2px;
}

#exportTable tbody tr {
  cursor: pointer;
}

#exportTable tbody tr:hover {
  background: #f6f8fb;
}

@media (max-width: 760px) {
  :root { --toolbar-height: 104px; }

  .toolbar {
    min-height: var(--toolbar-height);
    padding: 6px 8px;
    align-items: flex-start;
  }

  .toolbar-left {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 38px 38px;
    gap: 6px;
  }

  .tag-wrapper {
    min-width: 0;
    width: 100%;
  }

  .address-wrapper {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
  }

  .color-selector {
    gap: 5px;
    justify-content: flex-end;
  }

  .color-btn {
    width: 22px;
    height: 22px;
  }

  .icon-button,
  .settings-btn {
    width: 36px;
    height: 36px;
  }

  .settings-btn {
    font-size: 25px;
  }

  .modal {
    padding: 8px;
    align-items: flex-end;
  }

  .modal-card {
    max-height: 94vh;
    border-radius: 12px 12px 0 0;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .table-container {
    padding: 0 12px 12px;
  }

  #exportTable {
    min-width: 760px;
  }
}


/* Export-row selection */
#exportTable th:first-child, #exportTable td.select-cell { width: 54px; text-align: center; }
#exportTable .export-row-checkbox { width: 16px; height: 16px; cursor: pointer; }


/* Client feedback: make active drawing/selection tools visibly pressed. */
.icon-button.active {
  background: #dbeafe !important;
  border: 2px solid #2563eb !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,.22);
  transform: translateY(1px);
}
.icon-button[aria-pressed="true"] {
  background: #dbeafe;
}

/* Database property lookup / export processing feedback */
.export-processing-status {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #f3f5f8;
  color: #394150;
  font-size: 12px;
}
#exportCsvBtn:disabled {
  opacity: .55;
  cursor: not-allowed;
}


/* Building data provider settings */
.provider-settings {
  margin: 12px 22px 8px;
  padding: 14px 16px;
  border: 1px solid #e3e8ef;
  border-radius: 9px;
  background: #f8fafc;
}
.provider-settings h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: #263449;
}
.provider-settings-help {
  margin: 5px 0 10px;
  color: #667387;
  font-size: 12px;
  line-height: 1.45;
}
.provider-settings label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #465469;
}
.provider-select {
  width: min(420px, 100%);
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #cbd4df;
  border-radius: 6px;
  background: #fff;
  color: #263449;
  font: inherit;
}
.provider-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 9px;
  font-size: 12px;
}
.provider-terms a {
  color: #075ecb;
  text-decoration: underline;
}


/* Building/property outline source settings */
.provider-settings {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(220px, 1fr);
  align-items: center;
  gap: 8px 14px;
  padding: 12px 22px 14px;
  border-top: 1px solid #eef0f3;
  border-bottom: 1px solid #eef0f3;
}
.provider-settings label { font-size: 13px; font-weight: 600; color: #465368; }
.provider-select {
  width: 100%; min-height: 38px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 7px;
  background: #fff; color: var(--text); font-size: 14px;
}
.provider-status {
  grid-column: 2; margin: 0; color: #687589;
  font-size: 12px; line-height: 1.45;
}
@media (max-width: 640px) {
  .provider-settings { grid-template-columns: 1fr; gap: 7px; padding: 12px 14px; }
  .provider-status { grid-column: 1; }
}


/* EPC availability button and certificate details */
.epc-toggle-button { font-weight: 800; font-size: 18px; color: #176b45; }
.epc-modal { position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(15, 23, 42, .55); }
.epc-modal.hidden { display: none; }
.epc-modal-card { width: min(1050px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; border-radius: 12px; background: #fff; color: #1d2330; box-shadow: 0 20px 70px rgba(0,0,0,.25); }
.epc-modal-header { display:flex; align-items:center; justify-content:space-between; padding: 12px 18px; border-bottom:1px solid #e1e4ea; }
.epc-modal-header h2 { margin:0; font-size:19px; }
.epc-modal-content { overflow:auto; padding: 16px 18px 22px; }
.epc-property-heading h2 { margin:0 0 3px; font-size:18px; }
.epc-property-heading p,.epc-source,.epc-loading { color:#647084; font-size:13px; }
.epc-summary { display:flex; flex-wrap:wrap; align-items:flex-start; gap:18px 26px; padding:12px; border:1px solid #e1e4ea; border-radius:9px; background:#f7f9fc; }
.epc-summary > div { min-width:90px; }
.epc-summary small { display:block; color:#657184; font-size:12px; }
.epc-summary strong { display:block; font-size:18px; }
.epc-summary .epc-address { flex:1 1 220px; }
.epc-summary .epc-address strong { font-size:16px; }
.epc-rating { display:inline-block; min-width:25px; padding:1px 6px; border-radius:4px; text-align:center; font-weight:800; }
.epc-certificate h3 { margin:15px 0 8px; font-size:15px; }
.epc-table-wrap { overflow:auto; }
.epc-fields { width:100%; border-collapse:collapse; font-size:13px; }
.epc-fields th,.epc-fields td { padding:8px; border-top:1px solid #e5e9ef; text-align:left; vertical-align:top; }
.epc-fields th { width:26%; font-weight:650; }
.epc-fields th small { display:block; color:#8791a0; font:10px ui-monospace,monospace; font-weight:400; }
.epc-fields td:nth-child(2) { min-width:120px; width:20%; font-variant-numeric:tabular-nums; }
.epc-fields td:nth-child(3) { color:#687589; font-size:12px; }
.epc-tabs { display:flex; flex-wrap:wrap; gap:6px; margin:12px 0; }
.epc-tab { border:1px solid #d7dee8; border-radius:18px; padding:6px 10px; background:#fff; color:#263449; cursor:pointer; font:inherit; font-size:12px; }
.epc-tab.active { border-color:#1f6feb; background:#e8f0fe; }
.epc-source { margin-top:14px; }
.epc-error { padding:12px; color:#b4233c; background:#fff1f2; border-radius:8px; }
@media(max-width:640px) { .epc-modal { padding:8px; } .epc-modal-card { max-height:96vh; } .epc-fields th,.epc-fields td { display:block; width:auto !important; min-width:0 !important; border-top:0; padding:2px 0; } .epc-fields tr { display:block; padding:8px 0; border-top:1px solid #e5e9ef; } }
