:root {
  --navy: #293241;
  --blue: #3D5A80;
  --lightblue: #99C1DA;
  --orange: #FF7F32;
  --offwhite: #DDE5ED;
  --bg: #DDE5ED;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Roboto', sans-serif; background: var(--bg); overflow: hidden; }
body { display: flex; flex-direction: column; }

/* ── HEADER ── */
.site-header {
  background: var(--navy);
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  z-index: 100;
}
.site-logo { display: flex; align-items: center; gap: 11px; text-decoration: none; flex-shrink: 0; }
.logo-icon, .brand-logo-default { width: 42px; height: 42px; background: var(--orange); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.logo-default-mark { font-size: 16px; font-weight: 700; color: white; }
.brand-logo-custom { display: block; background: transparent; width: auto; height: auto; max-height: 44px; max-width: 180px; object-fit: contain; }
.public-logo-custom { border-radius: 0; }
.logo-text .org { font-size: 15px; font-weight: 700; color: white; line-height: 1.2; letter-spacing: .02em; }
.logo-text .sub { font-size: 10px; font-weight: 300; color: var(--lightblue); letter-spacing: .08em; text-transform: uppercase; }
.header-stats { display: flex; gap: 18px; margin-left: auto; }
.hstat { text-align: center; }
.hstat-val { font-size: 18px; font-weight: 700; color: var(--orange); line-height: 1; }
.hstat-lbl { font-size: 10px; color: var(--lightblue); text-transform: uppercase; letter-spacing: .06em; margin-top: 1px; }
.btn-add {
  padding: 8px 18px; background: var(--orange); color: white;
  border: none; border-radius: 4px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: 'Roboto', sans-serif; white-space: nowrap;
  transition: background .15s; flex-shrink: 0;
}
.btn-add:hover { background: #e06b20; }

/* ── MOBILE BAR ── */
.mobile-bar { display: none; }
.filter-drawer { display: none; }

/* ── SEARCH BAR ── */
.search-bar {
  background: var(--navy);
  padding: 8px 16px;
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
  border-bottom: 3px solid var(--orange);
}
.search-bar input, .search-bar select {
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: 'Roboto', sans-serif;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px;
  background: rgba(255,255,255,.09);
  color: white;
  outline: none;
  transition: border-color .15s, background .15s;
}
.search-bar input::placeholder { color: rgba(255,255,255,.4); }
.search-bar input:focus, .search-bar select:focus {
  border-color: var(--orange);
  background: rgba(255,255,255,.13);
}
.search-bar select option { background: var(--navy); }
.search-bar input#search { flex: 1; min-width: 140px; }
.job-section {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,127,50,.12);
  border: 1px solid rgba(255,127,50,.4);
  border-radius: 4px;
  padding: 4px 9px;
  flex: 2; min-width: 220px;
}
.job-lbl { font-size: 11px; font-weight: 700; color: var(--orange); white-space: nowrap; }
.job-section input {
  flex: 1; border: none !important; background: transparent !important;
  color: white; font-size: 12px; padding: 3px 5px !important; min-width: 0;
}
.btn-search {
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  background: var(--orange); color: white; border: none;
  border-radius: 4px; cursor: pointer; font-family: 'Roboto', sans-serif;
  white-space: nowrap; transition: background .15s;
}
.btn-search:hover { background: #e06b20; }
.btn-ghost {
  padding: 5px 7px; font-size: 12px; background: transparent;
  border: 1px solid rgba(255,255,255,.2); border-radius: 4px;
  cursor: pointer; color: rgba(255,255,255,.6); transition: all .15s;
}
.btn-ghost:hover { border-color: rgba(255,255,255,.5); color: white; }
#job-status { font-size: 11px; color: var(--lightblue); white-space: nowrap; }
.view-toggle { display: flex; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.vbtn {
  padding: 6px 14px; font-size: 12px; font-weight: 500;
  background: transparent; border: none; cursor: pointer;
  color: rgba(255,255,255,.6); font-family: 'Roboto', sans-serif;
  transition: all .15s;
}
.vbtn.active { background: var(--orange); color: white; }

/* ── MAIN LAYOUT ── */
.main { display: flex; flex: 1; overflow: hidden; min-height: 0; }
#map-area { flex: 1; position: relative; display: flex; min-height: 0; }
#map { flex: 1; min-height: 0; z-index: 1; }
#list-view { flex: 1; overflow-y: auto; padding: 14px; display: none; background: var(--bg); }

/* ── SIDE PANEL ── */
#side-panel {
  width: 0; overflow: hidden;
  background: white;
  border-left: 3px solid var(--orange);
  display: flex; flex-direction: column;
  transition: width .22s ease;
  flex-shrink: 0;
}
#side-panel.open { width: 290px; }
.panel-header {
  background: var(--navy); padding: 13px 16px;
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.panel-header-title { font-size: 11px; font-weight: 700; color: var(--lightblue); text-transform: uppercase; letter-spacing: .06em; }
.panel-close { background: none; border: none; color: rgba(255,255,255,.4); font-size: 18px; cursor: pointer; line-height: 1; }
.panel-close:hover { color: white; }
.panel-body { overflow-y: auto; flex: 1; }
.panel-hint { padding: 24px 16px; font-size: 12px; color: #ccc; text-align: center; line-height: 1.7; }
.prop-price-bar {
  background: var(--navy); padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.prop-price { font-size: 18px; font-weight: 700; color: var(--orange); }
.prop-badge { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 3px; text-transform: uppercase; letter-spacing: .04em; }
.bm { background: #1a5fb4; color: white; }
.bw { background: #a0153e; color: white; }
.bc { background: #2d6a4f; color: white; }
.bu { background: #555; color: white; }
.prop-content { padding: 14px 16px; }
.prop-name { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 12px; line-height: 1.35; }
.prop-divider { border: none; border-top: 1px solid #f0f0f0; margin: 10px 0; }
.prop-row { display: flex; gap: 10px; margin-bottom: 7px; font-size: 12.5px; line-height: 1.4; }
.prop-lbl { color: #bbb; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; min-width: 36px; padding-top: 1px; flex-shrink: 0; }
.prop-val { color: #333; }
.prop-val a { color: var(--navy); text-decoration: none; font-weight: 500; }
.prop-val a:hover { color: var(--orange); }
.prop-cost-bar { background: #fff8f4; border-top: 1px solid #ffe4cc; border-bottom: 1px solid #ffe4cc; padding: 9px 16px; font-size: 13px; font-weight: 700; color: var(--orange); }
.dist-card { margin: 12px 16px; background: var(--navy); border-radius: 6px; padding: 11px 14px; }
.dist-label { font-size: 10px; font-weight: 700; color: var(--lightblue); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.dist-value { font-size: 22px; font-weight: 700; color: white; line-height: 1; }
.dist-unit { font-size: 12px; font-weight: 300; color: var(--lightblue); }
.dist-note { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 3px; }
.transit-btn {
  display: block; margin: 8px 16px;
  padding: 9px 14px; background: var(--orange); color: white;
  text-decoration: none; text-align: center;
  font-size: 12px; font-weight: 600; border-radius: 4px;
  transition: background .15s;
}
.transit-btn:hover { background: #e06b20; }

/* ── MAP LEGEND ── */
.map-legend {
  position: absolute; bottom: 28px; left: 10px;
  background: rgba(255,255,255,.96); border: 1px solid #ddd;
  border-radius: 6px; padding: 9px 12px; font-size: 11.5px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12); z-index: 500;
  border-top: 3px solid var(--orange); pointer-events: none;
}
.legend-title { font-weight: 700; color: var(--navy); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 7px; }
.legend-item { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; color: #444; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px rgba(0,0,0,.15); flex-shrink: 0; }
.legend-sep { border: none; border-top: 1px solid #eee; margin: 5px 0; }

/* ── LIST CARDS ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 10px; }
.h-card {
  background: white; border-radius: 7px;
  overflow: hidden; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  border-top: 3px solid transparent;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.h-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.15); transform: translateY(-1px); border-top-color: var(--orange); }
.h-card-top { background: var(--navy); padding: 9px 13px; display: flex; justify-content: space-between; align-items: center; }
.h-card-price { font-size: 15px; font-weight: 700; color: var(--orange); }
.h-card-body { padding: 11px 13px; }
.h-card-name { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 5px; line-height: 1.3; }
.h-card-meta { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 5px; }
.h-card-city { font-size: 10px; padding: 2px 7px; border-radius: 3px; background: var(--bg); color: #666; }
.h-card-detail { font-size: 11.5px; color: #888; margin-bottom: 3px; }

/* ── FOOTER ── */
.site-footer {
  background: var(--navy); padding: 6px 20px;
  font-size: 11px; color: rgba(255,255,255,.35);
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0;
}
.site-footer a { color: var(--lightblue); text-decoration: none; }
.site-footer a:hover { color: var(--orange); }

/* ── MODAL ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 9999; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: white; border-radius: 8px; width: 680px; max-width: 96vw; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.modal-head { background: var(--navy); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal-head h2 { font-size: 15px; font-weight: 600; color: white; }
.modal-head button { background: none; border: none; color: rgba(255,255,255,.5); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-head button:hover { color: white; }
.modal-accent { height: 3px; background: linear-gradient(90deg, var(--navy), var(--blue), var(--lightblue), var(--orange)); flex-shrink: 0; }
.modal-tabs { display: flex; background: #f8f9fa; border-bottom: 1px solid #eee; flex-shrink: 0; }
.mtab { padding: 10px 20px; font-size: 13px; font-weight: 500; cursor: pointer; color: #888; border: none; border-bottom: 3px solid transparent; background: none; font-family: 'Roboto', sans-serif; transition: all .15s; }
.mtab.active { color: var(--navy); border-bottom-color: var(--orange); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-tab-content { display: none; }
.modal-tab-content.active { display: block; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-row.full { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 11px; font-weight: 600; color: #999; text-transform: uppercase; letter-spacing: .04em; }
.form-group input, .form-group select, .form-group textarea { padding: 8px 11px; font-size: 13px; font-family: 'Roboto', sans-serif; border: 1px solid #ddd; border-radius: 4px; color: #333; outline: none; transition: border-color .15s; }
.form-group input:focus, .form-group select:focus { border-color: var(--orange); }
.form-status { font-size: 12px; padding: 8px 11px; border-radius: 4px; margin-bottom: 12px; display: none; }
.form-status.ok { background: #d1fae5; color: #065f46; display: block; }
.form-status.err { background: #fee2e2; color: #991b1b; display: block; }
.modal-footer { padding: 13px 20px; border-top: 1px solid #eee; display: flex; gap: 10px; justify-content: flex-end; flex-shrink: 0; background: #fafafa; }
.btn-primary { padding: 9px 22px; background: var(--orange); color: white; border: none; border-radius: 4px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: 'Roboto', sans-serif; transition: background .15s; }
.btn-primary:hover { background: #e06b20; }
.btn-secondary { padding: 9px 18px; background: white; color: #555; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; cursor: pointer; font-family: 'Roboto', sans-serif; }
.btn-secondary:hover { border-color: #bbb; }
.upload-zone { border: 2px dashed #ddd; border-radius: 6px; padding: 26px 20px; text-align: center; cursor: pointer; transition: all .2s; background: #fafafa; margin-bottom: 14px; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--orange); background: #fff8f4; }
.col-template { font-size: 11px; background: #f0f2f5; border-radius: 4px; padding: 10px 12px; margin-bottom: 14px; color: #555; line-height: 1.8; }
.col-template code { background: #e8e8e8; padding: 1px 5px; border-radius: 3px; }
.preview-wrap { max-height: 220px; overflow-y: auto; border: 1px solid #eee; border-radius: 4px; margin-top: 8px; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.preview-table th { background: var(--navy); color: white; padding: 6px 10px; text-align: left; font-weight: 500; position: sticky; top: 0; }
.preview-table td { padding: 5px 10px; border-bottom: 1px solid #f0f0f0; color: #333; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── MOBILE ── */
@media (max-width: 640px) {
  html, body { overflow: hidden; height: 100dvh; }
  .site-header { padding: 0 12px; height: 52px; gap: 8px; }
  .logo-text .org { font-size: 13px; }
  .logo-text .sub { display: none; }
  .header-stats { display: none; }
  .site-footer { display: none; }
  .search-bar { display: none !important; }

  .mobile-bar {
    display: flex; background: var(--navy);
    padding: 7px 10px; gap: 6px; align-items: center;
    border-bottom: 2px solid var(--orange); flex-shrink: 0;
  }
  .mobile-bar input {
    flex: 1; padding: 7px 10px; font-size: 14px;
    border: 1px solid rgba(255,255,255,.15); border-radius: 20px;
    background: rgba(255,255,255,.1); color: white; outline: none;
    font-family: 'Roboto', sans-serif;
  }
  .mobile-bar input::placeholder { color: rgba(255,255,255,.4); }
  .mobile-view-btns { display: flex; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; overflow: hidden; }
  .mvbtn { padding: 6px 12px; font-size: 12px; font-weight: 500; background: transparent; border: none; color: rgba(255,255,255,.6); cursor: pointer; font-family: 'Roboto', sans-serif; }
  .mvbtn.active { background: var(--orange); color: white; }
  .filter-toggle { padding: 6px 10px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); border-radius: 4px; color: white; cursor: pointer; font-size: 14px; }
  .btn-add-sm { padding: 6px 11px; background: var(--orange); color: white; border: none; border-radius: 4px; font-size: 13px; font-weight: 700; cursor: pointer; }
  .filter-drawer { background: var(--navy); padding: 0 10px; border-bottom: 1px solid rgba(255,255,255,.1); }
  .filter-drawer.open { display: flex; gap: 8px; padding: 8px 10px; }
  .filter-drawer select { flex: 1; padding: 6px 8px; font-size: 13px; border: 1px solid rgba(255,255,255,.15); border-radius: 4px; background: rgba(255,255,255,.1); color: white; font-family: 'Roboto', sans-serif; }
  .filter-drawer select option { background: var(--navy); }

  .main { flex-direction: column; }
  #map-area { flex: 1; min-height: 0; width: 100%; position: relative; }
  #map { width: 100%; height: 100%; }

  #side-panel {
    position: fixed !important;
    bottom: 0; left: 0; right: 0;
    width: 100% !important;
    height: 0; max-height: 68vh;
    border-left: none !important;
    border-top: 3px solid var(--orange);
    border-radius: 14px 14px 0 0;
    transition: height .25s ease !important;
    z-index: 800;
    box-shadow: 0 -4px 20px rgba(0,0,0,.2);
  }
  #side-panel.open { height: 68vh; width: 100% !important; }
  .panel-header { border-radius: 14px 14px 0 0; padding-top: 8px; }
  .panel-header::before { content: ''; display: block; width: 36px; height: 4px; background: rgba(255,255,255,.3); border-radius: 2px; margin: 0 auto 8px; }

  .map-legend { bottom: 10px; left: 8px; padding: 7px 10px; font-size: 10.5px; }
  .legend-title { font-size: 9px; }
  .legend-item { margin-bottom: 3px; gap: 6px; }

  #list-view { padding: 10px; }
  .card-grid { grid-template-columns: 1fr; }

  .modal-box { border-radius: 14px 14px 0 0; width: 100%; max-width: 100%; height: 92vh; }
  .modal-overlay { align-items: flex-end; }
  .form-row { grid-template-columns: 1fr; }
  .modal-body { padding: 14px; }
}
@media (max-width: 380px) {
  .mobile-view-btns { display: none; }
}

/* Custom uploaded public logo: prevent natural image size overflow */
.public-logo-custom,
.brand-logo-custom.public-logo-custom {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 180px !important;
  max-height: 44px !important;
  object-fit: contain;
  object-position: center;
  background: transparent !important;
  border-radius: 0 !important;
  flex: 0 0 auto;
}

.brand:has(.public-logo-custom),
.header-brand:has(.public-logo-custom),
.logo-wrap:has(.public-logo-custom) {
  display: flex;
  align-items: center;
  overflow: visible;
}
