:root {
  color-scheme: light;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --surface: #ffffff;
  --surface-soft: rgba(255, 255, 255, 0.82);
  --surface-tint: #f8fbff;
  --line: #dbe5f0;
  --line-strong: #c9d7e6;
  --blue: #2563eb;
  --blue-deep: #1d4ed8;
  --blue-soft: #eaf2ff;
  --violet: #7c3aed;
  --violet-soft: #f2ecff;
  --cyan: #0891b2;
  --green: #15803d;
  --green-soft: #eaf7ef;
  --amber: #a16207;
  --amber-soft: #fff5db;
  --red: #b91c1c;
  --red-soft: #feeeee;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 50px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 28px 80px rgba(15, 23, 42, 0.14);
  --radius: 18px;
  --radius-small: 12px;
  --shell: min(1240px, calc(100vw - 40px));
  font-family: Inter, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 10% -10%, rgba(37, 99, 235, 0.12), transparent 34rem),
    radial-gradient(circle at 90% 8%, rgba(124, 58, 237, 0.09), transparent 30rem),
    linear-gradient(180deg, #f8fbff 0%, #f4f7fb 48%, #f7f9fc 100%);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.44;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.30);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  transform: translateY(-180%);
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.app-header {
  position: sticky;
  z-index: 60;
  top: 0;
  border-bottom: 1px solid rgba(201, 215, 230, 0.85);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.045);
  backdrop-filter: blur(18px);
}

.header-row,
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-row {
  min-height: 76px;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.brand-mark {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, #0f172a 0%, #2563eb 60%, #7c3aed 100%);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.24);
}

.brand-mark::before {
  position: absolute;
  top: 8px;
  left: 9px;
  width: 13px;
  height: 13px;
  content: "";
  border: 3px solid #fff;
  border-radius: 50%;
}

.brand-mark::after {
  position: absolute;
  top: 23px;
  left: 22px;
  width: 10px;
  height: 3px;
  content: "";
  transform: rotate(45deg);
  transform-origin: left center;
  border-radius: 999px;
  background: #fff;
}

.brand-mark i {
  display: none;
}

.brand-copy {
  display: grid;
  line-height: 1.08;
}

.brand-copy strong {
  font-size: 1rem;
  font-weight: 780;
  letter-spacing: -0.025em;
}

.brand-copy small {
  margin-top: 0.24rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-link {
  position: relative;
  padding: 0.66rem 0.9rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 680;
  transition: color 160ms ease, background-color 160ms ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.nav-link.is-active::after {
  position: absolute;
  right: 0.85rem;
  bottom: 0.28rem;
  left: 0.85rem;
  height: 2px;
  content: "";
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--violet));
}

.primary,
.secondary,
.text-button {
  border: 0;
  cursor: pointer;
  font-weight: 720;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.primary {
  padding: 0.78rem 1.05rem;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep) 68%, #2343ba);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  color: #fff;
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.24);
}

.primary:active,
.secondary:active,
.text-button:active {
  transform: translateY(0) scale(0.985);
}

.primary:disabled {
  transform: none;
  cursor: not-allowed;
  background: #a9b8cc;
  box-shadow: none;
}

.primary.compact {
  padding: 0.68rem 0.95rem;
  font-size: 0.88rem;
}

.primary-large {
  min-height: 48px;
  padding-inline: 1.3rem;
}

.secondary {
  padding: 0.72rem 0.98rem;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink-soft);
}

.secondary:hover {
  border-color: #9db2ca;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.header-app-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  text-decoration: none;
}

.text-button {
  padding: 0.55rem 0;
  background: transparent;
  color: var(--blue-deep);
  text-align: left;
}

.app-main {
  min-height: calc(100dvh - 142px);
  padding-block: 30px 72px;
}

.view {
  display: none;
  animation: view-in 260ms ease-out;
}

.view.is-active {
  display: block;
}

@keyframes view-in {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.page-heading,
.builder-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem;
  margin-bottom: 22px;
}

