:root {
  color-scheme: light;
  --bg: #dce8f3;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: #ffffff;
  --border: #c9d3dc;
  --text: #102338;
  --muted: #5b7087;
  --accent: #0a7ea4;
  --accent-dark: #075e7d;
  --shadow: 0 1px 5px rgba(16, 35, 56, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.78), transparent 34%),
    linear-gradient(135deg, #d7e7f3 0%, #cfe0eb 48%, #c4d8e2 100%);
}

body {
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-shell.is-sidebar-collapsed {
  grid-template-columns: 0 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 2;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    padding 180ms ease,
    border-color 180ms ease;
}

.app-shell.is-sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transform: translateX(-18px);
  padding-inline: 0;
  border-right-color: transparent;
  box-shadow: none;
}

.sidebar__header h1,
.details-card__header h2 {
  margin: 3px 0 8px;
  line-height: 1.1;
}

.sidebar__header h1 {
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.sidebar__intro,
.status-text,
.tips-card li,
.details-grid dd {
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
}

.search-card,
.details-card,
.measure-card,
.tips-card {
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.search-card,
.details-card,
.measure-card {
  border-bottom: 1px solid var(--border);
}

.field-label,
.details-grid dt {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 10px;
}

input,
select,
button {
  font: inherit;
  border-radius: 0;
}

input,
select {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(16, 35, 56, 0.04);
}

input:focus,
select:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(10, 126, 164, 0.2);
}

button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #bfcad3;
  background: linear-gradient(180deg, #ffffff 0%, #f3f6f8 100%);
  color: #2b3f52;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 35, 56, 0.08);
}

button:hover {
  background: linear-gradient(180deg, #ffffff 0%, #e9eff3 100%);
}

.button-secondary,
.button-ghost {
  background: linear-gradient(180deg, #ffffff 0%, #f3f6f8 100%);
  color: #2b3f52;
  border: 1px solid #bfcad3;
}

.button-secondary.is-active {
  background: linear-gradient(180deg, #fdfefe 0%, #dde7ee 100%);
  color: #13293d;
  border-color: #9eb0be;
  box-shadow: inset 0 1px 2px rgba(16, 35, 56, 0.12);
}

.button-ghost {
  background: linear-gradient(180deg, #ffffff 0%, #f3f6f8 100%);
}

.status-text {
  min-height: 1.25rem;
  margin: 8px 0 0;
  font-size: 0.88rem;
}

.measure-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.tool-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.tool-tab {
  padding-inline: 6px;
}

.measure-actions button {
  flex: 1;
}

#developer-label-name {
  margin-top: 10px;
}

.developer-subsection {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.developer-subsection .field-label:not(:first-of-type) {
  margin-top: 10px;
}

.developer-tool-active {
  border-color: #9eb0be;
  background: linear-gradient(180deg, #fdfefe 0%, #dde7ee 100%);
  color: #13293d;
  box-shadow: inset 0 1px 2px rgba(16, 35, 56, 0.12);
}

.details-grid {
  display: grid;
  gap: 10px;
  margin: 0;
}

.details-grid--compact {
  margin-top: 8px;
}

.details-grid div {
  padding-top: 6px;
  border-top: 1px solid rgba(16, 35, 56, 0.08);
}

.details-grid dd {
  margin: 4px 0 0;
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-word;
}

.details-grid a {
  color: var(--accent-dark);
  font-weight: 700;
}

.tips-card ul {
  margin: 8px 0 0;
  padding-left: 16px;
}

.tips-card li + li {
  margin-top: 5px;
}

.map-panel {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.account-control {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 460;
}

.account-control__trigger {
  min-width: 92px;
}

.account-control__menu {
  margin-top: 6px;
  min-width: 220px;
  padding: 10px;
  border: 1px solid #bfcad3;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 8px rgba(16, 35, 56, 0.18);
}

.account-control__name,
.account-control__meta {
  margin: 0;
}

.account-control__name {
  font-weight: 700;
  color: #13293d;
}

.account-control__meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: capitalize;
}

.account-control__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.account-control__actions button {
  flex: 1;
}

.leaflet-control-sidebar-toggle a {
  font-size: 20px;
  font-weight: 700;
  line-height: 30px;
  text-align: center;
}

.leaflet-control-sidebar-toggle a span {
  display: block;
  transform: translateY(-1px);
}

.map-scale {
  position: absolute;
  right: 8px;
  bottom: 26px;
  z-index: 450;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.map-scale__line {
  position: relative;
  display: block;
  min-width: 56px;
  height: 8px;
  background: transparent;
  border-bottom: 2px solid rgba(255, 255, 255, 0.96);
}

.map-scale__line::before,
.map-scale__line::after {
  content: "";
  position: absolute;
  bottom: -2px;
  width: 2px;
  height: 7px;
  background: rgba(255, 255, 255, 0.96);
}

.map-scale__line::before {
  left: 0;
}

.map-scale__line::after {
  right: 0;
  transform: translateX(1px);
}

.map-scale__text {
  display: block;
  position: static;
  margin: 0 0 2px;
  color: rgba(255, 255, 255, 0.96) !important;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 2px rgba(17, 24, 39, 0.45);
  -webkit-text-fill-color: rgba(255, 255, 255, 0.96);
  font-family: inherit;
}

#map {
  width: 100%;
  height: 100vh;
  background: #8ec5dc;
}

.leaflet-popup-content-wrapper {
  border-radius: 16px;
}

.popup-card {
  min-width: 180px;
}

.popup-card strong {
  display: block;
  margin-bottom: 4px;
}

.popup-card a {
  color: var(--accent-dark);
  font-weight: 700;
}

.map-label {
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-shadow:
    0 1px 2px rgba(255, 255, 255, 0.95),
    0 0 6px rgba(255, 255, 255, 0.95);
}

.map-label--official {
  color: #13344c;
}

.map-road {
  pointer-events: auto;
}

.measure-label {
  background: rgba(16, 35, 56, 0.9);
  color: #fff;
  border: 0;
  border-radius: 999px;
  box-shadow: none;
}

.measure-pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 3px 10px rgba(16, 35, 56, 0.25);
}

.measure-pin--a {
  background: #e7872e;
}

.measure-pin--b {
  background: #0a7ea4;
}

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

  .app-shell.is-sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    height: 40vh;
  }

  .app-shell.is-sidebar-collapsed .sidebar {
    height: 0;
    padding-block: 0;
    border-bottom-color: transparent;
    transform: translateY(-18px);
  }

  .map-panel,
  #map {
    min-height: 60vh;
    height: 60vh;
  }
}

.auth-page {
  min-height: 100vh;
  overflow: auto;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.68), transparent 30%),
    linear-gradient(160deg, #d8e7ef 0%, #c5d7e0 48%, #b5cad5 100%);
}

.auth-layout {
  display: flex;
  justify-content: center;
  max-width: 520px;
  margin: 0 auto;
  padding: 48px 24px;
  min-height: 100vh;
  align-items: center;
}

.auth-panel {
  width: 100%;
  padding: 16px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(23, 52, 78, 0.1);
  box-shadow: 0 12px 32px rgba(16, 35, 56, 0.12);
}

.auth-card {
  display: block;
  padding-top: 4px;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form button {
  margin-top: 6px;
}

.auth-status {
  min-height: 1.25rem;
  margin: 12px 0 0;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .auth-layout {
    padding: 24px 16px;
  }
}
