:root {
  color-scheme: light;
  --ink: #162033;
  --muted: #607086;
  --line: #d9e0ea;
  --panel: #ffffff;
  --accent: #0f766e;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef3f7;
  overscroll-behavior: none;
}

body.profile-page,
body.planner-page,
body.admin-page,
body.legal-page,
body.diagnostics-page {
  overflow: auto;
  overscroll-behavior: auto;
}

button,
input {
  font: inherit;
}

.leaflet-gl-layer,
.leaflet-gl-layer canvas,
.maplibregl-canvas-container,
.maplibregl-canvas {
  pointer-events: none;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.map-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-controls {
  position: absolute;
  z-index: 700;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
  align-items: start;
  pointer-events: none;
}

.tool-button,
.map-controls button {
  min-height: 42px;
  border: 1px solid rgba(203, 213, 225, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(10px);
}

.tool-button,
.map-controls button {
  width: 42px;
  pointer-events: auto;
}

.tool-button {
  display: grid;
  place-items: center;
}

.tool-button.loading {
  opacity: 0.7;
}

.tool-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.leaflet-right .leaflet-control-zoom {
  margin-top: calc(max(12px, env(safe-area-inset-top)) + 54px);
  margin-right: max(12px, env(safe-area-inset-right));
  border: 0;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.24);
}

.leaflet-right .leaflet-control-zoom a {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(203, 213, 225, 0.82);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  line-height: 40px;
  backdrop-filter: blur(10px);
}

.leaflet-right .leaflet-control-zoom a:first-child {
  border-radius: 8px 8px 0 0;
}

.leaflet-right .leaflet-control-zoom a:last-child {
  border-radius: 0 0 8px 8px;
}

.location-dot {
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  pointer-events: none;
}

.location-dot span {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
  border: 3px solid white;
  border-radius: 999px;
  background: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.28), 0 6px 16px rgba(15, 23, 42, 0.32);
}

.location-dot span::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  background: white;
  opacity: 0.85;
}

.map-sidebar {
  position: absolute;
  z-index: 780;
  left: 0;
  top: 0;
  bottom: 0;
  width: 56px;
  pointer-events: none;
  transition: width 220ms ease;
}

.map-sidebar.is-menu {
  width: 208px;
}

.map-sidebar.is-detail {
  width: min(1080px, calc(100vw - 260px));
}

.sidebar-rail {
  position: absolute;
  inset: 0 auto 0 0;
  display: grid;
  align-content: start;
  gap: 12px;
  width: 56px;
  border-right: 1px solid rgba(203, 213, 225, 0.62);
  padding: 20px 8px;
  background: rgba(248, 252, 247, 0.66);
  backdrop-filter: blur(18px) saturate(1.18);
  pointer-events: auto;
  transition: opacity 160ms ease;
}

.rail-button {
  display: grid;
  place-items: center;
  width: 40px;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(238, 242, 237, 0.72);
  color: #7c8481;
}

.rail-button.active,
.rail-button:focus-visible,
.rail-button:hover {
  outline: 2px solid #0a84ff;
  outline-offset: 0;
  background: rgba(255, 255, 255, 0.78);
  color: #475569;
}

.map-sidebar:not(.is-collapsed) .sidebar-rail {
  opacity: 0;
  pointer-events: none;
}

.sidebar-surface {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 208px;
  border-right: 1px solid rgba(203, 213, 225, 0.72);
  padding: 18px 10px 12px;
  background: rgba(248, 252, 247, 0.68);
  backdrop-filter: blur(20px) saturate(1.18);
  pointer-events: auto;
  transform: translateX(0) scaleX(1);
  transform-origin: left center;
  opacity: 1;
  transition: transform 220ms ease, opacity 160ms ease;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
}

.map-sidebar.is-collapsed .sidebar-surface {
  opacity: 0;
  pointer-events: none;
  transform: translateX(0) scaleX(0.25);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 760;
  line-height: 1;
}

.sidebar-head button {
  display: grid;
  place-items: center;
  width: 36px;
  min-height: 36px;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.68);
  color: #5f686f;
}

.sidebar-head button:hover,
.sidebar-head button:focus-visible {
  outline: 2px solid #0a84ff;
  outline-offset: 0;
  background: rgba(255, 255, 255, 0.78);
}

.sidebar-head button .tool-icon {
  width: 20px;
  height: 20px;
}

.sidebar-menu {
  display: grid;
  align-content: start;
  gap: 8px;
}

.sidebar-menu button {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 6px 8px;
  background: transparent;
  color: #777d82;
  text-align: left;
}