.page-heading h1,
.builder-heading h1,
.result-hero h2,
.visual-card h2,
.progress-card h2,
.interaction-card h2,
.downloads-section h2,
.empty-state h2,
.admin-config h2 {
  margin: 0;
  color: var(--ink);
  font-weight: 780;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: balance;
}

.page-heading h1,
.builder-heading h1 {
  max-width: 880px;
  font-size: clamp(2rem, 3.5vw, 3.3rem);
}

.compact-heading h1,
.analysis-heading h1 {
  font-size: clamp(1.9rem, 3vw, 2.8rem);
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--blue-deep);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lead {
  max-width: 70ch;
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.58;
}

.heading-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.system-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d4a72c;
  box-shadow: 0 0 0 4px rgba(212, 167, 44, 0.14);
}

.system-dot.is-ok {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(21, 128, 61, 0.12);
}

.system-dot.is-error {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.12);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 650;
}

.back-link:hover {
  color: var(--blue-deep);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 12px;
}

.search-field {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  padding-inline: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-sm);
}

.search-field svg {
  width: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field input {
  width: 100%;
  padding: 0.78rem 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.history-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  box-shadow: var(--shadow-sm);
}

.history-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.8fr) 0.75fr 0.72fr 0.72fr auto;
  align-items: center;
  gap: 1.1rem;
  width: 100%;
  min-height: 82px;
  padding: 0.9rem 1.1rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color 160ms ease;
}

.history-row:last-child {
  border-bottom: 0;
}

.history-row:hover {
  background: #f3f7fd;
}

.history-address {
  min-width: 0;
}

.history-address strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-address small,
.history-cell small {
  display: block;
  margin-top: 0.22rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.history-cell {
  font-variant-numeric: tabular-nums;
}

.history-cell strong {
  font-size: 1.13rem;
  font-weight: 760;
}

.row-arrow {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--blue-deep);
}

.status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 0.32rem 0.58rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 820;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-completed {
  background: var(--green-soft);
  color: var(--green);
}

.status-running,
.status-queued {
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.status-warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-failed,
.status-cancelled {
  background: var(--red-soft);
  color: var(--red);
}

.empty-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1.6rem;
  min-height: 180px;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  box-shadow: var(--shadow-sm);
}

.empty-index {
  color: #b8c7da;
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
}

.empty-state h2 {
  font-size: 1.5rem;
}

.empty-state p {
  max-width: 58ch;
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.skeleton-row,
.skeleton-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
}

.skeleton-row {
  height: 82px;
  border-bottom: 1px solid var(--line);
}

.skeleton-card {
  height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.skeleton-row::after,
.skeleton-card::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(225, 235, 247, 0.75), transparent);
  transform: translateX(-100%);
  animation: skeleton-slide 1.35s linear infinite;
}

@keyframes skeleton-slide {
  to { transform: translateX(100%); }
}

.builder-heading {
  align-items: start;
}

.method-note {
  max-width: 370px;
  padding: 15px 18px;
  border: 1px solid #ccdbee;
  border-radius: 14px;
  background: linear-gradient(135deg, #eef5ff, #f7f2ff);
  box-shadow: var(--shadow-sm);
}

.method-note span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.method-note strong {
  display: block;
  margin-top: 0.38rem;
  color: var(--ink);
  font-size: 0.94rem;
}

.method-note p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.builder-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  box-shadow: var(--shadow-md);
}

.section-number {
  display: flex;
  justify-content: center;
  padding-top: 24px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #eef5ff, #f8fbff);
  color: var(--blue-deep);
  font-size: 0.84rem;
  font-weight: 850;
}

.section-body {
  padding: 22px;
}

.new-analysis-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.88fr) minmax(440px, 1.12fr);
  gap: 22px;
  align-items: stretch;
}

.analysis-form {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
}

.field-group label,
.admin-config-form label,
.interaction-copy label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 780;
}

.address-row,
.admin-config-row {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
}

