:root {
  --bg: #ffffff;
  --ink: #1d2320;
  --muted: #5d6762;
  --line: #e2e6e3;
  --soft: #f4f6f4;
  --brand: #2f6b3a;
  --brand-ink: #ffffff;
  --sel: #f08c1a;
  --danger: #b3261e;
  --panel-w: 380px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--ink); background: var(--bg); }

.app { display: flex; height: 100vh; }
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; }

.status {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  z-index: 500; background: rgba(29, 35, 32, 0.86); color: #fff;
  padding: 7px 14px; border-radius: 999px; font-size: 13px; pointer-events: none;
  white-space: nowrap;
}
.status:empty { display: none; }
.status.error { background: rgba(179, 38, 30, 0.92); }

.panel {
  width: var(--panel-w); flex: none; border-left: 1px solid var(--line);
  overflow-y: auto; background: var(--bg);
}
.view { padding: 20px 20px 28px; display: flex; flex-direction: column; gap: 14px; }
.view[hidden] { display: none; }

h1 { font-size: 20px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 4px 0 0; }
.lead { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.hint { margin: -6px 0 2px; color: var(--muted); font-size: 13px; }
.note { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }

.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary > div { background: var(--soft); border-radius: 10px; padding: 10px 12px; }
.summary .num { font-size: 22px; font-weight: 650; display: block; font-variant-numeric: tabular-nums; }
.summary .lbl { font-size: 12px; color: var(--muted); }

.parcel-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; max-height: 42vh; overflow-y: auto; }
.parcel-list:empty { display: none; }
.parcel-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 13.5px; }
.parcel-list li:first-child { border-top: 0; }
.parcel-list .pid { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.parcel-list .pid:hover { text-decoration: underline; }
.parcel-list .area { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.parcel-list .rm { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 4px; border-radius: 6px; }
.parcel-list .rm:hover { color: var(--danger); background: var(--soft); }
.parcel-list.compact { max-height: 22vh; }

.empty { margin: 0; color: var(--muted); font-size: 13.5px; }
.empty[hidden] { display: none; }

.actions { display: flex; gap: 10px; }
.actions .btn-primary { flex: 1; }

.btn {
  font: inherit; font-size: 14px; font-weight: 600; border-radius: 8px; padding: 10px 14px;
  cursor: pointer; border: 1px solid transparent;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:not(:disabled):hover { filter: brightness(1.08); }
.btn-ghost { background: none; border-color: var(--line); color: var(--ink); }
.btn-block { width: 100%; }

.link-back { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--brand); font: inherit; font-size: 13.5px; cursor: pointer; margin-bottom: 8px; }

form { display: flex; flex-direction: column; gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 550; flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; }
.w-sm { flex: 0 0 110px; }
input, textarea {
  font: inherit; font-size: 14px; font-weight: 400; padding: 8px 10px; border: 1px solid #c9d0cb;
  border-radius: 7px; background: #fff; color: var(--ink); width: 100%;
}
input:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
input.invalid, textarea.invalid { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12px; font-weight: 400; }
label.check { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 4px 8px; font-weight: 400; line-height: 1.4; }
label.check .field-error { flex-basis: 100%; }
label.check input { width: auto; margin-top: 2px; }
.form-error { margin: 0; color: var(--danger); font-size: 13.5px; }

/* Tooltip pola */
.leaflet-tooltip.parcel-tip { font-size: 12px; padding: 4px 8px; }

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .map-wrap { flex: none; height: 55vh; }
  .panel { width: 100%; border-left: 0; border-top: 1px solid var(--line); flex: 1; }
  .row { flex-direction: column; }
  .w-sm { flex: none; }
}
