/* Futár Térkép — mobile-first, app-like layout */
:root {
  --red: #b3372b;
  --bg: #ffffff;
  --ink: #222;
  --muted: #777;
  --line: #e5e5e5;
  --panel-h: 42vh;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overscroll-behavior: none;
}
.hidden { display: none !important; }

/* top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--red);
  color: #fff;
  z-index: 1000;
}
.brand { font-weight: 700; font-size: 16px; margin-right: auto; }
.badge {
  background: #ffd54d;
  color: #5b4300;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.topbar input[type="date"] {
  border: 0;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 13px;
  font-family: inherit;
}
.btn {
  border: 0;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: var(--red);
  cursor: pointer;
}
.btn.on { background: #ffd54d; color: #5b4300; }
.btn.ghost { background: transparent; color: #fff; }
.panel .btn { background: var(--red); color: #fff; }
.panel .btn.ghost { background: transparent; color: var(--muted); font-size: 18px; }

/* map fills the middle */
#map { flex: 1; min-height: 0; z-index: 1; }

/* bottom panel */
.panel {
  max-height: var(--panel-h);
  overflow-y: auto;
  border-top: 1px solid var(--line);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 1000;
}
.courier-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
.courier-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}
.courier-chip.selected { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.courier-chip .dot { width: 10px; height: 10px; border-radius: 50%; background: #999; }
.courier-chip.online .dot { background: #2e9e44; }
.courier-chip .sub { color: var(--muted); font-size: 11px; }

/* selected courier detail */
.detail { border-top: 1px solid var(--line); padding: 8px 12px 12px; }
.detail-head { display: flex; align-items: center; justify-content: space-between; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0; }
.stat { font-size: 12px; color: var(--muted); }
.stat b { display: block; font-size: 16px; color: var(--ink); }
.scrub-row { display: flex; align-items: center; gap: 10px; }
.scrub-row input[type="range"] { flex: 1; accent-color: var(--red); }
.scrub-time { font-variant-numeric: tabular-nums; font-size: 13px; min-width: 44px; text-align: right; }

/* login overlay */
.login {
  position: fixed;
  inset: 0;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}
.login-box {
  background: #fff;
  border-radius: 14px;
  padding: 28px 24px;
  width: min(320px, 88vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}
.login-box h1 { font-size: 20px; margin: 0; }
.login-box input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
}
.login-box button {
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.error { font-size: 13px; color: var(--red); margin: 0; }

/* map markers */
.c-marker { display: flex; flex-direction: column; align-items: center; transform: translateY(-4px); }
.c-marker .pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.c-marker .lbl {
  margin-top: 2px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.c-marker.offline { opacity: 0.45; }
.addr-pin {
  width: 22px;
  height: 22px;
  border-radius: 6px 6px 6px 0;
  background: #f39c12;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  transform: rotate(-45deg);
}
.addr-pin span { transform: rotate(45deg); }
.replay-marker .pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--red);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--panel-h) + 16px);
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 4000;
  max-width: 88vw;
}

/* wider screens: panel becomes a side column */
@media (min-width: 800px) {
  body {
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr 340px;
  }
  .topbar { grid-column: 1 / -1; }
  #map { grid-row: 2; grid-column: 1; height: 100%; }
  .panel {
    grid-row: 2;
    grid-column: 2;
    max-height: none;
    border-top: 0;
    border-left: 1px solid var(--line);
  }
}