.address-row input,
.admin-config-row input,
.interaction-copy input {
  width: 100%;
  min-width: 0;
  padding: 0.82rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.address-row input:focus,
.admin-config-row input:focus,
.interaction-copy input:focus {
  border-color: #7aa2ee;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.field-help,
.form-actions p,
.section-note,
.config-status {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}


.analysis-modes {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.analysis-modes legend {
  margin-bottom: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 780;
}

.analysis-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.analysis-mode-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.analysis-mode-option:has(input:checked) {
  border-color: #8fb0ea;
  background: #eef5ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.07);
}

.analysis-mode-option input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.analysis-mode-option strong,
.analysis-mode-option small {
  display: block;
}

.analysis-mode-option strong {
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.3;
}

.analysis-mode-option small {
  margin-top: 0.32rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.mode-description {
  padding: 11px 12px;
  border: 1px solid #c6daf7;
  border-radius: 11px;
  background: #f4f8ff;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.45;
}

.complex-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.complex-inputs input {
  width: 100%;
  min-width: 0;
  padding: 0.82rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}

.complex-inputs input:focus {
  border-color: #7aa2ee;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.complex-buildings-panel {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.complex-buildings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 9px;
}

.complex-buildings-head strong,
.complex-buildings-head small {
  display: block;
}

.complex-buildings-head strong {
  color: var(--ink);
  font-size: 0.84rem;
}

.complex-buildings-head small {
  max-width: 55ch;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.complex-buildings-head > span {
  flex: 0 0 auto;
  padding: 0.28rem 0.46rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 0.68rem;
  font-weight: 780;
}

.complex-buildings-list {
  display: grid;
  gap: 7px;
  margin-bottom: 10px;
}

.complex-building-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 9px 10px;
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fff;
}

.complex-building-item strong,
.complex-building-item small {
  display: block;
}

.complex-building-item strong {
  color: var(--ink);
  font-size: 0.78rem;
}

.complex-building-item small {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.complex-building-remove {
  padding: 0.38rem 0.55rem;
  border: 1px solid #d7e2ed;
  border-radius: 8px;
  background: #fff;
  color: var(--red);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 760;
}

.complex-building-remove:hover {
  background: var(--red-soft);
}

.complex-building-search-group {
  margin-top: 6px;
}

.complex-parking-input {
  grid-column: 1 / -1;
  max-width: 420px;
}

.complex-input-help,
.complex-inputs .field-error {
  grid-column: 1 / -1;
}

.parking-options {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.parking-options legend {
  margin-bottom: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 780;
}

.parking-option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.parking-option {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  min-width: 0;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.parking-option:hover {
  border-color: #a9c1e4;
  background: #f8fbff;
}

.parking-option:has(input:checked) {
  border-color: #8fb0ea;
  background: #eef5ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.07);
}

.parking-option input {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.parking-option span,
.parking-option strong,
.parking-option small {
  display: block;
  min-width: 0;
}

.parking-option strong {
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.3;
}

.parking-option small {
  margin-top: 0.32rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.field-error {
  margin-top: 0.55rem;
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 650;
}

.address-results {
  display: grid;
  max-height: 220px;
  margin-top: 0.55rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.address-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.address-result:last-child { border-bottom: 0; }
.address-result:hover { background: #f3f7fd; }
.address-result strong { color: var(--ink); font-size: 0.88rem; }
.address-result code { color: var(--muted); font-size: 0.72rem; }

.selected-point {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 12px 14px;
  border: 1px solid #c6daf7;
  border-radius: 12px;
  background: #eef5ff;
}

.selected-point span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 760;
  text-transform: uppercase;
}

.selected-point strong {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink);
  font-size: 0.88rem;
}

.selected-point code {
  color: var(--blue-deep);
  font-size: 0.76rem;
}

.form-actions {
  margin-top: auto;
}

.compact-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.compact-actions p {
  max-width: 34ch;
  margin: 0;
}

.map-panel,
.visual-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.compact-map-panel {
  min-height: 0;
}

.map-header,
.visual-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 251, 255, 0.92);
}

.map-header span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 780;
}

.map-header small {
  color: var(--muted);
  font-size: 0.74rem;
}

.map {
  width: 100%;
  background: #eef3f8;
}

.new-map {
  height: 360px;
  max-height: 42vh;
  min-height: 300px;
}

.result-map {
  height: 410px;
  max-height: 48vh;
  min-height: 340px;
}

.map-fallback {
  display: grid;
  min-height: inherit;
  place-items: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.analysis-heading {
  margin-bottom: 18px;
}

.message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.error-message {
  border-color: #f3c1c1;
  background: var(--red-soft);
}

.error-message strong { color: var(--red); }
.error-message p { margin: 0.2rem 0 0; color: #7f1d1d; }

.result-hero {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(500px, 1.28fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid #ccdbee;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(238,245,255,0.96) 66%, rgba(247,242,255,0.92));
  box-shadow: var(--shadow-md);
}

.result-copy {
  align-self: center;
}

.result-hero h2 {
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

#result-method {
  max-width: 42ch;
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.potential-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.potential-card {
  display: flex;
  min-height: 160px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid #d3e0ef;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.90);
  box-shadow: var(--shadow-sm);
}

.potential-zone {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.potential-value {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-block: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.potential-value > span {
  color: var(--ink);
  font-size: clamp(2.35rem, 4vw, 3.5rem);
  font-weight: 820;
  letter-spacing: -0.055em;
}

.potential-value small {
  color: var(--muted);
  font-size: 0.9rem;
}

.potential-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.complex-result-section {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #d4e0ef;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.complex-result-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 14px;
}

.complex-result-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.3rem;
}

.complex-result-heading > p {
  max-width: 52ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.complex-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.complex-metric {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fbff;
}

.complex-metric span,
.complex-metric strong {
  display: block;
}

.complex-metric span {
  min-height: 2.4em;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.25;
}

.complex-metric strong {
  margin-top: 0.4rem;
  color: var(--ink);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.complex-building-breakdown {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfdff;
}

.complex-building-breakdown-head,
.complex-building-breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  padding: 10px 12px;
}

.complex-building-breakdown-head {
  border-bottom: 1px solid var(--line);
  background: #f4f8ff;
}

.complex-building-breakdown-head strong {
  color: var(--ink);
  font-size: 0.78rem;
}

.complex-building-breakdown-head small {
  color: var(--muted);
  font-size: 0.68rem;
}

.complex-building-breakdown-row {
  border-bottom: 1px solid var(--line);
}

.complex-building-breakdown-row:last-child {
  border-bottom: 0;
}

.complex-building-breakdown-row strong,
.complex-building-breakdown-row a,
.complex-building-breakdown-row span {
  display: block;
}

.complex-building-breakdown-row strong {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.complex-building-breakdown-row a,
.complex-building-breakdown-row span {
  margin-top: 0.2rem;
  color: var(--blue-deep);
  font-size: 0.67rem;
}

.complex-building-breakdown-row b {
  color: var(--ink);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.result-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  gap: 18px;
  margin-bottom: 18px;
}

.visual-card-head {
  min-height: 70px;
  padding: 14px 17px;
}

.visual-card-head .eyebrow {
  margin-bottom: 0.28rem;
}

.visual-card h2 {
  font-size: 1.12rem;
}

.compact-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem 0.8rem;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.map-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-public { background: var(--blue); }
.legend-restricted { background: #d97706; }
.legend-home { background: var(--green); }
.legend-origin { background: var(--ink); }
.legend-5 { background: var(--blue); }
.legend-10 { background: var(--violet); }

.ratio-card {
  min-width: 0;
}

.ratio-chart {
  display: block;
  width: 100%;
  height: 410px;
  padding: 10px 8px 2px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.chart-grid {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.chart-axis,
.chart-detail {
  fill: #64748b;
  font-size: 13px;
}

.chart-line {
  fill: none;
  stroke: #2563eb;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-point {
  fill: #2563eb;
  stroke: #fff;
  stroke-width: 4;
}

.chart-value {
  fill: #1d4ed8;
  font-size: 18px;
  font-weight: 800;
}

.chart-label {
  fill: #0f172a;
  font-size: 15px;
  font-weight: 750;
}

.downloads-section {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: 20px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #d4e0ef;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(239,246,255,0.92));
  box-shadow: var(--shadow-sm);
}

.downloads-section h2 {
  font-size: 1.35rem;
}

.downloads-section p:not(.eyebrow) {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.artifact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.artifact-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.55rem;
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.artifact-link:hover {
  transform: translateY(-1px);
  border-color: #9eb6d0;
  box-shadow: var(--shadow-sm);
}

.artifact-link strong {
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-link span {
  color: var(--muted);
  font-size: 0.7rem;
}

.artifact-link i {
  color: var(--blue-deep);
  font-style: normal;
  font-weight: 800;
}

.report-data-section,
.progress-card {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.90);
  box-shadow: var(--shadow-sm);
}

.report-data-summary,
.progress-summary {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.report-data-summary::-webkit-details-marker,
.progress-summary::-webkit-details-marker {
  display: none;
}

.report-data-summary::after,
.progress-summary::after {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  margin-left: auto;
  content: "+";
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--blue-deep);
  font-size: 1rem;
  line-height: 1;
}

.report-data-section[open] > .report-data-summary::after,
.progress-card[open] > .progress-summary::after {
  content: "−";
}

.report-data-summary span {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 760;
}

.report-data-summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.74rem;
}

.report-data-body,
.progress-body {
  border-top: 1px solid var(--line);
}

.table-wrap {
  max-height: 460px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  font-size: 0.79rem;
}

th,
td {
  min-width: 100px;
  padding: 10px 12px;
  border-right: 1px solid #edf2f7;
  border-bottom: 1px solid #e7edf4;
  text-align: left;
  vertical-align: top;
}

th:last-child,
td:last-child { border-right: 0; }

th {
  position: sticky;
  z-index: 3;
  top: 0;
  background: #eff5fc;
  color: #334155;
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

tbody tr:hover td {
  background: #f8fbff;
}

td a {
  color: var(--blue-deep);
  font-weight: 650;
  text-decoration: none;
}

td a:hover { text-decoration: underline; }

.cell-yes,
.cell-no {
  display: inline-flex;
  padding: 0.22rem 0.42rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 780;
}

.cell-yes { background: var(--green-soft); color: var(--green); }
.cell-no { background: #f1f5f9; color: var(--muted); }

.progress-card {
  margin-top: 16px;
}

.progress-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.progress-summary .eyebrow { margin-bottom: 0.25rem; }
.progress-summary h2 { font-size: 1.05rem; }
.progress-summary > strong {
  color: var(--blue-deep);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.progress-body {
  padding: 15px 16px 17px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ebf4;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  transition: width 280ms ease;
}

.progress-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 13px 0 0;
  padding: 0;
  list-style: none;
}

.progress-step {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.progress-step strong,
.progress-step small {
  display: block;
}

.progress-step strong {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.progress-step small {
  margin-top: 0.22rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-step.is-completed { border-color: #b9dfc6; background: #f3fbf5; }
.progress-step.is-running { border-color: #bdd2f6; background: #f2f7ff; }
.progress-step.is-failed { border-color: #f3c1c1; background: var(--red-soft); }
.progress-step.is-warning { border-color: #f2d48c; background: #fffbeb; }

.interaction-card {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(400px, 1.28fr);
  gap: 18px;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid #e7cf96;
  border-radius: var(--radius);
  background: #fffaf0;
  box-shadow: var(--shadow-sm);
}

.interaction-card h2 { font-size: 1.35rem; }
.interaction-copy p { color: var(--muted); }
.captcha-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.captcha-frame img {
  display: block;
  width: 100%;
  max-height: 430px;
  object-fit: contain;
}

.captcha-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 0.3rem 0.5rem;
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 0.68rem;
}

.collection-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 0;
}

.collection-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.38rem 0.55rem;
  border-radius: 9px;
  background: #f1f5f9;
}

.collection-metric strong { color: var(--ink); }
.collection-metric small { color: var(--muted); font-size: 0.68rem; }

.collection-state {
  display: inline-flex;
  padding: 0.24rem 0.42rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 760;
}

.collection-state.is-residential { background: var(--green-soft); color: var(--green); }
.collection-state.is-running { background: var(--blue-soft); color: var(--blue-deep); }
.collection-state.is-failed,
.collection-state.is-collector_incomplete { background: var(--red-soft); color: var(--red); }

.admin-config {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(360px, 1.28fr);
  gap: 22px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  box-shadow: var(--shadow-sm);
}

.admin-config h2 { font-size: 1.35rem; }
.admin-config-copy > p:not(.eyebrow) { color: var(--muted); }
.admin-config-form { align-self: center; }

.config-status.is-ok { color: var(--green); }
.config-status.is-warning { color: var(--amber); }
.config-status.is-error { color: var(--red); }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  box-shadow: var(--shadow-sm);
}

.admin-card h2 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
}

.admin-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.admin-list > div {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 0.8rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}

.admin-list dt { color: var(--muted); font-size: 0.72rem; }
.admin-list dd { margin: 0; overflow-wrap: anywhere; color: var(--ink-soft); font-size: 0.76rem; font-weight: 650; }

.map-popup {
  display: grid;
  gap: 0.24rem;
  max-width: 260px;
  color: var(--ink-soft);
  font: 13px/1.35 Inter, "Segoe UI", sans-serif;
}

.map-popup strong { color: var(--ink); font-size: 14px; }
.map-popup b { color: var(--blue-deep); font-size: 12px; }

.app-footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  font-size: 0.74rem;
}

.footer-row {
  min-height: 56px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  border: 1px solid #b9ccef;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  color: var(--ink-soft);
  font-size: 0.82rem;
}

@media (max-width: 1050px) {
  .new-analysis-grid,
  .result-visual-grid,
  .result-hero,
  .downloads-section,
  .admin-config,
  .interaction-card {
    grid-template-columns: 1fr;
  }

  .result-visual-grid {
    grid-template-columns: 1fr;
  }

  .ratio-chart {
    height: 330px;
  }

  .progress-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --shell: min(100% - 24px, 1240px);
  }

  .header-row {
    min-height: 68px;
    gap: 0.8rem;
  }

  .main-nav {
    display: none;
  }

  .brand-copy small {
    display: none;
  }

  .primary.compact {
    margin-left: auto;
    padding-inline: 0.75rem;
    font-size: 0.78rem;
  }

  .app-main {
    padding-block: 20px 50px;
  }

  .page-heading,
  .builder-heading {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .page-heading h1,
  .builder-heading h1,
  .compact-heading h1,
  .analysis-heading h1 {
    font-size: 2rem;
  }

  .heading-meta {
    padding: 0;
  }

  .toolbar,
  .address-row,
  .admin-config-row,
  .compact-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .history-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.7rem;
  }

  .history-row > .history-cell {
    display: none;
  }

  .history-row > .status {
    justify-self: end;
  }

  .row-arrow {
    display: none;
  }

  .builder-card {
    grid-template-columns: 1fr;
  }

  .section-number {
    justify-content: flex-start;
    padding: 10px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .section-body {
    padding: 14px;
  }

  .new-analysis-grid {
    grid-template-columns: 1fr;
  }

  .parking-option-grid,
  .analysis-mode-grid,
  .complex-inputs,
  .complex-result-grid {
    grid-template-columns: 1fr;
  }

  .complex-result-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .parking-option {
    min-height: 0;
  }

  .new-map {
    height: 310px;
    min-height: 280px;
  }

  .result-map {
    height: 340px;
    min-height: 300px;
  }

  .potential-grid,
  .artifact-list,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .potential-card {
    min-height: 140px;
  }

  .downloads-section {
    padding: 14px;
  }

  .report-data-summary,
  .progress-summary {
    padding: 11px 12px;
  }

  .report-data-summary small {
    display: none;
  }

  .progress-summary {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .progress-steps {
    grid-template-columns: 1fr;
  }

  .ratio-chart {
    height: 300px;
  }

  th,
  td {
    padding: 9px 10px;
  }

  .selected-point {
    align-items: flex-start;
    flex-direction: column;
  }
}
