:root {
  --blue: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
  --bg: #0f172a;
  --panel: #1e293b;
  --line: #334155;
  --txt: #e2e8f0;
  --muted: #94a3b8;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
#app { display: flex; height: 100vh; }

#sidebar {
  width: 340px; flex-shrink: 0; background: var(--bg); color: var(--txt);
  display: flex; flex-direction: column; overflow-y: auto;
}
#sidebar header { padding: 16px; border-bottom: 1px solid var(--line); }
#sidebar h1 { font-size: 16px; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: 12px; margin: 0; }

.panel { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 10px 0 4px; }
.lbl:first-child { margin-top: 0; }
select, input[type=search] {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--txt); font-size: 13px;
}
.checks { display: flex; gap: 14px; margin-top: 12px; font-size: 13px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 2px solid #fff2; }
.dot.blue { background: var(--blue); }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { flex: 1; padding: 7px; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 13px; }
.tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.tabpane.hidden { display: none; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.card:hover { border-color: var(--blue); }
.card h3 { margin: 0 0 2px; font-size: 13px; }
.card .sub { color: var(--muted); font-size: 11px; }
.card .near { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; }
.card .near li { display: flex; justify-content: space-between; padding: 3px 0;
  border-top: 1px dashed var(--line); }
.card .near li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .near li.client .nm { color: var(--green); font-weight: 600; }
.card .near li .km { color: var(--muted); flex-shrink: 0; margin-left: 8px; }

#map { flex: 1; }

/* Logout button */
#logoutBtn { float: right; background: transparent; border: 1px solid var(--line);
  color: var(--muted); border-radius: 6px; padding: 1px 7px; cursor: pointer; font-size: 13px; }
#logoutBtn:hover { color: #fff; border-color: var(--blue); }

/* Login screen */
.login-overlay { position: fixed; inset: 0; z-index: 2000; display: flex;
  align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(120% 120% at 50% 0%, #1e293b 0%, #0f172a 60%); }
.login-overlay[hidden] { display: none; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px;
  padding: 30px 28px 26px; box-shadow: 0 24px 60px #0009; display: flex; flex-direction: column; }
.login-logo { width: 78%; max-width: 240px; align-self: center; margin: 6px 0 22px; height: auto; }
.login-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: #64748b; margin-bottom: 6px; }
.login-card input { width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #cbd5e1; font-size: 15px; background: #f8fafc; color: #0f172a; }
.login-card input:focus { outline: none; border-color: var(--blue); background: #fff; }
.login-card button { margin-top: 16px; padding: 12px; border: 0; border-radius: 10px;
  background: var(--blue); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.login-card button:hover { background: #1d4ed8; }
.login-card button:disabled { opacity: .6; cursor: default; }
.login-err { color: var(--red); font-size: 13px; margin: 12px 0 0; text-align: center; }

/* Popup */
.pop h3 { margin: 0 0 4px; font-size: 14px; }
.pop .addr { color: #555; font-size: 12px; margin: 0 0 8px; }
.pop button { width: 100%; padding: 7px; border: 0; border-radius: 7px; cursor: pointer;
  font-size: 13px; color: #fff; background: var(--green); }
.pop button.is-client { background: var(--blue); }
.pop .sv { display: block; text-align: center; margin-top: 6px; padding: 7px;
  border-radius: 7px; background: #475569; color: #fff !important; text-decoration: none;
  font-size: 13px; }
.pop .sv:hover { background: #334155; }
.pop textarea { width: 100%; margin-top: 8px; border-radius: 7px; border: 1px solid #ccc;
  padding: 6px; font-size: 12px; resize: vertical; min-height: 38px; }

/* Custom pin */
.pin { width: 18px; height: 18px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 1px 4px #0006; }

@media (max-width: 720px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; height: 45vh; }
  #map { height: 55vh; }
}
