:root {
  color-scheme: light;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #e7e0d4;
  --paper: #f6f3ec;
  --panel: #fffcf7;
  --home: #0f6e6e;
  --free: #15803d;
  --limited: #ca8a04;
  --full: #b91c1c;
  --project: #a15c07;
  --focus: #1d4e89;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  background: var(--paper);
}

.app {
  display: flex;
  height: 100%;
  min-height: 100%;
}

.panel {
  display: flex;
  flex-direction: column;
  width: min(380px, 100%);
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.panel-head {
  padding: 20px 20px 8px;
}

.panel-head h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.request-open {
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--focus);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
}

.request-open:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.dialog[hidden] { display: none; }

.dialog {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
}

.dialog-panel {
  position: relative;
  width: min(640px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(28, 25, 23, 0.2);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.dialog-close {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}

.dialog-close:hover,
.dialog-close:focus-visible {
  color: var(--ink);
  background: #f3eee4;
}

.dialog-body {
  padding: 8px 16px 20px;
}

.request-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.request-form fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.request-form legend {
  padding: 0 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid .span-2 { grid-column: 1 / -1; }

.request-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.request-form input,
.request-form select,
.request-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 9px 10px;
}

.request-form input:focus,
.request-form select:focus,
.request-form textarea:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.request-form input:invalid:not(:placeholder-shown):not(:focus),
.request-form select:invalid:not(:focus) {
  border-color: #b91c1c;
}

.schedule {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 28px 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 0.92rem;
}

.schedule-sep {
  color: var(--muted);
  font-size: 0.82rem;
}

.notes { width: 100%; }

.consent {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 10px !important;
  color: var(--ink) !important;
  font-size: 0.9rem !important;
}

.consent input {
  width: auto;
  margin-top: 3px;
}

.consent a { color: var(--focus); }

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.recaptcha { min-height: 0; }

.form-error,
.form-success {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.form-error { color: #9f1239; }
.form-success { color: #15803d; }

.request-submit {
  align-self: flex-start;
  border: 0;
  border-radius: 8px;
  background: var(--focus);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}

.request-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

.search-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 20px 0;
}

.search,
.client,
.month,
.radius { display: block; }

.search input,
.client select,
.month select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}

.client select:disabled {
  background: #f3eee4;
  color: var(--muted);
  cursor: not-allowed;
}

.search input:focus,
.client select:focus,
.month select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.field-label,
.radius-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 12px 20px 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.radius output {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.radius input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--focus);
}

.status {
  margin: 0 20px 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.status[hidden] { display: none; }

.status.is-error { color: #9f1239; }

.list {
  list-style: none;
  margin: 0;
  padding: 0 12px 16px;
  overflow: auto;
  flex: 1;
}

.list li { margin: 0; }

.entry {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 10px 8px;
  cursor: pointer;
}

.swatch {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  flex: none;
}

.swatch-home,
.swatch-free { background: var(--free); }
.swatch-limited { background: var(--limited); }
.swatch-full { background: var(--full); }
.swatch-project { background: var(--project); }

.entry:hover,
.entry.is-active { background: #f3eee4; }

.entry:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.entry strong {
  display: block;
  font-weight: 600;
}

.entry .meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.85rem;
}

.entry .people {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.35;
}

.map { flex: 1; min-width: 0; min-height: 240px; }

.leaflet-div-icon.pin,
.leaflet-div-icon.cluster {
  background: transparent;
  border: 0;
}

.pin-dot {
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(28, 25, 23, 0.35);
}

.pin-home .pin-dot,
.pin-free .pin-dot { background: var(--free); }
.pin-limited .pin-dot { background: var(--limited); }
.pin-full .pin-dot { background: var(--full); }
.pin-project .pin-dot { background: var(--project); }

.cluster-count {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(28, 25, 23, 0.35);
}

.cluster-home .cluster-count,
.cluster-free .cluster-count { background: var(--free); }
.cluster-limited .cluster-count { background: var(--limited); }
.cluster-full .cluster-count { background: var(--full); }
.cluster-project .cluster-count { background: var(--project); }

.popup-kind,
.popup-capacity { font-weight: 600; }

.popup-free strong,
.popup-free .popup-capacity { color: var(--free); }
.popup-limited strong,
.popup-limited .popup-capacity { color: var(--limited); }
.popup-full strong,
.popup-full .popup-capacity { color: var(--full); }
.popup-kind { color: var(--muted); font-weight: 500; }

.popup-place { margin-top: 4px; }

.popup-people {
  margin: 8px 0 0;
  padding-left: 1.1rem;
  max-height: 160px;
  overflow: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 800px) {
  .app { flex-direction: column; }
  .panel {
    width: 100%;
    max-height: 46vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .map { min-height: 54vh; }
}
