:root {
  --bg: #f6f1ee;
  --panel: #ffffff;
  --border: #e8ddd7;
  --text: #231815;
  --muted: #7c6b63;
  --primary: #b78f7b;
  --primary-dark: #9f7663;
  --shadow: 0 10px 30px rgba(35, 24, 21, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  min-height: 100vh;
}

button,
select,
input,
a {
  font: inherit;
}

a {
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(246, 241, 238, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.view-btn,
.secondary-btn,
.primary-link,
.secondary-link,
.icon-btn {
  border: 0;
  cursor: pointer;
  transition: 0.2s ease;
}

.view-btn {
  padding: 10px 14px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
}

.view-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  padding: 18px;
}

.sidebar,
.panel-view,
.details-drawer {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 18px;
  align-self: start;
  position: sticky;
  top: 92px;
}

.sidebar-section + .sidebar-section {
  margin-top: 16px;
}

.sidebar h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.sidebar label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.sidebar select,
.sidebar input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fffdfa;
  color: var(--text);
}

.secondary-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f3ebe7;
  color: var(--text);
}

.secondary-btn:hover {
  background: #eaded8;
}

.stats-box {
  padding: 14px;
  border-radius: 14px;
  background: #fcf8f6;
  border: 1px solid var(--border);
}

.stats-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.stats-number {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.content {
  min-width: 0;
}

.panel-view {
  height: calc(100vh - 130px);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

#mapView {
  min-height: 500px;
}

.fc {
  height: 100%;
  padding: 12px;
}

.fc .fc-toolbar-title {
  font-size: 20px;
}

.fc .fc-button {
  background: var(--primary);
  border: 0;
}

.fc .fc-button:hover,
.fc .fc-button:focus {
  background: var(--primary-dark);
}

.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--primary-dark);
}

.fc-theme-standard td,
.fc-theme-standard th,
.fc-theme-standard .fc-scrollgrid {
  border-color: #efe4df;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(35, 24, 21, 0.32);
  z-index: 39;
}

.details-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100vh;
  z-index: 40;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.drawer-header {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.drawer-category {
  margin: 0 0 6px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.drawer-header h3 {
  margin: 0;
  font-size: 22px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #f5efeb;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

.drawer-body {
  padding: 22px;
  overflow: auto;
}

.info-item + .info-item {
  margin-top: 16px;
}

.info-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-value {
  font-size: 15px;
  line-height: 1.5;
}

.paragraph {
  margin: 0;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.primary-link,
.secondary-link {
  padding: 12px 16px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
}

.primary-link {
  background: var(--primary);
  color: white;
}

.primary-link:hover {
  background: var(--primary-dark);
}

.secondary-link {
  background: #f3ebe7;
  color: var(--text);
}

.secondary-link:hover {
  background: #eaded8;
}

.leaflet-popup-content-wrapper {
  border-radius: 14px;
}

.map-popup {
  line-height: 1.45;
}

.map-popup strong {
  display: block;
  margin-bottom: 6px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .panel-view {
    height: 72vh;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
  }

  .view-btn {
    flex: 1;
  }

  .topbar h1 {
    font-size: 20px;
  }
}