.sidebar-menu button:hover,
.sidebar-menu button:focus-visible,
.sidebar-menu button.active {
  background: rgba(238, 242, 237, 0.62);
  outline: 0;
}

.sidebar-menu .tool-icon {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  padding: 5px;
  background: rgba(226, 232, 226, 0.68);
}

.sidebar-menu button.active .tool-icon,
.sidebar-menu button:hover .tool-icon,
.sidebar-menu button:focus-visible .tool-icon {
  background: #0a84ff;
  color: white;
}

.sidebar-menu strong {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.15;
}

.sidebar-detail-panel {
  position: absolute;
  inset: 0 auto 0 208px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(520px, calc(100vw - 208px));
  border-right: 1px solid rgba(203, 213, 225, 0.72);
  padding: 24px 26px 22px;
  background: rgba(248, 252, 247, 0.7);
  backdrop-filter: blur(22px) saturate(1.18);
  pointer-events: auto;
  transform: translateX(0);
  opacity: 1;
  transition: transform 180ms ease, opacity 180ms ease;
}

.map-sidebar:not(.is-detail) .sidebar-detail-panel {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-20px);
}

.sidebar-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.sidebar-detail-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
}

.sidebar-detail-head button {
  width: 38px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(226, 232, 226, 0.9);
  color: #777d82;
  font-size: 27px;
  line-height: 1;
}

.sidebar-panel {
  min-height: 0;
  overflow: auto;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 8px;
  pointer-events: auto;
}

.search-form input {
  min-height: 46px;
  min-width: 0;
  border: 2px solid #0a84ff;
  border-radius: 14px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 16px;
}

.search-form button[type="submit"] {
  display: grid;
  place-items: center;
  width: 46px;
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  background: #0a84ff;
  color: white;
}

.layer-sheet {
  width: 100%;
  min-height: 0;
  overflow: auto;
}

.search-results {
  position: static;
  z-index: auto;
  width: 100%;
  max-height: min(360px, calc(100vh - 220px));
  overflow: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(22, 32, 51, 0.1);
}

.detail-sheet {
  position: absolute;
  z-index: 1200;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, calc(100vw - 24px));
  overflow: auto;
  border: 0;
  border-left: 1px solid rgba(203, 213, 225, 0.5);
  border-radius: 0;
  padding: 0;
  background: rgba(248, 252, 247, 0.62);
  color: var(--ink);
  box-shadow: -14px 0 34px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(22px) saturate(1.18);
  transform: translateX(0);
  transition: transform 180ms ease, opacity 180ms ease;
}

.freshness-badge {
  max-width: 100%;
  border: 1px solid rgba(203, 213, 225, 0.34);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.48);
  color: rgba(15, 23, 42, 0.72);
  font-size: 10px;
  line-height: 1.2;
  box-shadow: none;
  backdrop-filter: blur(10px);
}

.freshness-badge.warning {
  border-color: rgba(203, 213, 225, 0.34);
  color: rgba(15, 23, 42, 0.72);
}

.freshness-badge.error {
  border-color: rgba(180, 35, 24, 0.45);
  color: var(--danger);
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 5px 7px;
  border-top: 1px solid rgba(203, 213, 225, 0.46);
  padding-top: 10px;
}

.legal-links a {
  color: rgba(15, 23, 42, 0.62);
  font-size: 10px;
  font-weight: 650;
  text-decoration: none;
}

.detail-sheet.closed {
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 24px));
}

