:root {
  color-scheme: dark;
  --bg: #111419;
  --bg-soft: #171b22;
  --card: #1b1f27;
  --text: #f2efe8;
  --muted: #aeb7c7;
  --accent: #ff9a2f;
  --accent-strong: #ff8c22;
  --success: #44d39a;
  --danger: #ff6b7d;
  --border: #2f3642;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 153, 51, 0.16), transparent 35%),
    radial-gradient(circle at top right, rgba(255, 135, 0, 0.1), transparent 28%),
    linear-gradient(180deg, #171b22 0%, var(--bg) 35%, #0f1217 100%);
}

.layout {
  width: min(1100px, 92vw);
  margin: 2.4rem auto 3.2rem auto;
  display: grid;
  gap: 1rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}

.hero {
  position: relative;
  overflow: hidden;
  border: none;
  background: linear-gradient(135deg, #2a2f3a 0%, #252a34 52%, #2f2118 100%);
  color: #fff;
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.4);
}

.hero::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -95px;
  top: -145px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.17);
}

.hero h1 {
  position: relative;
  margin: 0.28rem 0 0.45rem 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.88);
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
}

.subtle {
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.hero .subtle {
  position: relative;
  color: rgba(255, 255, 255, 0.93);
  max-width: 72ch;
}

.hero-nav {
  margin: 0.9rem 0 0 0;
}

.hero-link {
  display: inline-block;
  color: #ffffff;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 0.46rem 0.84rem;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.14);
}

.hero-link:hover {
  background: rgba(255, 255, 255, 0.22);
}

.success-text {
  color: var(--success);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stat {
  background: linear-gradient(180deg, #1f2530 0%, #1b212b 100%);
}

.stat p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stat strong {
  display: block;
  margin-top: 0.48rem;
  font-size: clamp(1.12rem, 3vw, 1.5rem);
  letter-spacing: -0.02em;
}

.progress-card {
  display: grid;
  gap: 0.75rem;
}

.progress-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.2rem;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.progress-header h2 {
  margin: 0;
  font-size: 1.12rem;
}

.progress-track {
  height: 0.9rem;
  border-radius: 999px;
  background: #2a303c;
  border: 1px solid #394255;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-strong), #ffb347);
}

.forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

h2 {
  margin-top: 0;
  margin-bottom: 0.84rem;
  letter-spacing: -0.01em;
}

form {
  display: grid;
  gap: 0.7rem;
}

.form-inline {
  display: block;
}

label {
  font-size: 0.88rem;
  color: var(--muted);
}

input {
  border: 1px solid var(--border);
  border-radius: 0.72rem;
  background: #1a1f29;
  color: var(--text);
  padding: 0.72rem 0.85rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input::placeholder {
  color: #7f8ca3;
}

input:focus {
  border-color: #ff9f45;
  background: #202632;
  box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.2);
}

button {
  border: none;
  border-radius: 0.78rem;
  background: linear-gradient(90deg, #ff8c22, #ffab47);
  color: #fff;
  font-weight: 700;
  padding: 0.8rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 10px 20px rgba(255, 140, 34, 0.25);
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

button:active {
  transform: translateY(0);
}

.button-danger {
  background: linear-gradient(90deg, #d14357, #ea6072);
  box-shadow: 0 10px 20px rgba(209, 67, 87, 0.25);
}

.button-danger:hover {
  filter: brightness(1.02);
}

.table-wrap {
  overflow-x: auto;
  border-radius: 0.9rem;
  border: 1px solid #2f3744;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #1a1f28;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #2d3543;
  padding: 0.7rem 0.52rem;
  font-size: 0.92rem;
}

th {
  color: #b7c2d6;
  font-weight: 600;
  background: #202734;
}

tbody tr:nth-child(even) {
  background: #171d26;
}

.entry-positive {
  color: var(--success);
  font-weight: 700;
}

.entry-negative {
  color: var(--danger);
  font-weight: 700;
}

.flash {
  border-radius: 0.82rem;
  border: 1px solid transparent;
  padding: 0.78rem 0.95rem;
  font-size: 0.92rem;
}

.flash.success {
  color: #88e8c0;
  border-color: #2f7d63;
  background: #17382e;
}

.flash.error {
  color: #ff9da8;
  border-color: #8b3b45;
  background: #3a1e24;
}

.link {
  color: var(--accent-strong);
  text-decoration: none;
  font-size: 0.9rem;
}

.link:hover {
  text-decoration: underline;
}

.land-page {
  color-scheme: dark;
  background:
    radial-gradient(circle at top left, rgba(255, 153, 51, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 135, 0, 0.12), transparent 24%),
    #111419;
  color: #f2efe8;
}

.land-layout {
  width: min(1450px, 95vw);
  margin: 1rem auto 1.4rem auto;
  display: grid;
  gap: 0.9rem;
}

.land-topbar {
  border: 1px solid #2f3642;
  border-radius: 1rem;
  background: #1b1f27;
  padding: 1rem 1.1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.land-topbar h1 {
  margin: 0.3rem 0;
  color: #f6f0e3;
}

.land-topbar .subtle {
  color: #c8ced9;
}

.land-page .kicker {
  color: #ffae52;
}

.land-stats {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.land-stat {
  background: #1b1f27;
  border: 1px solid #2f3642;
  border-radius: 0.92rem;
  padding: 0.8rem 0.9rem;
}

.land-stat p {
  margin: 0;
  color: #aeb7c7;
  font-size: 0.85rem;
}

.land-stat strong {
  display: block;
  margin-top: 0.35rem;
  color: #f9f4e8;
  font-size: 1.22rem;
}

.land-shell {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 0.9rem;
  align-items: start;
}

.land-sidebar {
  background: #171b22;
  border: 1px solid #2a303c;
  border-radius: 0.95rem;
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding: 0.72rem;
}

.land-group {
  margin-bottom: 0.8rem;
}

.land-group h2 {
  margin: 0 0 0.55rem 0;
  font-size: 1.03rem;
  color: #f3e8cf;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.land-group h2 span {
  color: #ffb85f;
  font-size: 0.9rem;
}

.land-item {
  border: 1px solid #2e3542;
  border-radius: 0.8rem;
  padding: 0.65rem 0.72rem;
  margin-bottom: 0.58rem;
  background: #202530;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.land-item:hover {
  border-color: #ff9f45;
  transform: translateY(-1px);
}

.land-item h3 {
  margin: 0 0 0.38rem 0;
  font-size: 0.99rem;
  color: #f4f2eb;
}

.land-item-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.86rem;
  color: #ffbf72;
}

.land-item-links {
  margin: 0.45rem 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.land-item-links a {
  color: #8bc9ff;
  text-decoration: none;
  font-size: 0.86rem;
}

.land-item-links a:hover {
  text-decoration: underline;
}

.land-map-panel {
  background: #171b22;
  border: 1px solid #2a303c;
  border-radius: 0.95rem;
  padding: 0.6rem;
}

.land-map {
  width: 100%;
  height: calc(100vh - 190px);
  min-height: 560px;
  border-radius: 0.78rem;
  border: 1px solid #2b303b;
}

.land-page .link-chip {
  border-color: #454f61;
  background: #222935;
  color: #f0e6d2;
}

.land-refresh-form {
  margin: 0;
}

.chip-button {
  border: 1px solid #454f61;
  border-radius: 999px;
  padding: 0.45rem 0.82rem;
  background: #222935;
  color: #f0e6d2;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: none;
}

.chip-button:hover {
  background: #2d3442;
  transform: none;
  filter: none;
}

.land-page .link-chip.secondary {
  background: #2b3342;
}

.land-cluster.land-cluster-orange {
  background: rgba(255, 140, 34, 0.24);
  border: 2px solid rgba(255, 155, 52, 0.84);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.land-cluster.land-cluster-orange span {
  color: #ffd9a8;
  font-weight: 700;
  font-size: 0.97rem;
}

.land-page .leaflet-popup-content-wrapper {
  background: #1f252f;
  color: #f2efe8;
  border: 1px solid #3a4252;
}

.land-page .leaflet-popup-tip {
  background: #1f252f;
}

.land-page .leaflet-tile {
  filter: brightness(0.42) contrast(1.06) saturate(0.72);
}

.land-page .land-map-fallback .leaflet-tile {
  filter: none;
}

.land-page .plot-popup .popup-links a {
  color: #94cbff;
  text-decoration: none;
}

.land-page .plot-popup .popup-links a:hover {
  text-decoration: underline;
}

.land-hero {
  background: linear-gradient(135deg, #ffffff 0%, #f5f9ff 100%);
}

.land-actions {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.link-chip {
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid #cfdbf5;
  padding: 0.45rem 0.82rem;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 0.88rem;
}

.link-chip.secondary {
  background: #f5f8ff;
}

.land-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.land-map-card,
.land-list-card {
  min-height: 620px;
}

.land-map {
  width: 100%;
  height: 540px;
  border-radius: 0.9rem;
  border: 1px solid #dbe5f8;
  margin-top: 0.65rem;
}

.land-table-wrap {
  max-height: 500px;
  overflow: auto;
}

.plot-row {
  cursor: pointer;
}

.plot-row:hover {
  background: #edf4ff !important;
}

.plot-popup {
  line-height: 1.45;
}

@media (max-width: 920px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .forms {
    grid-template-columns: 1fr;
  }

  .land-grid {
    grid-template-columns: 1fr;
  }

  .land-map-card,
  .land-list-card {
    min-height: auto;
  }

  .land-shell {
    grid-template-columns: 1fr;
  }

  .land-sidebar {
    max-height: none;
  }

  .land-map {
    height: 520px;
    min-height: 420px;
  }

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

@media (max-width: 580px) {
  .layout {
    width: 95vw;
    margin: 1rem auto 2rem auto;
    gap: 0.85rem;
  }

  .card {
    padding: 1rem;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .land-map {
    height: 420px;
  }

  .land-stats {
    grid-template-columns: 1fr;
  }
}
