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

html, body { height: 100%; font-family: monospace; background: #0a0e14; color: rgba(200,220,255,0.9); }

#shell { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; height: 100dvh; }

.map-row { grid-row: 2; position: relative; min-height: 0; overflow: hidden; }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
#topbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  padding: 8px 14px; background: #0f1520;
  border-bottom: 1px solid rgba(100,180,255,0.15);
  overflow-x: auto;
}
.topbar-sep { color: rgba(100,150,200,0.3); font-size: 12px; flex-shrink: 0; }
.logo { font-size: 13px; font-weight: 700; color: #00d4ff; letter-spacing: 0.07em; flex-shrink: 0; }

.ctl {
  background: #151d2e; border: 1px solid rgba(100,180,255,0.25);
  color: #ddeeff; font-family: monospace; font-size: 11px;
  padding: 5px 8px; border-radius: 4px; outline: none; cursor: pointer;
  flex-shrink: 0;
}

.btn-outline {
  background: transparent; color: rgba(180,210,240,0.7); font-family: monospace;
  font-weight: 700; font-size: 11px; padding: 5px 14px; border-radius: 4px;
  border: 1px solid rgba(100,180,255,0.25); cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.btn-outline:hover { background: rgba(100,180,255,0.08); }
.btn-outline.active { background: rgba(255,59,92,0.12); border-color: rgba(255,59,92,0.4); color: #ff5f6d; }

.docs-link {
  color: rgba(100,150,200,0.6); font-family: monospace; font-size: 11px;
  text-decoration: none; white-space: nowrap; flex-shrink: 0; padding: 5px 8px;
  border: 1px solid rgba(100,180,255,0.2); border-radius: 4px;
}

.topbar-stats {
  font-size: 10px; color: rgba(100,150,200,0.5); margin-left: auto;
  white-space: nowrap; flex-shrink: 0;
}
.topbar-stats #resultCount { color: #00d4ff; font-weight: 700; }

#mobileMenuBtn {
  display: none; background: transparent; border: none; color: rgba(180,210,240,0.85);
  font-size: 20px; cursor: pointer; flex-shrink: 0; margin-left: 8px;
}

#mobileDrawer {
  display: none;
}

/* ── Map ────────────────────────────────────────────────────────────────── */
#map { height: 100%; width: 100%; }

#legend {
  position: absolute; bottom: 14px; left: 14px; z-index: 400;
  background: rgba(9,13,20,0.85); border: 1px solid rgba(100,180,255,0.2);
  border-radius: 6px; padding: 8px 12px; font-size: 11px;
  display: flex; flex-direction: column; gap: 5px;
}
.legend-item { display: flex; align-items: center; gap: 7px; color: rgba(180,210,240,0.85); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-on { background: #00d4ff; }
.dot-postponed { background: #ffd700; }
.dot-soon { background: rgba(180,210,240,0.15); border: 2px solid #ff3b30; width: 7px; height: 7px; }

/* ── Statusbar ──────────────────────────────────────────────────────────── */
#statusbar {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  background: #0f1520; border-top: 1px solid rgba(100,180,255,0.12);
  font-size: 10px; color: rgba(100,150,200,0.6); flex-shrink: 0;
}
#statusbar .dot { background: #00d4ff; }

/* ── Google Maps InfoWindow dark theme ─────────────────────────────────── */
.gm-style .gm-style-iw-c {
  background: #0f1520 !important;
  border: 1px solid rgba(100,180,255,0.25) !important;
  border-radius: 8px !important;
  padding: 12px !important;
}
.gm-style .gm-style-iw-d { overflow: auto !important; background: #0f1520 !important; }
.gm-style .gm-style-iw-t::after { background: linear-gradient(45deg, #0f1520 50%, rgba(0,0,0,0) 51%, rgba(0,0,0,0) 100%) !important; }

.iw { position: relative; }
.iw-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.iw-header-actions { display: flex; align-items: center; gap: 2px; }
.iw-close {
  background: transparent; border: none; color: rgba(150,180,220,0.6);
  font-size: 13px; line-height: 1; cursor: pointer; padding: 4px; border-radius: 4px;
}
.iw-close:hover { color: rgba(220,235,255,0.95); background: rgba(100,180,255,0.1); }
.iw-heart {
  background: transparent; border: none; color: rgba(150,180,220,0.5);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.iw-heart:hover { color: #ff5f6d; background: rgba(255,95,109,0.08); }
.iw-heart.saved { color: #ff3b5c; }
.iw h3 { font-size: 13px; margin: 0 0 6px; font-weight: 700; color: rgba(220,235,255,0.95); }
.iw .status-badge {
  display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em;
}
.iw .status-on { background: rgba(0,212,255,0.15); color: #00d4ff; }
.iw .status-postponed { background: rgba(255,215,0,0.12); color: #ffd700; }
.iw table { font-size: 11px; color: rgba(180,210,240,0.8); border-collapse: collapse; margin-bottom: 6px; }
.iw table td { padding: 2px 0; }
.iw table td:first-child { padding-right: 12px; color: rgba(100,150,200,0.6); }
.iw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.iw a { color: #00d4ff; font-size: 11px; font-weight: 700; text-decoration: none; }
.iw a:hover { text-decoration: underline; }

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  #topbar > .ctl, #topbar > .btn-outline, #topbar > .docs-link, #topbar > .topbar-stats {
    display: none;
  }
  #mobileMenuBtn { display: block; }

  #mobileDrawer {
    display: none;
    position: absolute; top: 46px; right: 8px; left: 8px; z-index: 1000;
    background: #0f1520; border: 1px solid rgba(100,180,255,0.25);
    border-radius: 8px; padding: 12px; flex-direction: column; gap: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  }
  #mobileDrawer.open { display: flex; }
  #mobileDrawer .ctl { width: 100%; }
  .drawer-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
}

/* ── Saved properties panel ────────────────────────────────────────────── */
#savedPanel {
  position: absolute; top: 14px; right: 14px; bottom: 14px; z-index: 500;
  width: 380px; max-width: calc(100% - 28px);
  background: #0f1520; border: 1px solid rgba(100,180,255,0.25);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: none; flex-direction: column; overflow: hidden;
}
#savedPanel.open { display: flex; }
.saved-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid rgba(100,180,255,0.15);
  font-size: 12px; font-weight: 700; color: rgba(220,235,255,0.95); flex-shrink: 0;
}
.saved-panel-header button {
  background: transparent; border: none; color: rgba(150,180,220,0.6);
  font-size: 13px; cursor: pointer; padding: 4px; border-radius: 4px;
}
.saved-panel-header button:hover { color: rgba(220,235,255,0.95); background: rgba(100,180,255,0.1); }
#savedPanelBody { overflow-y: auto; flex: 1; }
#savedTable { width: 100%; border-collapse: collapse; font-size: 11px; }
#savedTable th {
  position: sticky; top: 0; background: #0f1520; text-align: left;
  padding: 8px 10px; color: rgba(100,150,200,0.7); font-weight: 700;
  border-bottom: 1px solid rgba(100,180,255,0.2); white-space: nowrap;
}
#savedTable td {
  padding: 8px 10px; color: rgba(180,210,240,0.85);
  border-bottom: 1px solid rgba(100,180,255,0.08); vertical-align: top;
}
#savedTable tr:last-child td { border-bottom: none; }
#savedTable tr.saved-row { cursor: pointer; }
#savedTable tr.saved-row:hover td { background: rgba(100,180,255,0.06); }
#savedTable .saved-address { color: #00d4ff; font-weight: 600; }
#savedEmpty { padding: 20px 14px; font-size: 12px; color: rgba(100,150,200,0.6); line-height: 1.5; }

@media (max-width: 700px) {
  #savedPanel { top: 8px; right: 8px; left: 8px; bottom: 8px; width: auto; max-width: none; }
}