.sheet-close {
  position: sticky;
  top: 14px;
  float: right;
  z-index: 2;
  margin-right: 14px;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border: 1px solid rgba(203, 213, 225, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
  color: rgba(15, 23, 42, 0.74);
  font-size: 0;
  font-weight: 700;
}

.sheet-close::before {
  content: "×";
  font-size: 24px;
  line-height: 1;
}

.detail-head {
  margin: 0;
  border-bottom: 1px solid rgba(203, 213, 225, 0.42);
  padding: 22px 16px 17px;
  background: rgba(248, 252, 247, 0.28);
}

.detail-title-card {
  border-top: 3px solid color-mix(in srgb, var(--detail-type-color, #14b8a6) 70%, rgba(255, 255, 255, 0.45));
}

.detail-kicker {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--detail-type-color, #14b8a6) 40%, rgba(255, 255, 255, 0.72));
  border-radius: 999px;
  padding: 0 9px;
  background: color-mix(in srgb, var(--detail-type-fill, #14b8a6) 70%, rgba(15, 23, 42, 0.78));
  color: var(--detail-type-text, #f8fafc);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-sheet h2 {
  margin: 10px 0 0;
  font-size: 21px;
  line-height: 1.08;
}

.detail-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.detail-facts {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 0;
  margin: 14px 16px 0;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.46);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.36);
}

.detail-facts dt,
.detail-facts dd {
  min-height: 36px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.38);
  padding: 8px 10px;
}

.detail-facts dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-facts dd {
  margin: 0;
  color: var(--ink);
  font-weight: 640;
  overflow-wrap: anywhere;
}

.detail-facts .detail-limit-label,
.detail-facts .detail-limit-value {
  background: color-mix(in srgb, var(--detail-type-fill, #14b8a6) 10%, rgba(255, 255, 255, 0.54));
}

.detail-facts .detail-limit-label {
  color: var(--ink);
}

.detail-facts .detail-limit-value {
  color: var(--ink);
  font-weight: 800;
}

.detail-facts dt:nth-last-child(2),
.detail-facts dd:last-child {
  border-bottom: 0;
}

.detail-section {
  margin: 14px 16px 0;
  border: 1px solid rgba(203, 213, 225, 0.44);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.34);
}

.detail-section h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.railway-detail-head {
  border-top-color: #f59e0b;
}

.railway-card {
  border-color: rgba(245, 158, 11, 0.32);
}

.detail-timing {
  border-color: color-mix(in srgb, var(--detail-type-color, #14b8a6) 34%, rgba(203, 213, 225, 0.52));
  background: color-mix(in srgb, var(--detail-type-fill, #14b8a6) 10%, rgba(255, 255, 255, 0.48));
}

.permission-contact {
  border-color: rgba(13, 148, 136, 0.18);
  background: rgba(240, 253, 250, 0.36);
}

.permission-contact dl {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 6px 10px;
  margin: 0;
}

.permission-contact dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.permission-contact dd {
  margin: 0;
  color: var(--ink);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.detail-summary {
  max-height: none;
  overflow: auto;
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}

.planning-summary-head {
  border-top-color: #2dd4bf;
}

.planning-time {
  display: grid;
  grid-template-columns: 1fr 58px 58px;
  gap: 6px;
  align-items: end;
  margin: 14px 16px 0;
}

.planning-time label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.planning-time span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.planning-time input,
.planning-time button {
  min-width: 0;
  min-height: 34px;
  border: 1px solid rgba(203, 213, 225, 0.5);
  border-radius: 7px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.planning-time button:disabled {
  opacity: 0.45;
}

.planning-filter-note {
  margin: 0 0 10px;
  border-left: 3px solid #f59e0b;
  padding-left: 10px;
  color: #92400e;
  font-size: 12px;
  line-height: 1.45;
}

.planning-radius {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 14px 16px 0;
}

.planning-radius button {
  min-width: 0;
  min-height: 34px;
  border: 1px solid rgba(203, 213, 225, 0.5);
  border-radius: 7px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.planning-radius button.active {
  border-color: rgba(13, 148, 136, 0.5);
  background: rgba(204, 251, 241, 0.68);
  color: var(--ink);
}

.planning-counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 16px 0;
}

.planning-count {
  min-width: 0;
  border: 1px solid rgba(203, 213, 225, 0.44);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.34);
}

.planning-count strong,
.planning-count span {
  display: block;
}

.planning-count strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.planning-count span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.planning-count.critical {
  border-color: rgba(248, 113, 113, 0.42);
}

.planning-count.warning {
  border-color: rgba(245, 158, 11, 0.42);
}

.planning-count.info {
  border-color: rgba(45, 212, 191, 0.38);
}

.planning-item-list {
  display: grid;
  gap: 8px;
}

.planning-item {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(203, 213, 225, 0.44);
  border-left: 4px solid #38bdf8;
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.34);
}

.planning-item.critical {
  border-left-color: #f87171;
}

.planning-item.warning {
  border-left-color: #f59e0b;
}

.planning-item.info {
  border-left-color: #2dd4bf;
}

.planning-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.planning-item strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.planning-item small {
  color: #475569;
  font-size: 12px;
  line-height: 1.35;
}

.feature-choice-list {
  display: grid;
  gap: 8px;
}

.feature-choice {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  border: 1px solid rgba(203, 213, 225, 0.44);
  border-left: 4px solid var(--choice-color, #60a5fa);
  border-radius: 8px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--choice-fill, #3b82f6) 10%, rgba(255, 255, 255, 0.5));
  color: var(--ink);
  text-align: left;
}

.feature-choice:hover,
.feature-choice:focus-visible {
  outline: 2px solid var(--choice-color, #60a5fa);
  outline-offset: 1px;
}

.feature-choice-type {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.feature-choice strong {
  font-size: 15px;
  line-height: 1.2;
}

.feature-choice small {
  color: #475569;
  font-size: 12px;
}

.detail-warning {
  max-height: none;
  overflow: auto;
  margin: 14px 16px 0;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  padding: 10px 12px;
  background: rgba(245, 158, 11, 0.13);
  color: #92400e;
}

.detail-actions {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  border-top: 1px solid rgba(203, 213, 225, 0.42);
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: rgba(248, 252, 247, 0.58);
  backdrop-filter: blur(18px) saturate(1.18);
}

.search-results {
  padding: 8px;
}

.search-results button {
  width: 100%;
  min-height: 44px;
  display: block;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.search-results button.selected,
.search-results button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: #ecfdf5;
}

.search-results strong,
.search-results small {
  display: block;
  overflow-wrap: anywhere;
}

.search-results strong {
  font-size: 14px;
  line-height: 1.25;
}

.search-results small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.search-results button + button {
  margin-top: 4px;
}

.layer-status {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.15;
}

.layer-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.layer-sheet h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 750;
}

.layer-list {
  display: grid;
  gap: 4px;
}

.basemap-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
  border: 1px solid rgba(203, 213, 225, 0.7);
  border-radius: 8px;
  padding: 8px;
  background: rgba(248, 250, 252, 0.78);
}

.basemap-control button {
  min-height: 34px;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 7px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.06);
}

.basemap-control button.active {
  border-color: rgba(15, 23, 42, 0.92);
  background: rgba(15, 23, 42, 0.92);
  color: white;
}

.layer-group {
  display: grid;
  gap: 1px;
}

.layer-group h2 {
  margin: 7px 0 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.layer-row {
  display: grid;
  grid-template-columns: 18px 12px 1fr;
  gap: 6px;
  align-items: center;
  min-height: 27px;
  padding: 2px 0;
  border: 0;
  border-radius: 0;
}

.select-all-row {
  grid-template-columns: 18px 1fr;
  margin-bottom: 3px;
}

.layer-row.loading {
  opacity: 0.7;
}

.layer-row.error {
  color: var(--danger);
}

.layer-row.warning .layer-status {
  color: #8a5a00;
}

.layer-row.zoom-blocked {
  opacity: 0.75;
}

.layer-row.zoom-blocked .layer-status {
  color: #8a5a00;
}

.layer-row strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.2;
}

.layer-name {
  font-size: 12px;
  font-weight: 560;
}

.layer-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.layer-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dot-color);
}

.layer-copy {
  min-width: 0;
}

.layer-copy strong,
.layer-copy span {
  overflow-wrap: anywhere;
}

.leaflet-popup-content {
  min-width: 220px;
}

.leaflet-popup-content strong {
  display: block;
  margin-bottom: 8px;
}

.leaflet-popup-content dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 10px;
  margin: 0;
}

.leaflet-popup-content dt {
  color: var(--muted);
}

.leaflet-popup-content dd {
  margin: 0;
}

.leaflet-popup-content p {
  max-height: 160px;
  overflow: auto;
  margin: 10px 0 0;
  color: var(--ink);
}

.sheet-handle {
  display: none;
}

.account-overlay {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
}

.account-overlay[hidden] {
  display: none;
}

.account-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(5px);
}

.account-dialog {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid rgba(203, 213, 225, 0.95);
  border-radius: 8px;
  padding: 20px;
  background: white;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.38);
}

.account-close {
  position: absolute;
  top: 14px;
  right: 14px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: var(--muted);
  font-size: 14px;
}

.account-dialog h2 {
  margin: 0 70px 4px 0;
  font-size: 24px;
  line-height: 1.15;
}

.account-dialog h3 {
  margin: 18px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
}

.account-message {
  min-height: 18px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.account-message.error {
  color: var(--danger);
}

.account-disabled-note {
  margin: 0;
  border: 1px solid rgba(194, 65, 12, 0.22);
  border-radius: 8px;
  padding: 10px 12px;
  color: #9a3412;
  background: rgba(255, 247, 237, 0.82);
  font-size: 13px;
  font-weight: 700;
}

.account-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #f8fafc;
}

.account-tabs button,
.account-form button,
.account-actions button,
.account-summary button,
.saved-list button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.account-tabs button.active,
.account-form button,
.account-actions button:first-child {
  background: var(--ink);
  color: white;
}

.account-tabs button {
  line-height: 1.1;
}

.account-form {
  display: grid;
  gap: 12px;
}

.account-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.account-form input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
}

.account-form input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.account-form button {
  min-height: 44px;
  margin-top: 2px;
  font-weight: 700;
}

.account-form input:disabled,
.account-form button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.account-summary,
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.account-actions {
  margin-top: 12px;
}

.saved-list {
  display: grid;
  gap: 8px;
}

.saved-empty {
  color: var(--muted);
  font-size: 13px;
}

.saved-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.saved-item strong,
.saved-item small {
  display: block;
  overflow-wrap: anywhere;
}

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

.profile-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-right: 6px;
  color: var(--accent);
  font-weight: 700;
}

.account-pro-preview {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: 8px;
  padding: 9px 10px;
  background: #f0f9ff;
  color: #075985;
  font-size: 13px;
}

.account-pro-preview strong {
  color: #0f172a;
  font-size: 14px;
}

.detail-save {
  min-height: 40px;
  margin-top: 12px;
  border: 1px solid rgba(10, 132, 255, 0.28);
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(10, 132, 255, 0.9);
  color: white;
  box-shadow: 0 8px 18px rgba(10, 132, 255, 0.16);
}

.profile-page {
  background: #f5f7fa;
}

.profile-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.profile-sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  border-right: 1px solid var(--line);
  padding: 22px;
  background: white;
}

