@font-face {
  font-family: "Red Hat Display";
  src: url("rhd-var.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

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

:root {
  --navy: #14324f;
  --accent: #2e9e44;
  --line: #e3e8ee;
  --muted: #5a6b7a;
}

body {
  font-family: "Red Hat Display", system-ui, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: #1c2b38;
  background: #fff;
}

.topbar {
  height: 54px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  flex-shrink: 0;
}
.logo { color: #fff; text-decoration: none; font-size: 1.05rem; }
.logo b { color: #9fd4ff; }
.crumb { color: #cfe0ee; font-size: 0.92rem; }
.beta { font-size: 0.65rem; background: var(--accent); border-radius: 8px; padding: 2px 7px; vertical-align: middle; }
.top-actions { margin-left: auto; display: flex; gap: 10px; }

.btn {
  border: none; border-radius: 8px; padding: 9px 16px;
  font-weight: 700; font-size: 0.88rem; cursor: pointer; font-family: inherit;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #27893a; }
.btn.ghost { background: transparent; border: 1.5px solid #6f8aa3; color: #e7f0f8; }
.btn.ghost:hover { border-color: #fff; }

.builder { flex: 1; display: flex; min-height: 0; }

.panel {
  width: 372px; flex-shrink: 0; overflow-y: auto;
  border-right: 1px solid var(--line); padding: 18px 18px;
}
.panel section { margin-bottom: 24px; }
.panel h2 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted); margin-bottom: 10px;
}

.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 10px; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; cursor: pointer; font-family: inherit; font-size: 0.85rem; font-weight: 600;
}
.preset:hover { border-color: #b9c6d4; }
.preset.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(46, 158, 68, 0.18); }
.preset .dots { display: flex; gap: 4px; }
.preset .dots i {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12); display: inline-block;
}

.colors { display: flex; flex-direction: column; gap: 6px; }
.color-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.88rem; padding: 3px 0;
}

/* custom color picker */
.ki-swatch-btn {
  width: 44px; height: 28px; border: 1.5px solid var(--line); border-radius: 7px;
  background: #fff; padding: 2px; cursor: pointer; display: inline-flex;
}
.ki-swatch-btn:hover { border-color: #9fb3c8; }
.ki-chip { flex: 1; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.07); }
.ki-pop {
  position: fixed; z-index: 1000; background: #fff; border-radius: 12px;
  box-shadow: 0 14px 44px rgba(10, 25, 40, 0.25); padding: 12px; width: 252px;
}
.ki-group { margin-bottom: 8px; }
.ki-group-name { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 5px; }
.ki-row { display: flex; gap: 5px; flex-wrap: wrap; }
.ki-s {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.1);
  cursor: pointer; padding: 0;
}
.ki-s:hover { transform: scale(1.12); }
.ki-s.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.ki-hex-row { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.ki-hex-row .ki-chip { width: 28px; height: 26px; flex: none; border-radius: 6px; }
.ki-hex {
  flex: 1; border: 1.5px solid var(--line); border-radius: 7px; padding: 6px 9px;
  font-family: ui-monospace, monospace; font-size: 0.82rem;
}
.ki-hex:focus { outline: none; border-color: var(--accent); }

/* address search */
.addr-search { position: relative; margin-bottom: 8px; }
#addr-input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font-family: inherit; font-size: 0.86rem;
}
#addr-input:focus { outline: none; border-color: var(--accent); }
.addr-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 500;
  background: #fff; border-radius: 10px; overflow: hidden;
  box-shadow: 0 10px 32px rgba(10, 25, 40, 0.2);
}
.addr-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: none; background: none; padding: 9px 11px; cursor: pointer;
  font-family: inherit; font-size: 0.82rem; text-align: left;
}
.addr-item:hover, .addr-item.sel { background: #eef6f0; }
.addr-ico { flex-shrink: 0; }
.addr-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.addr-kind { font-size: 0.7rem; color: var(--muted); flex-shrink: 0; }
.addr-none { padding: 10px 12px; font-size: 0.82rem; color: var(--muted); }

#font-select {
  width: 100%; padding: 9px 10px; border: 1.5px solid var(--line);
  border-radius: 8px; font-family: inherit; font-size: 0.9rem;
}

.toggle { display: block; font-size: 0.9rem; padding: 5px 0; cursor: pointer; }
.toggle input { margin-right: 8px; }

.hint p { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }

