:root {
  /* ── Cornerstone Brand Tokens ── */
  --brand:    #2CC0ED;
  --brand2:   #1AADD4;
  --gold:     #FCDE41;
  --gray:     #838488;
  --navy:     #1A3A5C;
  --red:      #E53E3E;
  --amber:    #E67E22;
  --green:    #27AE60;
  --white:    #FFFFFF;
  --bg:       #FFFFFF;
  --bg3:      #EEF7FC;
  --ink:      #1A3A5C;
  --text:     #3A5468;
  --text2:    #6D7B88;
  --mid:      #838488;
  --border:   #DDE8EE;
  --shadow:   0 2px 8px rgba(26,58,92,0.08);
  --shadow-md:0 4px 16px rgba(26,58,92,0.12);
  --radius:   10px;
  --font-body:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-brand:  'Outfit', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;

  /* ── Tier Colors (mapped to brand palette) ── */
  --gut: var(--red);      --gut-bg: #fde8e8;
  --heavy: var(--amber);  --heavy-bg: #fdebd0;
  --standard: #b7770d;    --standard-bg: #fef9e7;
  --cosmetic: var(--green); --cosmetic-bg: #e8f8f0;
  --unscored: var(--mid); --unscored-bg: #f0f0f0;
  /* Legacy aliases */
  --blue: var(--brand); --blue-dk: var(--brand2); --blue-lt: var(--bg3);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ── Cornerstone App Header ─────────────────────────────── */
.app-header {
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  height: 64px;
  flex-shrink: 0;
  border-bottom: 3px solid var(--brand);
  box-shadow: 0 2px 8px rgba(44,192,237,0.10);
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand-logo img { height: 40px; width: auto; display: block; }
.brand-divider { width: 1px; height: 32px; background: var(--border); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-family: var(--font-brand); font-size: 13px; font-weight: 700;
  color: var(--gray); letter-spacing: 0.02em;
}
.brand-sub {
  font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--brand); font-weight: 600; margin-top: 2px;
}
.header-right { display: flex; align-items: center; gap: 10px; }

/* Breadcrumb inside header */
#breadcrumb {
  display: flex; align-items: center; gap: 6px; flex: 1;
  font-size: 13px; color: var(--text2); min-width: 0; margin: 0 16px;
}
#breadcrumb .crumb { cursor: pointer; color: var(--brand); font-weight: 500; }
#breadcrumb .crumb:hover { text-decoration: underline; }
#breadcrumb .sep { opacity: .5; }

