:root {
  color-scheme: light;
  --free: #1f9d4d;
  --busy: #d93a34;
  --off: #9aa1ab;
  --accent: #2f6fed;
  --bg: #ffffff;
  --text: #10151c;
  --line: #e6e9ef;
  --soft: #f4f6f9;
  --shadow: 0 6px 24px rgba(16, 21, 28, .12);
  --panel: 380px;
  --gap: 14px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none;
}

#map { position: fixed; inset: 0; height: 100dvh; background: var(--soft); }

.muted { color: #6b7480; }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

button {
  font: inherit;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  min-height: 40px;
}
button:hover { background: var(--soft); }
button:active { transform: scale(.98); }

a { color: var(--accent); }


.sheet {
  position: fixed;
  z-index: 900;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 24px rgba(16, 21, 28, .16);
  height: 88dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet[data-state="hidden"] { display: none; }

.panel-head { padding: 12px 14px; }

.head-row { display: flex; align-items: center; gap: 10px; }
.close-btn {
  margin-left: auto;
  min-height: 36px;
  padding: 4px 10px;
  border: 0;
  background: none;
  font-size: 17px;
  color: #6b7480;
}
.close-btn:hover { background: var(--soft); }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { display: block; border-radius: 9px; }
.brand-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-name b { color: var(--accent); font-weight: 700; }

.counts { margin: 0; color: #4a5561; }
.counts b { color: var(--text); }

.tools { display: flex; gap: 6px; margin-top: 10px; }
.tools button {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  min-height: 40px;
  font-size: 13px;
  color: var(--accent);
  border-radius: 12px;
}
.tools button svg { width: 16px; height: 16px; flex: 0 0 auto; }
.tools button span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.float {
  position: fixed;
  z-index: 800;
  top: 12px;
  right: 12px;
  left: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  pointer-events: none;
}
.float .round { pointer-events: auto; position: relative; }
.dot-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}
.float .round {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  box-shadow: var(--shadow);
}
.float .round.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.banner {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fff6e0;
  color: #6b5200;
  font-size: 13px;
}

.sheet-head {
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.item {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 8px 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}
.item:hover { background: var(--soft); }
.item-main { flex: 1; min-width: 0; cursor: pointer; }
.item-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: 13px; color: #6b7480; }
.item-price { font-weight: 600; color: var(--text); white-space: nowrap; }
.item-free { font-weight: 700; color: var(--free); }
.item-busy { font-weight: 700; color: var(--busy); }
.item-acts { display: flex; gap: 6px; flex: 0 0 auto; }
.item-acts button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  padding: 0;
  color: var(--accent);
  overflow: hidden;
}
.item-acts .net-logo { width: 26px; height: 26px; border-radius: 7px; }

.empty { padding: 24px 16px; text-align: center; }

.leaflet-marker-icon.pin { background: none; border: 0; }
.pin svg { display: block; }

.drawer {
  position: fixed;
  z-index: 960;
  left: 0;
  right: 0;
  bottom: 0;
  height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 24px rgba(16, 21, 28, .22);
  padding-bottom: env(safe-area-inset-bottom);
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}
.drawer-head button { min-height: 36px; padding: 5px 12px; font-size: 14px; }
.drawer-head b { flex: 1; text-align: center; }
.drawer-body { overflow-y: auto; flex: 1; padding: 4px 16px 24px; }

.drawer-foot {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.primary {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  min-height: 48px;
}
.primary:hover { background: var(--accent); filter: brightness(1.06); }

.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 12px;
  text-align: center;
}
.chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-icon { flex: 0 0 auto; display: block; }
.net-logo { flex: 0 0 auto; display: block; width: 24px; height: 24px; border-radius: 6px; }
.chip.wide { grid-column: 1 / -1; }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.chip[aria-pressed="true"]:hover { background: var(--accent); filter: brightness(1.06); }

.switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  min-height: 44px;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
}
.switch i {
  flex: 0 0 auto;
  width: 50px;
  height: 30px;
  border-radius: 15px;
  background: #d3d8e0;
  position: relative;
  transition: background .15s;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 21, 28, .3);
  transition: transform .15s;
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }

.badge {
  display: inline-block;
  min-width: 16px;
  margin-left: 4px;
  padding: 0 3px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.drawer-body section { padding: 14px 0; border-bottom: 1px solid var(--line); }
.drawer-body section:last-child { border-bottom: 0; }
.drawer-body h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: #6b7480; }
.drawer-body p { margin: 0 0 8px; }
.drawer-body p:last-child { margin-bottom: 0; }
.checks { display: flex; flex-direction: column; gap: 12px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.dot.free { background: var(--free); }
.dot.busy { background: var(--busy); }
.dot.off { background: var(--off); }

.leaflet-popup-content-wrapper { border-radius: 14px; }
.leaflet-popup-content { margin: 14px 16px; min-width: 220px; }
.pop .net { text-transform: uppercase; font-size: 11px; letter-spacing: .04em; color: #6b7480; }
.pop h3 { margin: 2px 0; font-size: 16px; }
.pop table { border-collapse: collapse; width: 100%; margin-top: 8px; }
.pop td { padding: 2px 0; }
.pop td.k { color: #6b7480; padding-right: 12px; white-space: nowrap; }
.pop .promo { margin-top: 8px; padding: 6px 9px; border-radius: 8px; background: #fff6e0; color: #6b5200; font-size: 13px; }
.pop .acts { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.pop .acts button { flex: 1 1 auto; }

@media (min-width: 900px) {
  .sheet {
    top: var(--gap);
    bottom: var(--gap);
    left: var(--gap);
    right: auto;
    width: var(--panel);
    height: auto !important;
    max-height: none;
    border-radius: 20px;
    box-shadow: var(--shadow);
    transition: none;
  }
  #btn-list { display: none; }
  #btn-close-list { display: none; }
  .sheet[data-state="hidden"] { display: flex; }
  .panel-head { padding-top: 16px; }

  .float {
    top: var(--gap);
    left: calc(var(--panel) + var(--gap) * 2);
    right: auto;
  }

  .drawer {
    top: var(--gap);
    bottom: var(--gap);
    left: var(--gap);
    right: auto;
    width: var(--panel);
    height: auto;
    border-radius: 20px;
    box-shadow: var(--shadow);
  }
}