.profile-sidebar nav {
  display: grid;
  align-content: start;
  gap: 10px;
}

.profile-sidebar a,
.profile-header a {
  color: var(--accent);
  font-weight: 700;
}

.profile-sidebar-logout {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #f8fafc;
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

.profile-sidebar-logout:hover {
  border-color: rgba(180, 35, 24, 0.36);
  background: #fff7f7;
  color: var(--danger);
}

.profile-main {
  min-width: 0;
}

.profile-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  background: white;
}

.profile-main section {
  padding: 22px;
}

.profile-main section + section {
  border-top: 1px solid var(--line);
}

.profile-main h1,
.profile-main h2 {
  margin: 0 0 12px;
}

.profile-main h3 {
  margin: 0;
  font-size: 16px;
}

.profile-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.profile-grid-pro {
  align-items: stretch;
}

.profile-pro-card {
  display: grid;
  gap: 8px;
}

.profile-pro-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.profile-pro-card strong {
  font-size: 18px;
}

.profile-pro-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.profile-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 14px;
  margin: 0;
}

.profile-facts dt {
  color: var(--muted);
}

.profile-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.profile-form {
  display: grid;
  align-content: start;
  gap: 10px;
}

.profile-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.profile-form input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
}

.profile-form input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(15, 118, 110, 0.16);
}