/* ── Property Switcher ──────────────────────────────── */
#prop-switcher-wrap { position: relative; display: flex; align-items: center; gap: 8px; }
#prop-switcher-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--bg3); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 6px 11px; cursor: pointer;
  font-family: var(--font-brand); font-size: 13px; font-weight: 700; color: var(--ink);
  transition: border-color .15s, box-shadow .15s; white-space: nowrap;
}
#prop-switcher-btn:hover { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(44,192,237,.15); }
#prop-switcher-btn .ps-caret { font-size: 10px; color: var(--brand); margin-left: 2px; }
#prop-switcher-btn .ps-badge {
  background: var(--brand); color: #fff; font-size: 9px; font-weight: 800;
  padding: 2px 6px; border-radius: 8px; letter-spacing: .04em;
}
#prop-new-btn {
  display: flex; align-items: center; gap: 4px;
  background: var(--brand); color: #fff; border: none; border-radius: 8px;
  padding: 6px 12px; cursor: pointer; font-size: 11px; font-weight: 800;
  letter-spacing: .04em; white-space: nowrap; transition: background .15s;
}
#prop-new-btn:hover { background: var(--brand2); }
#prop-switcher-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 2000;
  background: var(--white); border: 1.5px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-md); min-width: 280px; overflow: hidden;
}
#prop-switcher-dropdown.open { display: block; }
.ps-dropdown-header {
  background: var(--gray); color: #fff; font-family: var(--font-brand);
  font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 8px 14px;
}
.ps-prop-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  cursor: pointer; border-bottom: 1px solid var(--border); transition: background .1s;
}
.ps-prop-item:last-child { border-bottom: none; }
.ps-prop-item:hover { background: var(--bg3); }
.ps-prop-item.active { background: #edf9fe; }
.ps-prop-check { color: var(--brand); font-size: 14px; width: 16px; flex-shrink: 0; }
.ps-prop-info { flex: 1; min-width: 0; }
.ps-prop-name { font-weight: 700; font-size: 13px; color: var(--ink); }
.ps-prop-meta { font-size: 11px; color: var(--text2); margin-top: 1px; }
.ps-prop-status {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 8px;
  background: var(--heavy-bg); color: var(--amber); flex-shrink: 0;
}
.ps-prop-status.dd    { background: #e3f2fd; color: var(--brand); }
.ps-prop-status.live  { background: var(--cosmetic-bg); color: var(--green); }
.ps-add-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  cursor: pointer; color: var(--brand); font-weight: 700; font-size: 12px;
  transition: background .1s;
}
.ps-add-row:hover { background: var(--bg3); }

/* ── Tab Navigation Strip ───────────────────────────────── */
.tab-nav {
  background: var(--brand);
  display: flex; flex-shrink: 0; padding: 0 8px; gap: 2px;
}
.tab-nav .tab {
  background: transparent; border: none; color: #FFFFFF; opacity: 0.78;
  padding: 10px 18px; font-family: var(--font-body); font-size: 11px;
  font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; transition: opacity 0.15s; display: flex; align-items: center;
  gap: 7px; white-space: nowrap; -webkit-font-smoothing: antialiased;
}
.tab-nav .tab:hover { opacity: 1; }
.tab-nav .tab.active {
  color: #4a4b4e; background: var(--white); border-radius: 6px 6px 0 0;
  font-weight: 800; opacity: 1; margin-bottom: -1px; padding-bottom: 11px;
  -webkit-font-smoothing: antialiased;
}
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 5px; border-radius: 8px;
  font-size: 9px; font-weight: 800; line-height: 1;
  background: var(--red); color: var(--white);
}
.tab-badge.gold { background: var(--gold); color: #5a3e00; }

/* ── Action buttons (header) ─────────────────────────────── */
.btn-action {
  background: transparent; border: 1px solid rgba(44,192,237,0.4);
  color: var(--brand); padding: 5px 13px; border-radius: 5px;
  cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; transition: all 0.15s; font-family: var(--font-body);
}
.btn-action:hover { background: rgba(44,192,237,0.10); border-color: var(--brand); }

/* ── STATS BAR ─────────────────────────────────────────── */
#statsbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; gap: 0; overflow-x: auto; flex-shrink: 0;
}
.stat-item {
  flex: 1; min-width: 120px; padding: 10px 20px; border-right: 1px solid var(--border);
  text-align: center;
}
.stat-item:last-child { border-right: none; }
.stat-label { font-size: 11px; color: var(--mid); text-transform: uppercase; letter-spacing: .6px; font-family: var(--font-brand); font-weight: 700; }
.stat-value { font-size: 20px; font-weight: 800; color: var(--brand); line-height: 1.3; font-family: var(--font-brand); }
.stat-sub { font-size: 11px; color: var(--text2); }

/* ── MAIN ── */
#main { flex: 1; display: flex; overflow: hidden; position: relative; }

/* ── MAP VIEW ── */
#map-view { width: 100%; height: 100%; display: flex; }
#map-container { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }
#map-placeholder {
  width: 100%; height: 100%; background: #e8edf4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: #666;
}
#map-placeholder h3 { color: var(--blue); }
.api-key-box {
  background: #fff; border-radius: var(--radius); padding: 20px 28px;
  box-shadow: var(--shadow); max-width: 440px; width: 90%; text-align: center;
}
.api-key-box p { font-size: 14px; color: #555; margin-bottom: 12px; line-height: 1.5; }
.api-key-box input {
  width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 6px;
  font-size: 14px; margin-bottom: 10px; font-family: monospace;
}
.api-key-box button {
  background: var(--blue); color: #fff; border: none; border-radius: 6px;
  padding: 9px 24px; cursor: pointer; font-size: 14px; width: 100%;
}
.api-key-box button:hover { background: var(--blue-dk); }

#map-sidebar {
  width: 320px; background: #fff; border-left: 1px solid #e0e0e0;
  overflow-y: auto; display: flex; flex-direction: column;
}
.sidebar-header {
  background: var(--blue); color: #fff; padding: 16px 18px;
  font-size: 15px; font-weight: 600;
}
.sidebar-header small { opacity: .7; font-weight: 400; font-size: 12px; display: block; margin-top: 2px; }
.building-card {
  padding: 14px 18px; border-bottom: 1px solid #f0f0f0; cursor: pointer;
  transition: background .12s;
}
.building-card:hover { background: var(--blue-lt); }
.building-card h4 { font-size: 14px; color: var(--blue); margin-bottom: 4px; }
.building-card .bc-stats { display: flex; gap: 12px; font-size: 12px; color: #666; }
.building-card .tier-chips { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }

/* ── TIER CHIP ── */
.tier-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; white-space: nowrap;
}
.tier-gut     { background: var(--gut-bg);      color: var(--gut); }
.tier-heavy   { background: var(--heavy-bg);    color: var(--heavy); }
.tier-standard{ background: var(--standard-bg); color: var(--standard); }
.tier-cosmetic{ background: var(--cosmetic-bg); color: var(--cosmetic); }
.tier-unscored{ background: var(--unscored-bg); color: var(--unscored); }

