:root {
  --ink-950: #112126;
  --ink-900: #17353e;
  --ink-800: #204752;
  --ink-700: #2d5e69;
  --gold-500: #d9a441;
  --gold-300: #f2d08c;
  --sand-100: #f7f1e3;
  --sand-200: #efe6d3;
  --sand-300: #e3d4bc;
  --clay-400: #be7d4c;
  --clay-600: #8f4e28;
  --moss-500: #608268;
  --moss-100: #dfe8d7;
  --rose-500: #b24a42;
  --white: #ffffff;
  --shadow: 0 20px 50px rgba(17, 33, 38, 0.14);
  --shadow-soft: 0 12px 24px rgba(17, 33, 38, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink-950);
  background:
    radial-gradient(circle at top left, rgba(217, 164, 65, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(96, 130, 104, 0.18), transparent 30%),
    linear-gradient(145deg, #fdf8ef 0%, #f4ecdd 48%, #efe4cf 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 53, 62, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 53, 62, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0));
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(17, 33, 38, 0.94), rgba(23, 53, 62, 0.96)),
    linear-gradient(145deg, rgba(217, 164, 65, 0.18), transparent);
  color: var(--white);
  box-shadow: var(--shadow);
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  overflow: auto;
}

.brand-card {
  padding: 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(155deg, rgba(217, 164, 65, 0.16), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(242, 208, 140, 0.18);
}

.brand-card h1,
.login-card h2,
.topbar h2,
.panel h3 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.01em;
}

.brand-card h1 {
  margin: 10px 0 6px;
  font-size: 2.2rem;
}

.brand-card p,
.sidebar .muted-copy,
.stack-item p,
.login-card p {
  margin: 0;
  line-height: 1.5;
}

.eyebrow {
  display: inline-flex;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--gold-300);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.nav-grid {
  display: grid;
  gap: 10px;
}

.nav-button,
.primary-button,
.secondary-button,
.danger-button,
.link-button {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.nav-button {
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.92);
}

.nav-button.active,
.nav-button:hover {
  background: linear-gradient(120deg, rgba(217, 164, 65, 0.3), rgba(242, 208, 140, 0.14));
  box-shadow: inset 0 0 0 1px rgba(242, 208, 140, 0.26);
}

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 28px 30px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.topbar h2 {
  margin: 6px 0 8px;
  font-size: clamp(1.8rem, 2.4vw, 2.8rem);
}

.topbar p {
  margin: 0;
  max-width: 780px;
  color: rgba(23, 53, 62, 0.82);
}

.topbar-actions,
.inline-actions,
.action-row,
.wrap-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-button,
.secondary-button,
.danger-button {
  border-radius: 999px;
  padding: 12px 18px;
  box-shadow: var(--shadow-soft);
}

.primary-button {
  color: var(--white);
  background: linear-gradient(135deg, var(--ink-900), var(--ink-700));
}

.secondary-button {
  color: var(--ink-900);
  background: rgba(23, 53, 62, 0.08);
}

.danger-button {
  color: var(--white);
  background: linear-gradient(135deg, var(--rose-500), #8f302b);
}

.link-button {
  padding: 0;
  background: transparent;
  color: inherit;
  opacity: 0.82;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.small-button {
  padding: 10px 14px;
  font-size: 0.92rem;
}

.full-width {
  width: 100%;
}

.view {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.view.active {
  display: flex;
}

.panel-grid {
  display: grid;
  gap: 24px;
}

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

.search-layout {
  grid-template-columns: minmax(340px, 0.92fr) minmax(0, 1.28fr);
}

.panel {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}

.compact-grid {
  margin-bottom: 18px;
}

.summary-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(247, 241, 227, 0.88));
  border: 1px solid rgba(32, 71, 82, 0.08);
}

.summary-card strong {
  display: block;
  font-size: 2rem;
  margin-top: 8px;
  color: var(--ink-900);
}

.stack-list {
  display: grid;
  gap: 14px;
}

.stack-list.compact {
  gap: 10px;
}

.stack-item {
  padding: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(239, 230, 211, 0.84));
  border: 1px solid rgba(32, 71, 82, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.stack-item.compact {
  padding: 12px 14px;
}

.stack-item h4,
.stack-item h5 {
  margin: 0 0 6px;
}

.stack-item .meta-row,
.detail-grid,
.property-meta,
.legend-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.muted-copy {
  color: rgba(23, 53, 62, 0.64);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  background: rgba(23, 53, 62, 0.08);
  color: var(--ink-900);
}

.chip[data-tone="gold"] {
  background: rgba(217, 164, 65, 0.16);
  color: #6b4810;
}

.chip[data-tone="rose"] {
  background: rgba(178, 74, 66, 0.14);
  color: #7d211f;
}

.chip[data-tone="moss"] {
  background: rgba(96, 130, 104, 0.18);
  color: #36533a;
}

.chip[data-tone="ink"] {
  background: rgba(32, 71, 82, 0.14);
  color: var(--ink-900);
}

.filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.compact-form {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

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

.field label {
  font-size: 0.9rem;
  color: rgba(23, 53, 62, 0.85);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(32, 71, 82, 0.16);
  background: rgba(255, 255, 255, 0.96);
  font: inherit;
  color: var(--ink-950);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field span,
.empty-state {
  color: rgba(23, 53, 62, 0.72);
}

.span-2 {
  grid-column: span 2;
}

.property-master-panel {
  min-height: 420px;
}

.property-master {
  display: grid;
  gap: 18px;
}

.property-master header {
  padding: 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(23, 53, 62, 0.95), rgba(45, 94, 105, 0.9));
  color: var(--white);
}

.property-master section {
  padding: 18px;
  border-radius: var(--radius-md);
  background: rgba(247, 241, 227, 0.74);
}

.property-master h4,
.property-master h5 {
  margin: 0 0 10px;
}

.key-value {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}

.key-value div {
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(32, 71, 82, 0.08);
}

.key-value strong {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(23, 53, 62, 0.52);
  margin-bottom: 4px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(32, 71, 82, 0.08);
  vertical-align: top;
}

.data-table th {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(23, 53, 62, 0.56);
}

.map-panel {
  min-height: 620px;
}

.map-canvas-wrap {
  min-height: 560px;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, rgba(233, 240, 238, 0.96), rgba(247, 241, 227, 0.82));
  border: 1px solid rgba(32, 71, 82, 0.08);
  overflow: hidden;
}

#mapCanvas {
  width: 100%;
  height: 100%;
}

.legend-grid {
  display: grid;
  gap: 10px;
}

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

.legend-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 33, 38, 0.54);
  backdrop-filter: blur(12px);
  z-index: 50;
}

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