.profile-form button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--ink);
  color: white;
  font-weight: 700;
}

.profile-form small,
.profile-message {
  color: var(--muted);
  font-size: 13px;
}

.profile-session-list {
  display: grid;
  gap: 8px;
}

.profile-session-list article {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(248, 250, 252, 0.84);
}

.profile-session-list span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
}

.profile-danger-form {
  border-color: rgba(220, 38, 38, 0.24);
  background: rgba(254, 242, 242, 0.72);
}

.profile-danger-form button {
  background: var(--danger);
}

.profile-message {
  min-height: 18px;
  margin: 0 0 12px;
}

.profile-message.error {
  color: var(--danger);
}

.profile-main table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: white;
}

.profile-main th,
.profile-main td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

.planner-page {
  background: #e8eef4;
}

.planner-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
}

.planner-panel {
  min-width: 0;
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 16px;
  background: #ffffff;
}

.planner-panel header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.planner-panel header a {
  color: var(--accent);
  font-weight: 800;
}

.planner-panel header strong {
  font-size: 18px;
}

.planner-panel header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.planner-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.planner-card + .planner-card {
  margin-top: 12px;
}

.planner-card h1,
.planner-card h2 {
  margin: 0 0 12px;
}

.planner-draw-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.planner-draw-tools button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.planner-draw-tools button.active {
  border-color: rgba(15, 118, 110, 0.62);
  background: #0f766e;
  color: #ffffff;
}

.planner-draw-tools button:disabled {
  opacity: 0.5;
}

.planner-draw-tools #plannerCheckButton,
.planner-draw-tools #plannerClearButton {
  grid-column: span 1;
}