/* ── ISSUE PANEL ── */
.issue-section { padding: 16px 18px; border-top: 2px solid #e3f2fd; }
.issue-section h5 { font-size: 13px; color: #555; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.issue-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid #f5f5f5; font-size: 12px;
}
.issue-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 2px; flex-shrink: 0; }
.issue-dot.sev-high { background: #d32f2f; }
.issue-dot.sev-med  { background: #f57c00; }
.issue-dot.sev-low  { background: #388e3c; }
.issue-meta { color: #999; font-size: 11px; margin-top: 2px; }
.btn-tag-issue {
  display: block; width: calc(100% - 36px); margin: 12px 18px; padding: 9px;
  background: var(--blue); color: #fff; border: none; border-radius: 6px;
  cursor: pointer; font-size: 13px; text-align: center; transition: background .15s;
}
.btn-tag-issue:hover { background: var(--blue-dk); }
.btn-tag-issue.active { background: #d32f2f; }

/* ── BUILDING VIEW ── */
#building-view { width: 100%; overflow-y: auto; padding: 24px; }
.view-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.view-header h2 { font-size: 22px; color: var(--blue); }
.view-header .meta { font-size: 13px; color: #888; }
.view-tabs { display: flex; gap: 2px; margin-bottom: 20px; border-bottom: 2px solid #e0e0e0; }
.tab-btn {
  padding: 10px 22px; cursor: pointer; font-size: 14px; color: #666; border: none;
  background: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all .15s;
}
.tab-btn.active { color: var(--blue); font-weight: 600; border-bottom-color: var(--blue); }

/* ── UNIT GRID ── */
#unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.unit-card {
  background: #fff; border-radius: var(--radius); padding: 14px;
  cursor: pointer; box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s;
  border-top: 4px solid transparent; position: relative;
}
.unit-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.unit-card.gut      { border-top-color: var(--gut); }
.unit-card.heavy    { border-top-color: var(--heavy); }
.unit-card.standard { border-top-color: var(--standard); }
.unit-card.cosmetic { border-top-color: var(--cosmetic); }
.unit-card.unscored { border-top-color: #bbb; }
.unit-card h4 { font-size: 16px; font-weight: 700; color: #1a1a2e; }
.unit-card .unit-type { font-size: 11px; color: #888; margin-bottom: 8px; }
.unit-card .unit-score { font-size: 22px; font-weight: 700; line-height: 1; }
.unit-card .unit-score-label { font-size: 10px; color: #888; margin-bottom: 6px; }
.unit-card .unit-est { font-size: 13px; font-weight: 600; color: #333; }
.unit-card .unit-pct { font-size: 11px; color: #aaa; margin-top: 4px; }

/* ── DD CHECKLIST ── */
#dd-checklist { max-width: 700px; }
.dd-section { background: #fff; border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.dd-section h4 { font-size: 14px; color: var(--blue); margin-bottom: 12px; font-weight: 600; border-bottom: 1px solid #e3f2fd; padding-bottom: 8px; }
.dd-item { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f5f5f5; }
.dd-item:last-child { border-bottom: none; }
.dd-item label { font-size: 13px; cursor: pointer; flex: 1; }
.dd-item select {
  font-size: 12px; padding: 3px 8px; border: 1px solid #ddd; border-radius: 4px;
  color: #555; background: #fafafa; cursor: pointer;
}
.dd-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.dd-done     { background: #c8e6c9; color: #1b5e20; }
.dd-progress { background: #fff9c4; color: #f57f17; }
.dd-todo     { background: #f5f5f5; color: #888; }
.dd-url-row  { display: flex; align-items: center; gap: 6px; margin-top: 4px; padding-left: 2px; }
.dd-url-input { font-size: 11px; border: 1px solid #e0e0e0; border-radius: 4px; padding: 3px 7px;
  color: var(--ink); width: 200px; font-family: var(--font-body); background: #fafafa; }
.dd-url-input:focus { outline: none; border-color: var(--brand); background: #fff; }
.dd-url-link { font-size: 11px; color: var(--brand); text-decoration: none; white-space: nowrap; }
.dd-url-link:hover { text-decoration: underline; }

/* ── UNIT VIEW ── */
#unit-view { width: 100%; overflow-y: auto; padding: 24px; }
.unit-detail-header {
  background: #fff; border-radius: var(--radius); padding: 20px 24px;
  box-shadow: var(--shadow); margin-bottom: 20px; display: flex; gap: 24px; flex-wrap: wrap;
}
.udh-main { flex: 1; min-width: 220px; }
.udh-main h2 { font-size: 26px; font-weight: 800; color: var(--blue); }
.udh-main .unit-address { font-size: 13px; color: #888; margin-bottom: 10px; }
.udh-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.udh-stat { background: var(--blue-lt); border-radius: 8px; padding: 10px 14px; }
.udh-stat .lbl { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: .5px; }
.udh-stat .val { font-size: 18px; font-weight: 700; color: var(--blue); }
.udh-tier { min-width: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.tier-badge-big { font-size: 15px; font-weight: 700; padding: 8px 20px; border-radius: 20px; text-align: center; }
.udh-links { display: flex; flex-direction: column; gap: 6px; min-width: 160px; justify-content: center; }
.link-btn {
  display: block; padding: 8px 14px; background: var(--blue); color: #fff; border-radius: 6px;
  font-size: 12px; text-decoration: none; text-align: center; transition: background .15s;
}
.link-btn:hover { background: var(--blue-dk); }
.link-btn.secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.link-btn.secondary:hover { background: var(--blue-lt); }

.scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 20px; }
.scope-area-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.scope-area-header {
  background: var(--blue); color: #fff; padding: 10px 16px;
  font-size: 13px; font-weight: 600; display: flex; justify-content: space-between;
}
.scope-area-body { padding: 0; }
.scope-row {
  display: grid; grid-template-columns: 1fr 40px 60px 26px; gap: 8px;
  padding: 7px 14px; border-bottom: 1px solid #f5f5f5; font-size: 12px; align-items: center;
}
.scope-row:last-child { border-bottom: none; }
.scope-row .item-name { color: #444; }
.scope-row .cond-score {
  text-align: center; font-weight: 700; font-size: 13px;
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}
.score-5 { background: var(--cosmetic-bg); color: var(--cosmetic); }
.score-4 { background: var(--cosmetic-bg); color: var(--cosmetic); }
.score-3 { background: var(--standard-bg); color: var(--standard); }
.score-2 { background: var(--heavy-bg); color: var(--heavy); }
.score-1 { background: var(--gut-bg); color: var(--gut); }
.score-0 { background: #eee; color: #aaa; }
.scope-row .line-est { font-size: 11px; color: #666; text-align: right; }

/* ── PHOTO CAPTURE BUTTON (on each scope row) ── */
.photo-btn {
  background: none; border: none; cursor: pointer; font-size: 14px;
  padding: 2px; line-height: 1; opacity: 0.35; transition: opacity .15s;
  display: flex; align-items: center; justify-content: center;
}
.photo-btn:hover  { opacity: 1; }
.photo-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.photo-slot.filled-thumb { border: 2px solid var(--brand); padding: 2px; }
.photo-slot.filled-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }

/* ── PHOTO TOAST NOTIFICATION ── */
#photo-toast {
  position: fixed; bottom: 76px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--navy); color: #fff; border-radius: 20px;
  padding: 10px 20px; font-size: 13px; font-family: var(--font-body);
  box-shadow: 0 4px 20px rgba(0,0,0,.35); z-index: 9999;
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; max-width: 88vw; text-align: center;
}
#photo-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#photo-toast.t-success { background: var(--green); }
#photo-toast.t-warn    { background: var(--amber); }
#photo-toast.t-error   { background: var(--red); }

/* PHOTOS */
.photos-section { background: #fff; border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 20px; }
.photos-section h4 { font-size: 14px; color: var(--blue); margin-bottom: 14px; }
.photos-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-slot {
  width: 110px; height: 80px; border: 2px dashed #ccc; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; color: #bbb; font-size: 11px; text-align: center; gap: 4px;
  transition: border-color .15s, color .15s;
}
.photo-slot:hover { border-color: var(--blue); color: var(--blue); }
.photo-slot svg { width: 24px; height: 24px; }
.photo-slot.filled { border: none; overflow: hidden; }
.photo-slot.filled img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }

/* MODAL */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 2000;
  display: none; align-items: center; justify-content: center;
}
#modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius); padding: 24px 28px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25); max-width: 440px; width: 90%;
}
.modal-box h3 { font-size: 16px; color: var(--blue); margin-bottom: 16px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; color: #555; margin-bottom: 4px; font-weight: 600; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px;
  font-size: 13px; font-family: inherit;
}
.form-row textarea { resize: vertical; min-height: 70px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.btn-primary { background: var(--blue); color: #fff; border: none; border-radius: 6px; padding: 9px 22px; cursor: pointer; font-size: 13px; }
.btn-primary:hover { background: var(--blue-dk); }
.btn-cancel { background: #fff; color: #555; border: 1px solid #ccc; border-radius: 6px; padding: 9px 18px; cursor: pointer; font-size: 13px; }

/* ── COMMON AREAS ── */
.ca-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ca-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s;
  border-left: 5px solid #ccc;
}
.ca-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.ca-card.score-great { border-left-color: var(--cosmetic); }
.ca-card.score-good  { border-left-color: var(--cosmetic); }
.ca-card.score-fair  { border-left-color: var(--standard); }
.ca-card.score-poor  { border-left-color: var(--heavy); }
.ca-card.score-bad   { border-left-color: var(--gut); }
.ca-header {
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: flex-start;
}
.ca-icon-name { display: flex; align-items: center; gap: 8px; }
.ca-icon { font-size: 20px; line-height: 1; }
.ca-name { font-size: 14px; font-weight: 700; color: #1a1a2e; }
.ca-meta { font-size: 11px; color: #888; margin-top: 2px; }
.ca-score-badge {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 14px; font-weight: 800; flex-shrink: 0;
}
.ca-footer {
  padding: 8px 16px 12px; display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid #f0f0f0;
}
.ca-est { font-size: 13px; font-weight: 700; color: #333; }
.ca-status { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.ca-expand-body {
  border-top: 1px solid #e8e8e8; max-height: 0; overflow: hidden;
  transition: max-height .35s ease;
}
.ca-expand-body.open { max-height: 700px; }
.ca-scope-row {
  display: grid; grid-template-columns: 1fr 32px 56px; gap: 8px;
  padding: 6px 16px; border-bottom: 1px solid #f8f8f8; font-size: 12px; align-items: center;
}
.ca-scope-row:last-child { border-bottom: none; }
.ca-photos { padding: 10px 16px 14px; border-top: 1px solid #f0f0f0; }
.ca-photos-label { font-size: 11px; color: #888; margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.ca-photo-row { display: flex; gap: 8px; }
.ca-photo-slot {
  width: 64px; height: 48px; border: 2px dashed #ddd; border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; color: #ccc; font-size: 10px; text-align: center; gap: 2px;
  transition: border-color .15s, color .15s;
}
.ca-photo-slot:hover { border-color: var(--blue); color: var(--blue); }
.ca-expand-hint { font-size: 11px; color: #aaa; text-align: right; padding: 0 16px 8px; }

/* ── BUILDING DASHBOARD STYLES ───────────────────────────────────── */
.bdd-section {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px; overflow: hidden;
}
.bdd-section-header {
  background: var(--gray); color: #fff; font-family: var(--font-brand);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 9px 16px; display: flex; align-items: center; justify-content: space-between;
}
.bdd-section-header span { color: var(--gold); font-size: 12px; }
.bdd-body { padding: 14px 16px; }
.bdd-row {
  display: grid; grid-template-columns: 180px 1fr auto;
  align-items: start; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--border); font-size: 13px;
}
.bdd-row:last-child { border-bottom: none; }
.bdd-label { color: var(--text2); font-weight: 600; font-size: 12px; padding-top: 2px; }
.bdd-value { color: var(--ink); }
.bdd-value input, .bdd-value select, .bdd-value textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 5px;
  padding: 5px 8px; font-size: 12px; font-family: var(--font-body);
  color: var(--ink); background: var(--white);
}
.bdd-value textarea { resize: vertical; min-height: 52px; }
.bdd-value input:focus, .bdd-value select:focus, .bdd-value textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px rgba(44,192,237,0.15);
}
.bdd-score {
  display: flex; gap: 3px; align-items: center; flex-shrink: 0;
}
.bdd-score-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid #ddd;
  cursor: pointer; font-size: 11px; font-weight: 800; display: flex; align-items: center;
  justify-content: center; transition: all .12s; background: #f5f5f5; color: #999;
}
.bdd-score-btn.s1.sel { background:#fde8e8; border-color:var(--red);   color:var(--red);   }
.bdd-score-btn.s2.sel { background:#fdebd0; border-color:var(--amber); color:var(--amber); }
.bdd-score-btn.s3.sel { background:#fef9e7; border-color:#b7770d;      color:#b7770d;      }
.bdd-score-btn.s4.sel { background:#e8f8f0; border-color:var(--green); color:var(--green); }
.bdd-score-btn.s5.sel { background:#d4f5e3; border-color:var(--green); color:var(--green); }
.bdd-score-btn:hover  { border-color: var(--brand); color: var(--brand); background: var(--bg3); }
.bdd-photo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.bdd-photo-slot {
  width: 80px; height: 60px; border: 2px dashed var(--border); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: #ccc; font-size: 22px; transition: border-color .15s, color .15s; position: relative;
  overflow: hidden; background: #fafafa;
}
.bdd-photo-slot:hover { border-color: var(--brand); color: var(--brand); }
.bdd-photo-slot img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.bdd-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 600; }
.bdd-tag.na  { background:#f0f0f0; color:#888; }
.bdd-tag.good { background: var(--cosmetic-bg); color: var(--green); }
.bdd-tag.fair { background: var(--standard-bg); color: #b7770d; }
.bdd-tag.poor { background: var(--heavy-bg); color: var(--amber); }
.bdd-tag.crit { background: var(--gut-bg); color: var(--red); }
.bdd-save-btn {
  background: var(--brand); color: #fff; border: none; border-radius: 6px;
  padding: 8px 20px; font-size: 12px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; cursor: pointer; font-family: var(--font-body);
  transition: background .15s;
}
.bdd-save-btn:hover { background: var(--brand2); }

/* HIDDEN */
.hidden { display: none !important; }

/* ── OVERVIEW TAB STYLES ────────────────────────────────── */
#overview-view { width: 100%; overflow-y: auto; padding: 24px; background: var(--bg); }

/* KPI row */
.ov-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.ov-kpi-card {
  background: var(--white); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  border-top: 3px solid var(--brand);
}
.ov-kpi-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--mid); font-family: var(--font-brand); font-weight: 700; margin-bottom: 6px;
}
.ov-kpi-value {
  font-family: var(--font-brand); font-size: 26px; font-weight: 800;
  color: var(--ink); line-height: 1.1;
}
.ov-kpi-value.brand { color: var(--brand); }
.ov-kpi-value.red   { color: var(--red); }
.ov-kpi-value.green { color: var(--green); }
.ov-kpi-value.amber { color: var(--amber); }
.ov-kpi-sub {
  font-size: 11px; color: var(--text2); margin-top: 4px;
}

/* Two-col grid */
.ov-grid-2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 0;
}
@media (max-width: 800px) { .ov-grid-2 { grid-template-columns: 1fr; } }

/* Card wrapper */
.ov-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 0;
}
.ov-card-body { padding: 16px 18px; }

/* Tier breakdown bars */
.ov-tier-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ov-tier-row:last-child { margin-bottom: 0; }
.ov-tier-label { font-size: 12px; font-weight: 600; min-width: 120px; }
.ov-tier-bar-wrap { flex: 1; background: var(--border); border-radius: 100px; height: 10px; overflow: hidden; }
.ov-tier-bar { height: 100%; border-radius: 100px; transition: width .5s ease; }
.ov-tier-count { font-size: 12px; color: var(--text2); min-width: 50px; text-align: right; }
.ov-tier-est { font-size: 11px; color: var(--mid); min-width: 64px; text-align: right; font-family: var(--font-mono); }

/* Building comparison */
.ov-bld-card {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 14px 16px; margin-bottom: 10px;
}
.ov-bld-card:last-child { margin-bottom: 0; }
.ov-bld-title { font-family: var(--font-brand); font-size: 15px; font-weight: 800; color: var(--brand); margin-bottom: 6px; }
.ov-bld-meta { font-size: 12px; color: var(--text2); margin-bottom: 8px; }
.ov-bld-chips { display: flex; gap: 4px; flex-wrap: wrap; }

/* Top 10 table */
.ov-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ov-table th { background: var(--bg3); color: var(--ink); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; padding: 8px 12px; text-align: left; }
.ov-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.ov-table tr:last-child td { border-bottom: none; }
.ov-table tr:hover td { background: var(--bg3); cursor: pointer; }
.ov-table .est-col { font-family: var(--font-mono); color: var(--brand); font-weight: 600; }

/* Quick links */
.ov-links-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.ov-link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 7px; font-size: 12px; font-weight: 700;
  text-decoration: none; cursor: pointer; transition: all .15s;
  font-family: var(--font-body); letter-spacing: .03em;
  background: var(--brand); color: var(--white); border: none;
}
.ov-link-btn:hover { background: var(--brand2); }
.ov-link-btn.secondary {
  background: transparent; color: var(--brand);
  border: 1.5px solid rgba(44,192,237,0.35);
}
.ov-link-btn.secondary:hover { background: var(--bg3); border-color: var(--brand); }

/* Overview card header reuse */
#overview-view .card-header { border-radius: 0; margin-bottom: 0; }

/* ── LIVE DATA CONNECT PANEL ────────────────────────────── */
#data-mode-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 20px; font-size: 10px;
  font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  cursor: pointer; border: none; font-family: var(--font-body);
  transition: all .15s;
}
#data-mode-badge.mock  { background: #f0f0f2; color: var(--mid); }
#data-mode-badge.live  { background: #e6f9f0; color: var(--green); }
#data-mode-badge.loading { background: #e3f2fd; color: var(--brand); }
#data-mode-badge.error { background: #fde8e8; color: var(--red); }

#live-data-panel {
  position: fixed; top: 72px; right: 16px; z-index: 1000;
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-md); border: 1px solid var(--border);
  padding: 16px 18px; width: 380px; display: none;
}
#live-data-panel.open { display: block; }
#live-data-panel h4 {
  font-family: var(--font-brand); font-size: 14px; font-weight: 800;
  color: var(--ink); margin-bottom: 6px;
}
#live-data-panel p { font-size: 12px; color: var(--text2); margin-bottom: 12px; line-height: 1.5; }
#live-data-panel input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 12px; font-family: var(--font-mono);
  margin-bottom: 10px; color: var(--ink);
}
#live-data-panel input:focus { outline: none; border-color: var(--brand); }
.ldp-actions { display: flex; gap: 8px; }
.ldp-btn {
  flex: 1; padding: 8px; border-radius: 6px; font-size: 12px;
  font-weight: 700; cursor: pointer; border: none; font-family: var(--font-body);
  transition: all .15s;
}
.ldp-btn.primary { background: var(--brand); color: var(--white); }
.ldp-btn.primary:hover { background: var(--brand2); }
.ldp-btn.secondary { background: transparent; color: var(--mid); border: 1px solid var(--border); }
.ldp-btn.secondary:hover { background: var(--bg3); }
#ldp-status { font-size: 11px; margin-top: 8px; min-height: 16px; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f4f6fb; }
::-webkit-scrollbar-thumb { background: #c5cfe0; border-radius: 3px; }

/* BACK BTN */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--blue); cursor: pointer; font-size: 13px; margin-bottom: 16px;
  padding: 6px 12px; border: 1px solid #c5d8f5; border-radius: 6px;
  background: #fff; box-shadow: var(--shadow); transition: background .12s;
}
.back-btn:hover { background: var(--blue-lt); }

@media (max-width: 700px) {
  #map-sidebar { display: none; }
  #unit-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .unit-detail-header { flex-direction: column; }
}