.login-card {
  width: min(560px, 100%);
  padding: 30px;
  border-radius: 28px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.97), rgba(247, 241, 227, 0.95));
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.login-form input {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(32, 71, 82, 0.18);
}

.login-hints {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(23, 53, 62, 0.06);
  color: rgba(23, 53, 62, 0.86);
}

.login-hints code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(23, 53, 62, 0.08);
  font-family: "SFMono-Regular", "Consolas", monospace;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(23, 53, 62, 0.95);
  color: var(--white);
  box-shadow: var(--shadow);
  z-index: 80;
}

.hidden {
  display: none !important;
}

.empty-state {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(247, 241, 227, 0.65);
  border: 1px dashed rgba(32, 71, 82, 0.16);
}

.status-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr auto;
  gap: 10px;
  margin-top: 14px;
}

.status-form select,
.status-form input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(32, 71, 82, 0.16);
}

.marker-button {
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}

.map-label {
  font-size: 12px;
  fill: rgba(17, 33, 38, 0.8);
  pointer-events: none;
}

svg .boundary {
  fill: rgba(96, 130, 104, 0.08);
  stroke: rgba(45, 94, 105, 0.45);
  stroke-width: 2;
}

svg .parcel {
  fill: rgba(217, 164, 65, 0.36);
  stroke: rgba(17, 33, 38, 0.55);
  stroke-width: 1.4;
}

svg .parcel.high-risk {
  fill: rgba(178, 74, 66, 0.52);
}

svg .parcel.medium-risk {
  fill: rgba(217, 164, 65, 0.48);
}

svg .parcel.active-match {
  stroke: #ffffff;
  stroke-width: 3;
}

.nav-button:hover,
.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .two-up,
  .search-layout,
  .filter-form,
  .compact-form,
  .status-form {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .app-shell,
  .topbar,
  .panel {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar {
    flex-direction: column;
  }

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