.planner-selected,
.planner-retention {
  margin: 0 0 12px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.planner-retention {
  margin: -2px 0 0;
  border-left-color: #0ea5e9;
}

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

.planner-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.planner-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.planner-form input,
.planner-form select,
.planner-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  font: inherit;
}

.planner-form button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 850;
}

.planner-form button:disabled {
  opacity: 0.5;
}

.planner-table {
  width: 100%;
  border-collapse: collapse;
}

.planner-table td {
  border-top: 1px solid var(--line);
  padding: 9px 0;
}

.planner-table tr:first-child td {
  border-top: 0;
}

.planner-table strong,
.planner-table small {
  display: block;
}

.planner-table small {
  margin-top: 3px;
  color: var(--muted);
}

.planner-map-frame {
  min-width: 0;
  min-height: 100vh;
}

.planner-map-frame iframe {
  display: block;
  width: 100%;
  height: 100vh;
  border: 0;
}

.diagnostics-page {
  background: #f5f7fa;
}

.diagnostics {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto;
}

.diagnostics header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.diagnostics h1 {
  margin: 0;
  font-size: 26px;
}

.diagnostics p {
  margin: 4px 0 0;
  color: var(--muted);
}

.diagnostics a {
  color: var(--accent);
  font-weight: 700;
}

.diagnostics-summary {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.diagnostics table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.diagnostics th,
.diagnostics td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.diagnostics th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.diagnostics td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.diagnostics tr.status-error td:first-child {
  border-left: 4px solid var(--danger);
}

.diagnostics tr.status-warning td:first-child,
.diagnostics tr.status-stale td:first-child {
  border-left: 4px solid #d97706;
}

.diagnostics tr.status-ok td:first-child {
  border-left: 4px solid var(--accent);
}

.legal-page {
  background: #f5f7fa;
}

.legal-document {
  width: min(780px, calc(100vw - 32px));
  margin: 24px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: white;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.legal-document nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 20px;
}

.legal-document a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.legal-document h1 {
  margin: 0 0 18px;
  font-size: 30px;
}

.legal-document section {
  border-top: 1px solid var(--line);
  padding: 16px 0 0;
  margin-top: 16px;
}

.legal-document h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.legal-document p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.admin-page {
  background: #f5f7fa;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.admin-sidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 20px;
  border-right: 1px solid var(--line);
  padding: 22px;
  background: white;
}

.admin-sidebar nav {
  display: grid;
  align-content: start;
  gap: 10px;
}

.admin-sidebar a,
.admin-header a,
.admin-table a {
  color: var(--accent);
  font-weight: 750;
}

.admin-main {
  min-width: 0;
}

.admin-layer-main {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
}

.admin-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  background: white;
}

.admin-header h1 {
  margin: 0;
}

.admin-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.admin-main section {
  padding: 22px;
}

.admin-main section + section {
  border-top: 1px solid var(--line);
}

.admin-main h2 {
  margin: 0 0 12px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.admin-stats article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.admin-stats strong,
.admin-stats span {
  display: block;
}

.admin-stats strong {
  font-size: 26px;
}

.admin-stats span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-work-areas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.admin-work-areas a,
.admin-work-areas article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
  color: var(--ink);
  text-decoration: none;
}

.admin-work-areas strong,
.admin-work-areas span {
  display: block;
}

.admin-work-areas strong {
  font-size: 17px;
}

.admin-work-areas span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.admin-stripe-cards {
  margin-bottom: 14px;
}

.admin-log-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-log-cards code {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.admin-settings-form {
  display: grid;
  grid-template-columns: minmax(280px, 520px) auto auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.admin-settings-form label,
.admin-settings-form span,
.admin-settings-form p {
  min-width: 0;
}

.admin-settings-form label,
.admin-settings-form span {
  display: grid;
  gap: 6px;
}

.admin-settings-form span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.admin-settings-form select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.admin-settings-form button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--ink);
  color: white;
  font-weight: 750;
}

.admin-settings-form button:disabled,
.admin-settings-form select:disabled {
  opacity: 0.55;
}

.admin-settings-form a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  color: var(--accent);
  font-weight: 750;
}

.admin-settings-form p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.admin-table strong,
.admin-table small {
  display: block;
}

.admin-table small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.admin-table tr.is-hidden {
  background: #fff7f7;
}

.admin-plans-table td:first-child {
  width: 104px;
}

