:root {
  --bg: #f4f7fb;
  --bg-top: #eef3f9;
  --card: #ffffff;
  --card-soft: #fbfdff;
  --panel-soft: #f8fbff;
  --muted: #5f7192;
  --text: #1d2b45;
  --line: rgba(16, 24, 40, .10);
  --accent: #2e6ad7;
  --accent-soft: rgba(46, 106, 215, .12);
  --accent-soft-strong: rgba(46, 106, 215, .18);
  --good: #1f9d63;
  --good-soft: rgba(31, 157, 99, .12);
  --warn: #c68a00;
  --warn-soft: rgba(198, 138, 0, .12);
  --bad: #d64545;
  --bad-soft: rgba(214, 69, 69, .12);
  --shadow: 0 8px 24px rgba(16, 24, 40, .08);
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--sans);
  background:
    radial-gradient(1200px 800px at 20% 0%, #f7f9fc 0%, var(--bg-top) 38%, var(--bg) 100%);
  color: var(--text);
}

.app-header {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  z-index: 1000;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand__logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand__copy {
  min-width: 0;
}

.brand__title {
  font-weight: 800;
  letter-spacing: .2px;
  line-height: 1.1;
  font-size: 18px;
}

.brand__subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mode-toggle {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  display: flex;
  gap: 4px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.tab:hover {
  background: var(--panel-soft);
  color: var(--text);
}

.tab.active {
  background: var(--accent-soft);
  color: var(--text);
  border: 1px solid rgba(46, 106, 215, .25);
}

.searchbar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

.searchbar input {
  width: min(420px, 42vw);
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
}

.searchbar input::placeholder {
  color: var(--muted);
}

.searchbar button {
  border: 1px solid rgba(46, 106, 215, .28);
  background: var(--accent-soft);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  transition: background .15s ease, border-color .15s ease;
}

.searchbar button:hover {
  background: var(--accent-soft-strong);
  border-color: rgba(46, 106, 215, .40);
}

.search-filters {
  display: flex;
  align-items: center;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s ease, background .15s ease;
}

.filter-toggle:hover {
  border-color: rgba(46, 106, 215, .30);
  background: var(--panel-soft);
}

.filter-toggle input {
  margin: 0;
  accent-color: var(--accent);
}

.demo-pills {
  display: flex;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  transition: border-color .15s ease, background .15s ease;
}

.pill--ghost {
  background: transparent;
}

.pill:hover {
  border-color: rgba(46, 106, 215, .30);
  background: var(--panel-soft);
}

.app-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px 1fr 410px;
  gap: 12px;
  padding: 12px;
}

.pane {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.pane--map {
  position: relative;
  min-height: 0;
}

.pane__title,
.subpane__title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
  letter-spacing: .1px;
  background: #ffffff;
}

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

.pane--results {
  min-height: 0;
}

.list {
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.list--results {
  flex: 1 1 auto;
}

.pane--results.owner-mode .list--results {
  flex: 0 0 36%;
}

.subpane {
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.subpane.hidden {
  display: none;
}

.list--owner-parcels {
  flex: 1 1 auto;
}

.card {
  border: 1px solid var(--line);
  background: var(--card-soft);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  position: relative;
  transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.card:hover {
  border-color: rgba(46, 106, 215, .28);
  background: var(--panel-soft);
  box-shadow: 0 2px 8px rgba(16, 24, 40, .05);
}

.card.active {
  border-color: rgba(46, 106, 215, .45);
  background: var(--accent-soft);
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.title {
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .1px;
}

.case-flags {
  position: absolute;
  right: 10px;
  bottom: 8px;
  display: inline-flex;
  gap: 4px;
}

.case-flag-icon {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(16, 24, 40, .15);
}

.sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.4;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}

.badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #f8fbff;
  white-space: nowrap;
}

.badge.good {
  border-color: rgba(31, 157, 99, .28);
  background: var(--good-soft);
}

.badge.warn {
  border-color: rgba(198, 138, 0, .28);
  background: var(--warn-soft);
}

.badge.bad {
  border-color: rgba(214, 69, 69, .28);
  background: var(--bad-soft);
}

.badge.mono {
  font-family: var(--mono);
  color: var(--muted);
}

.unresolved-asterisk {
  color: var(--muted);
  font-weight: 800;
  margin-left: 1px;
}

.unresolved-note {
  font-style: italic;
}

.details {
  overflow: auto;
  padding: 12px;
  background: #fcfdff;
}

.section {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .03);
}

.section h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  line-height: 1.3;
}

.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 10px;
  font-size: 13px;
}

.kv .k {
  color: var(--muted);
}

.unknown-note {
  color: var(--muted);
  font-style: italic;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed rgba(16, 24, 40, .14);
  background: var(--panel-soft);
  border-radius: 12px;
  padding: 14px;
  line-height: 1.45;
}

.results-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--card-soft);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.results-legend__title {
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 2px;
}

.results-legend__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
}

.results-legend__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
}

.results-legend__dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 1px solid rgba(16, 24, 40, .15);
  flex-shrink: 0;
}

.filter-row {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px;
  flex-wrap: wrap;
}

.filter-btn {
  border: 1px solid var(--line);
  background: #f8fbff;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  transition: border-color .15s ease, background .15s ease;
}

.filter-btn:hover {
  border-color: rgba(46, 106, 215, .30);
  background: var(--panel-soft);
}

.filter-btn.active {
  border-color: rgba(46, 106, 215, .38);
  background: var(--accent-soft);
}

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

.case-delimiter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.case-delimiter::before,
.case-delimiter::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.case-row {
  border: 1px solid var(--line);
  background: #fbfdff;
  border-radius: 10px;
  padding: 10px;
}

.case-row__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.case-row__meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.45;
}

.map {
  height: 100%;
  width: 100%;
}

.map-status {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  z-index: 800;
  pointer-events: none;
  box-shadow: var(--shadow);
}

.hidden {
  display: none;
}

.app-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .95);
  color: var(--muted);
}

.app-footer__inner {
  max-width: none;
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .15px;
  text-align: center;
}

.app-footer__inner a,
.footer-link {
  color: var(--accent);
  font-weight: 800;
  text-decoration: underline;
}

.app-footer__inner a:hover,
.footer-link:hover {
  color: var(--text);
}

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

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

  .pane--details {
    display: none;
  }
}

@media (max-width: 860px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
  }

  .controls {
    justify-content: flex-start;
  }

  .searchbar input {
    width: min(100%, 420px);
  }
}

@media (max-width: 760px) {

  html,
  body {
    height: auto;
    overflow-x: hidden;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    flex: none;
    /* was flex:1 — stop shrinking to fit one screen */
    min-height: 0;
    height: auto;
    /* was implicitly constrained via body height:100% */
    padding: 8px;
    gap: 8px;
  }

  .pane {
    width: 100%;
    flex: none;
    /* let each pane size to its own content/max-height */
  }

  .pane--results {
    max-height: 40vh;
  }

  .pane--map {
    height: 45vh;
    min-height: 280px;
    flex: none;
  }

  .pane--details {
    display: flex;
    max-height: 50vh;
  }

  .searchbar input {
    width: 100%;
  }

  .app-header {
    padding: 10px 12px;
  }

  .brand__logo {
    height: 36px;
  }

  .controls {
    width: 100%;
  }
}