:root {
  color-scheme: light;
  --bg: #f7f4ec;
  --surface: #ffffff;
  --surface-alt: #fef7ef;
  --ink: #2b2a27;
  --muted: #6f6a60;
  --accent: #6dbb7a;
  --accent-strong: #f2a35b;
  --success: #8fd19e;
  --warning: #f6cf7b;
  --border: #e6e0d6;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 6px 18px rgba(9, 30, 66, 0.08);
  --shadow-md: 0 12px 24px rgba(9, 30, 66, 0.12);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.bg-noise {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at top right, rgba(109, 187, 122, 0.18), transparent 45%),
    radial-gradient(circle at bottom left, rgba(242, 163, 91, 0.18), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.topbar-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #e3f2e4;
  border: 1px solid rgba(47, 107, 63, 0.12);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #2f6b3f;
}

.brand-logo,
.brand-fallback {
  grid-area: 1 / 1;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  display: block;
}

.brand-fallback {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
}

.brand-text span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.brand-text h1 a {
  color: inherit;
  text-decoration: none;
}

.brand-text h1 a:hover {
  text-decoration: underline;
}

.app-main {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg);
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 16px;
  display: grid;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-row {
  display: grid;
  gap: 12px;
}

.topbar-main {
  align-items: center;
  grid-template-columns: 1fr;
}

.topbar-title {
  display: grid;
  gap: 10px;
}

.topbar-title h1 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 24px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  flex: 1 1 240px;
}

.search-inline input {
  width: min(320px, 100%);
  height: 44px;
}

.is-detail .search-inline {
  display: none;
}

.is-detail .topbar-actions {
  justify-content: flex-end;
}

.content {
  padding: 20px 16px 32px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.panel.compact {
  background: var(--surface-alt);
}

.panel-header {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.panel-header.split {
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
}

.panel-header h2 {
  margin: 0;
  font-family: "Manrope", sans-serif;
  font-size: 18px;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.panel-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

.pill {
  background: #fde7d3;
  color: #a0581d;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.panel-body {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

select {
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

.panel-actions {
  display: grid;
  gap: 10px;
}

.sort-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

button {
  border-radius: 10px;
  border: none;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 16px rgba(109, 187, 122, 0.25);
}

button.ghost {
  background: #f4f5f7;
  color: var(--ink);
  border: 1px solid var(--border);
}

.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 16px rgba(109, 187, 122, 0.25);
}

.icon-button.ghost {
  background: var(--surface-alt);
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: none;
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.icon-button.is-loading svg {
  animation: spin 0.9s linear infinite;
}

button:disabled,
.icon-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.list {
  display: grid;
  gap: 12px;
}

.list-sentinel {
  width: 100%;
  height: 1px;
}

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  margin: 0;
  font-size: 16px;
  font-family: "Manrope", sans-serif;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.card .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e8f6e4;
  color: #2f6b3f;
  font-weight: 700;
  justify-self: start;
}

.card button {
  width: auto;
  justify-self: start;
}

.hidden {
  display: none;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.detail-main {
  display: grid;
  gap: 12px;
}

.detail-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 6px;
  z-index: 2;
}

.detail-header h3 {
  margin: 0;
  font-size: 20px;
  font-family: "Manrope", sans-serif;
}

.detail-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.detail-header-meta {
  font-size: 12px;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  gap: 12px;
}

.detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.detail-section-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.detail-section-grid {
  display: grid;
  gap: 12px;
}

.detail-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.detail-item span {
  font-size: 11px;
  color: var(--muted);
}

.detail-item-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

.detail-item-value span {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.map-link {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e3f2e4;
  color: #2f6b3f;
  display: grid;
  place-items: center;
  text-decoration: none;
  flex: 0 0 auto;
}

.map-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.detail-item strong {
  font-size: 15px;
}

.detail-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-strong);
  box-shadow: var(--shadow-sm);
}

.detail-card h4 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.detail-card p {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.detail-actions {
  display: grid;
  margin-top: 4px;
}

.detail-back-btn {
  width: auto;
  justify-self: start;
  min-width: 240px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(58, 52, 41, 0.2);
  display: grid;
  place-items: center;
  z-index: 50;
}

.loading-overlay.hidden {
  display: none;
}

.loading-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  min-width: 220px;
  display: grid;
  gap: 12px;
  justify-items: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.loading-text {
  font-size: 13px;
  color: var(--muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(109, 187, 122, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 720px) {
  .topbar-main {
    grid-template-columns: 1fr auto;
  }

  .topbar-actions {
    flex-wrap: nowrap;
  }

  .panel-meta {
    justify-content: flex-end;
  }
}

@media (min-width: 1024px) {
  .topbar {
    padding: 24px 28px;
  }

  .content {
    padding: 24px 28px 40px;
  }

  .panel-header.split {
    grid-template-columns: 1fr auto;
  }

  .list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