.admin-plan-thumb {
  width: 88px;
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.admin-plan-thumb svg {
  width: 80px;
  height: 60px;
}

.admin-plan-thumb circle,
.admin-plan-thumb polygon {
  fill: rgba(14, 165, 233, 0.24);
  stroke: #0369a1;
  stroke-width: 3;
}

.admin-plan-thumb polyline {
  fill: none;
  stroke: #0369a1;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.admin-plan-thumb span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.admin-log-table code {
  overflow-wrap: anywhere;
  white-space: normal;
}

.admin-log-table tr.log-error {
  background: #fff7f7;
}

.admin-log-table tr.log-warning {
  background: #fffbeb;
}

.admin-log-tail {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.admin-layer-updates-table td:nth-child(3),
.admin-layer-updates-table td:nth-child(4) {
  min-width: 170px;
}

.admin-layer-log-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.admin-layer-log-grid h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.admin-layer-log-grid .admin-log-tail {
  max-height: 300px;
}

.admin-table form {
  display: flex;
  gap: 8px;
}

.admin-table input,
.admin-filter input,
.admin-filter select {
  min-height: 38px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.admin-table button,
.admin-filter button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--ink);
  color: white;
  font-weight: 750;
}

.admin-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 18px 0;
}

.admin-filter input {
  flex: 1;
}

.admin-filter a {
  color: var(--accent);
  font-weight: 750;
}

.admin-filter-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.admin-filter-summary p {
  margin: 0 0 8px;
}

.admin-filter-summary button {
  margin-right: 10px;
}

.admin-layer-defaults {
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.admin-layer-defaults legend {
  padding: 0 6px;
  font-weight: 850;
}

.admin-layer-defaults p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-layer-defaults section {
  display: grid;
  gap: 8px;
  margin: 0;
  border-top: 1px solid rgba(203, 213, 225, 0.72);
  padding-top: 10px;
}

.admin-layer-defaults h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.admin-layer-defaults section > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px 10px;
}

.admin-layer-defaults label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 30px;
  border: 1px solid rgba(203, 213, 225, 0.78);
  border-radius: 8px;
  padding: 5px 8px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.admin-layer-defaults label span {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-transform: none;
}

.admin-layer-defaults input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
}

.admin-bulk-panel {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
  border: 1px solid rgba(127, 29, 29, 0.22);
  border-radius: 8px;
  padding: 14px;
  background: #fff7f7;
}

.admin-bulk-panel h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.admin-bulk-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-bulk-panel form {
  display: grid;
  grid-template-columns: 150px 170px 1fr 1fr auto auto;
  gap: 8px;
}

.admin-bulk-panel input,
.admin-bulk-panel select {
  min-height: 38px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.admin-bulk-panel button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: var(--ink);
  color: white;
  font-weight: 750;
}

.admin-bulk-panel button:disabled {
  opacity: 0.45;
}

