* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  display: flex;
  height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  color: #1a1a1a;
}

#sidebar {
  width: 360px;
  min-width: 300px;
  max-width: 400px;
  padding: 18px 16px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
  box-shadow: 2px 0 8px rgba(0,0,0,.07);
}

h1 {
  font-size: 19px;
  font-weight: 700;
  color: #1c3a6e;
}

.subtitle {
  color: #555;
  font-size: 12px;
  line-height: 1.5;
}

/* ---- Search ---- */
#search-box {
  display: flex;
  gap: 6px;
}

#address-input {
  flex: 1;
  padding: 9px 11px;
  border: 1.5px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
#address-input:focus { border-color: #1c3a6e; }

#search-btn {
  padding: 9px 14px;
  background: #1c3a6e;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
  transition: background .15s;
}
#search-btn:hover { background: #2a5298; }

#suggestions {
  list-style: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  display: none;
}
#suggestions.visible { display: block; }
#suggestions li {
  padding: 8px 11px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}
#suggestions li:last-child { border-bottom: none; }
#suggestions li:hover { background: #f5f7ff; }

/* ---- Loading ---- */
#loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1c3a6e;
  font-size: 13px;
  padding: 4px 0;
}
#loading.hidden { display: none; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid #c5d3ef;
  border-top-color: #1c3a6e;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Error ---- */
#error-box {
  background: #fff0f0;
  border: 1.5px solid #ffcdd2;
  border-radius: 6px;
  padding: 10px 12px;
  color: #c62828;
  font-size: 13px;
  line-height: 1.5;
}
#error-box.hidden { display: none; }

/* ---- Results panel ---- */
#results-panel.hidden { display: none; }

#address-header {
  font-size: 12px;
  color: #666;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
  line-height: 1.4;
}

/* ---- Consensus ---- */
#consensus-box {
  background: #f0f5ff;
  border: 1.5px solid #c5d3ef;
  border-radius: 8px;
  padding: 10px 13px;
}
#consensus-box.hidden { display: none; }

.consensus-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #555;
  margin-bottom: 4px;
}

#consensus-value {
  font-size: 28px;
  font-weight: 800;
  color: #1c3a6e;
  line-height: 1.1;
}

.consensus-ok  { color: #1c6e3e; }
.consensus-warn { color: #7a5c00; }

#consensus-note {
  font-size: 11px;
  color: #666;
  margin-top: 3px;
}

/* ---- Source cards ---- */
#source-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.src-card {
  border-radius: 8px;
  border: 1.5px solid #ddd;
  overflow: hidden;
}

.src-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

.src-card-body {
  padding: 9px 11px 10px;
  background: #fff;
}

/* Source colour themes */
.src-google .src-card-header  { background: #e8f0fe; color: #1a56b0; border-bottom: 1px solid #c5d6f5; }
.src-lod2   .src-card-header  { background: #e6f4ea; color: #1a6e3e; border-bottom: 1px solid #b7dfbf; }
.src-egib   .src-card-header  { background: #fef3e2; color: #7a4c00; border-bottom: 1px solid #f4c97a; }

.src-google { border-color: #c5d6f5; }
.src-lod2   { border-color: #b7dfbf; }
.src-egib   { border-color: #f4c97a; }

/* error state */
.src-card.no-data .src-card-header { background: #f5f5f5; color: #888; border-bottom: 1px solid #e0e0e0; }
.src-card.no-data { border-color: #e0e0e0; }

.src-badge {
  display: inline-block;
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: rgba(255,255,255,.55);
}

.src-date {
  margin-left: auto;
  font-size: 10px;
  font-weight: 400;
  opacity: .7;
  white-space: nowrap;
}

.src-area {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  color: #1a1a1a;
}

.src-area-label {
  font-size: 11px;
  color: #888;
  margin-bottom: 2px;
}

.src-area-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 5px;
}

.src-ground {
  font-size: 13px;
  color: #555;
}

.src-quality {
  font-size: 11px;
  color: #666;
  line-height: 1.5;
  margin-top: 3px;
}

.src-error {
  font-size: 12px;
  color: #888;
  font-style: italic;
}

.badge-estimated {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  margin-top: 4px;
}

/* segments mini-table */
.segs-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 11px;
}
.segs-table th, .segs-table td {
  padding: 3px 5px;
  text-align: right;
  border-bottom: 1px solid #eee;
}
.segs-table th { font-weight: 600; color: #444; background: #f8f8f8; }
.segs-table td:first-child { font-weight: 600; }

/* ---- Map ---- */
#map {
  flex: 1;
  height: 100%;
}