.btn.outline {
  width: 100%; background: #fff; border: 1.5px dashed #9fb3c8; color: var(--navy);
  padding: 10px; font-size: 0.85rem;
}
.btn.outline:hover { border-color: var(--accent); }
.btn.outline.armed { border-style: solid; border-color: var(--accent); background: #ecf8ef; }

.pin-count { color: var(--accent); }
.konts-link { color: #cfe0ee; text-decoration: none; font-size: 0.85rem; align-self: center; margin-right: 4px; }
.konts-link:hover { color: #fff; }

.pins-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.pins-empty {
  margin-top: 10px; padding: 18px 12px; border: 1.5px dashed var(--line);
  border-radius: 10px; text-align: center; font-size: 0.85rem; color: var(--navy);
}
.pins-empty span { font-size: 0.76rem; color: var(--muted); }

.pin-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pin-card.open { border-color: #b9c6d4; box-shadow: 0 2px 10px rgba(20, 50, 79, 0.08); }
.pin-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  cursor: pointer; user-select: none;
}
.pin-head:hover { background: #f5f8fb; }
.pin-badge {
  width: 22px; height: 22px; border-radius: 50%; color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800;
}
.pin-name { flex: 1; font-size: 0.86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-name i { color: var(--muted); font-weight: 400; }
.pin-pro {
  font-size: 0.6rem; font-weight: 800; background: var(--navy); color: #9fd4ff;
  border-radius: 7px; padding: 2px 7px; letter-spacing: 0.5px; flex-shrink: 0;
}
.pin-locate, .pin-del {
  border: none; background: none; cursor: pointer; flex-shrink: 0;
  font-size: 1.05rem; line-height: 1; padding: 2px 4px; color: var(--muted);
}
.pin-locate:hover { color: var(--navy); }
.pin-del:hover { color: #c2273f; }

.pin-fields { display: none; flex-direction: column; gap: 7px; padding: 4px 10px 12px; }
.pin-card.open .pin-fields { display: flex; }
.pin-fields input[type="text"], .pin-fields input[type="url"], .pin-fields textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 7px;
  padding: 7px 9px; font-family: inherit; font-size: 0.82rem; resize: vertical;
}
.f-color-row { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--muted); }
.f-color { width: 36px; height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 1px; cursor: pointer; }
.btn.small { padding: 7px 10px; font-size: 0.78rem; background: #eef4f9; color: var(--navy); }
.btn.small:hover { background: #e0ebf4; }
.plan-note { font-size: 0.78rem; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.pin-has { font-size: 0.75rem; flex-shrink: 0; }

/* numbered map markers */
.num-pin { display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.num-pin-head {
  width: 26px; height: 26px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 800 0.78rem "Red Hat Display", sans-serif;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.num-pin-tip {
  width: 0; height: 0; margin-top: -1px;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 9px solid #d23d3d;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

/* labeled field groups in the pin editor */
.f-group { display: flex; flex-direction: column; gap: 5px; }
.f-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--muted); font-weight: 700; display: flex; justify-content: space-between;
}
.f-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid #f0f3f6; padding-top: 10px; margin-top: 2px;
}
.rte-count { font-weight: 400; text-transform: none; letter-spacing: 0; }
.rte-count.over { color: #c2273f; font-weight: 700; }

/* Quill theme adjustments to match the builder */
.pin-fields .ql-toolbar.ql-snow {
  border: 1px solid var(--line); border-radius: 8px 8px 0 0;
  background: #f4f7fa; padding: 4px 6px;
}
.pin-fields .ql-container.ql-snow {
  border: 1px solid var(--line); border-top: none; border-radius: 0 0 8px 8px;
  font-family: inherit; font-size: 0.84rem;
}
.pin-fields .ql-editor {
  min-height: 72px; max-height: 180px; padding: 9px 11px; line-height: 1.5;
}
.pin-fields .ql-editor.ql-blank::before { color: #9aa7b3; font-style: normal; }
.pin-fields .ql-snow .ql-tooltip { z-index: 30; left: 4px !important; }

/* image zone */
.img-zone { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: relative; }
.img-pick {
  border: 1.5px dashed #9fb3c8; background: #fff; border-radius: 8px;
  padding: 8px 12px; cursor: pointer; font-family: inherit; font-size: 0.8rem; color: var(--navy);
}
.img-pick:hover { border-color: var(--accent); }
.img-pick:disabled { opacity: 0.6; cursor: wait; }
.img-zone .f-img { flex: 1; min-width: 120px; }
.img-thumb {
  width: 100%; max-height: 110px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line);
}
.img-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.95);
  color: #c2273f; font-size: 1rem; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
}
.plan-info { font-size: 0.9rem; background: #ecf8ef; border-radius: 8px; padding: 8px 12px; margin: 8px 0; }

.preview { flex: 1; position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }

.view-switch {
  position: absolute; top: 12px; left: 12px; z-index: 10;
  display: flex; background: #fff; border-radius: 9px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18); overflow: hidden;
}
.view-switch button {
  border: none; background: none; padding: 8px 14px; cursor: pointer;
  font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--muted);
}
.view-switch button.active { background: var(--navy); color: #fff; }

dialog {
  border: none; border-radius: 14px; padding: 26px;
  max-width: 560px; width: 92vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
dialog::backdrop { background: rgba(10, 20, 30, 0.55); }
dialog h2 { color: var(--navy); margin-bottom: 8px; }
dialog h3 { font-size: 0.9rem; margin: 14px 0 8px; color: var(--muted); }
dialog code { background: #eef2f6; padding: 2px 8px; border-radius: 5px; }
dialog pre {
  background: var(--navy); color: #d9e8f5; padding: 14px;
  border-radius: 10px; font-size: 0.78rem; overflow-x: auto; line-height: 1.55;
}
.dialog-actions { display: flex; gap: 10px; margin-top: 16px; }
.dialog-actions .ghost { border-color: #b9c6d4; color: var(--muted); }

@media (max-width: 760px) {
  .builder { flex-direction: column; }
  .panel { width: 100%; max-height: 45vh; border-right: none; border-bottom: 1px solid var(--line); }
}