.admin-bulk-preview {
  border: 1px solid rgba(127, 29, 29, 0.2);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.admin-bulk-preview ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.admin-bulk-preview small {
  display: block;
  color: var(--muted);
}

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

.admin-duplicate-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.admin-duplicate-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.admin-duplicate-group > header strong,
.admin-duplicate-group > header span {
  display: block;
}

.admin-duplicate-group > header strong {
  font-size: 16px;
}

.admin-duplicate-group > header span:not(.admin-pill) {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-duplicate-group .admin-table-wrap {
  border: 0;
  border-radius: 0 0 8px 8px;
}

.admin-notice {
  margin: 0 0 12px;
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffbeb;
  color: #7c4a03;
  font-size: 13px;
  font-weight: 650;
}

.admin-notice code {
  font-weight: 800;
}

.admin-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 750;
}

.admin-hide-button {
  background: #7f1d1d !important;
}

.admin-show-button {
  background: var(--accent) !important;
}

.admin-denied {
  width: min(460px, calc(100vw - 32px));
  margin: 12vh auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: white;
}

@media (max-width: 720px) {
  .map-controls {
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    gap: 7px;
  }

  .leaflet-right .leaflet-control-zoom {
    display: none;
  }

  .leaflet-bottom.leaflet-right {
    bottom: max(8px, env(safe-area-inset-bottom));
    right: max(8px, env(safe-area-inset-right));
  }

  .leaflet-container .leaflet-control-attribution {
    max-width: min(220px, calc(100vw - 112px));
    overflow: hidden;
    border-radius: 999px;
    padding: 3px 8px;
    background: rgba(15, 23, 42, 0.58);
    color: rgba(255, 255, 255, 0.74);
    font-size: 9px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
    backdrop-filter: blur(10px);
  }

  .leaflet-container .leaflet-control-attribution a {
    color: rgba(125, 211, 252, 0.92);
  }

  .map-sidebar,
  .map-sidebar.is-menu,
  .map-sidebar.is-detail {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    pointer-events: none;
  }

  .map-sidebar {
    height: 132px;
  }

  .map-sidebar.is-menu {
    height: min(54vh, 460px);
  }

  .map-sidebar.is-detail {
    height: min(76vh, 620px);
  }

  .sidebar-rail {
    position: absolute;
    inset: auto 0 0;
    z-index: 4;
    display: grid;
    place-items: center;
    width: 100%;
    height: 44px;
    border: 0;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    pointer-events: none;
    opacity: 1;
  }

  .rail-button {
    display: none;
  }

  .rail-button:first-child {
    position: absolute;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 40px);
    left: 50%;
    display: grid;
    width: 74px;
    min-height: 26px;
    border: 1px solid rgba(203, 213, 225, 0.82);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    transform: translateX(-50%);
    pointer-events: auto;
  }

  .rail-button:first-child .tool-icon {
    display: none;
  }

  .rail-button:first-child::before {
    content: "";
    width: 30px;
    height: 4px;
    border-radius: 999px;
    background: #8b9491;
  }

  .map-sidebar:not(.is-collapsed) .sidebar-rail {
    opacity: 0;
    pointer-events: none;
  }

  .sidebar-surface {
    position: absolute;
    inset: auto 5vw 0;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    width: 90vw;
    height: min(54vh, 460px);
    margin-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 14px 14px 0 0;
    padding: 10px 14px max(18px, env(safe-area-inset-bottom));
    background: rgba(248, 252, 247, 0.68);
    box-shadow: 0 -18px 42px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(22px) saturate(1.18);
    transform: translateY(0);
  }

  .map-sidebar.is-collapsed .sidebar-surface {
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(100% + 16px));
  }

  .sidebar-detail-panel {
    position: absolute;
    inset: auto 0 0;
    width: 100%;
    height: 100%;
    border-right: 0;
    border-radius: 14px 14px 0 0;
    padding: 18px 14px max(18px, env(safe-area-inset-bottom));
    transform: translateY(0);
  }

  .map-sidebar:not(.is-detail) .sidebar-detail-panel {
    transform: translateY(calc(100% + 24px));
  }

  .map-sidebar.is-detail .sidebar-surface {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
  }

  .map-sidebar.is-menu .sidebar-surface {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .sidebar-head h1 {
    font-size: 20px;
  }

  .sidebar-detail-head {
    margin-bottom: 14px;
  }

  .sidebar-detail-head h1 {
    font-size: 24px;
  }

  .sidebar-detail-head button {
    width: 38px;
    min-height: 38px;
    font-size: 26px;
  }

  .sidebar-menu {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .sidebar-menu button {
    min-height: 48px;
    grid-template-columns: 38px 1fr;
    border-radius: 12px;
    padding: 5px 8px;
  }

  .sidebar-menu strong {
    font-size: 18px;
  }

  .sidebar-menu .tool-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    padding: 6px;
  }

  .search-form {
    grid-template-columns: 1fr 46px;
  }

  .search-form input,
  .search-form button[type="submit"] {
    min-height: 48px;
    border-radius: 12px;
    font-size: 16px;
  }

  .search-form button[type="submit"] {
    width: 46px;
  }

  .detail-sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 52vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
    transform: translateY(0);
  }

  .detail-sheet.closed {
    transform: translateY(calc(100% + 24px));
  }

  .search-results {
    max-height: min(260px, 38vh);
  }

  .legal-links {
    gap: 6px 8px;
  }

  .legal-links a {
    font-size: 11px;
  }

  .sheet-handle {
    display: grid;
    place-items: center;
    width: 74px;
    height: 28px;
    margin: 0 auto 8px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: transparent;
    padding: 0;
    pointer-events: auto;
  }

  .sheet-handle::before {
    content: "";
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: #8b9491;
  }

  .account-dialog {
    align-self: end;
    width: 100%;
    max-height: 86vh;
    border-radius: 12px 12px 0 0;
  }

  .account-tabs {
    grid-template-columns: 1fr;
  }

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

  .profile-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

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

  .planner-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .planner-map-frame,
  .planner-map-frame iframe {
    min-height: 55vh;
    height: 55vh;
  }

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

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .admin-work-areas {
    grid-template-columns: 1fr;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .admin-main section {
    padding: 16px;
  }

  .admin-settings-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-layer-log-grid {
    grid-template-columns: 1fr;
  }

  .admin-bulk-panel form {
    grid-template-columns: 1fr;
  }
}
