:root {
  --planner-ink: #2d2f35;
  --planner-muted: #7d8380;
  --planner-line: #e5e8e5;
  --planner-soft: #f4f5f4;
  --planner-accent: #ffd45a;
}

.leaflet-attribution-flag { display: none !important; }

/* Главный экран оставляет всю ширину карте. Фото управляются в отдельном архиве. */
.app-shell,
.app-shell.planning {
  grid-template-columns: minmax(0, 1fr);
}

.app-shell > .sidebar,
#sidebar-toggle {
  display: none !important;
}

.app-shell .map-tools,
.app-shell.planning .map-tools {
  top: auto;
  right: 5px;
  bottom: 115px;
  left: auto;
}

.map-stage > .map-layer-panel {
  position: absolute;
  z-index: 500;
  top: 14px;
  right: 14px;
  left: auto;
  width: 220px;
}

.layer-trigger {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  gap: 9px;
  align-items: center;
  padding: 6px 9px 6px 6px;
  border: 1px solid #e3e7e3;
  border-radius: 16px;
  background: #fffffff2;
  box-shadow: 0 13px 38px #17261d22;
  color: #343a36;
  text-align: left;
  backdrop-filter: blur(14px);
}
.layer-trigger:hover,.layer-trigger[aria-expanded="true"] { background: #fff; }
.layer-trigger:focus { outline: none; }
.layer-trigger:focus-visible { box-shadow: 0 0 0 3px #ffd45a, 0 13px 38px #17261d22; }
.layer-selected-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #30343a; color: #fff; font-size: 19px; }
.layer-selected-copy { min-width: 0; }
.layer-selected-copy small,.layer-selected-copy b { display: block; }
.layer-selected-copy small { color: #8a918d; font-size: 9px; font-weight: 720; }
.layer-selected-copy b { overflow: hidden; margin-top: 2px; color: #30353a; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.layer-trigger > i { color: #7d8580; font-size: 16px; font-style: normal; transition: transform .18s ease; }
.layer-trigger[aria-expanded="true"] > i { transform: rotate(180deg); }
.layer-menu { position: absolute; top: 60px; right: 0; width: 310px; max-height: calc(100vh - 140px); overflow-y: auto; padding: 9px; border: 1px solid #e2e6e2; border-radius: 18px; background: #fffffff5; box-shadow: 0 22px 60px #14201935; backdrop-filter: blur(18px); }
.layer-menu[hidden] { display: none; }
.layer-menu section { padding: 7px; }
.layer-menu section + section { border-top: 1px solid #e9ece9; }
.layer-menu section > strong { display: block; padding: 2px 3px 7px; color: #8b928e; font-size: 9px; letter-spacing: .8px; }
.layer-option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.layer-option-grid button { min-width: 0; min-height: 50px; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: center; padding: 7px; border: 1px solid transparent; border-radius: 12px; background: #f3f5f3; color: #3d4540; text-align: left; }
.layer-option-grid button:hover { border-color: #d8ded9; background: #fff; }
.layer-option-grid button.active { border-color: #edc447; background: #fff5c9; box-shadow: 0 0 0 1px #ffd45a; }
.layer-option-grid button > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #fff; color: #30343a; font-size: 16px; box-shadow: 0 2px 8px #24342a12; }
.layer-option-grid button.active > span { background: #30343a; color: #fff; }
.layer-option-grid button > b { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.layer-option-grid button.offline-map-option { grid-column: 1 / -1; }
.layer-option-grid button.offline-map-option > span { background: #e2f2e7; color: #23734b; }
.layer-option-grid button.offline-map-option.active > span { background: #23734b; color: #fff; }
.map-layer-panel select {
  display: none;
}

.map-stage > .photo-map-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 5px 7px 5px 6px;
  border: 1px solid #e2e6e2;
  background: #fffffff2;
  color: #343b37;
  font-size: 11px;
  font-weight: 750;
  backdrop-filter: blur(12px);
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.photo-map-toggle:hover { transform: translateY(-1px); }
.photo-map-toggle:focus { outline: none; }
.photo-map-toggle:focus-visible { box-shadow: 0 0 0 3px #ffd45a, 0 8px 25px #18271e1b; }
.photo-map-toggle .photo-toggle-icon { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 9px; background: #e7f4eb; font-size: 13px; }
.photo-map-toggle i { position: relative; width: 29px; height: 17px; margin-left: 2px; border-radius: 10px; background: #2d8a59; transition: background .18s ease; }
.photo-map-toggle i::after { content: ""; position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #17261d40; transition: transform .18s ease; }
.photo-map-toggle.photos-hidden { background: #30343af0; color: #fff; }
.photo-map-toggle.photos-hidden .photo-toggle-icon { background: #ffffff19; }
.photo-map-toggle.photos-hidden i { background: #686d71; }
.photo-map-toggle.photos-hidden i::after { transform: translateX(-12px); }

.planner-panel {
  overflow: hidden;
  background: #fff;
}

.planner-title {
  position: static;
  flex: 0 0 auto;
  padding: 18px 20px 12px;
  border: 0;
}

.planner-title input {
  color: var(--planner-ink);
  font-size: 23px;
  font-weight: 780;
}

.route-switcher {
  position: relative;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 38px 38px 42px;
  gap: 7px;
  align-items: center;
  flex: 0 0 auto;
  margin: 0 15px 13px;
  padding: 9px 9px 9px 12px;
  border: 1px solid var(--planner-line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 5px 18px #1c2a220b;
}

.route-switcher > i {
  width: 8px;
  height: 34px;
  border-radius: 8px;
  background: #168cc2;
}

.route-switcher select {
  min-width: 0;
  height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--planner-ink);
  font: 750 14px/1.2 inherit;
  cursor: pointer;
}

.route-switcher > button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: var(--planner-soft);
  color: #42474b;
  font-size: 16px;
  font-weight: 800;
}

.route-switcher > button:hover { background: #e9ece9; }
.route-switcher > button.route-hidden { color: #a3a8a5; }
.route-switcher #route-add { background: var(--planner-accent); color: #2d2f35; font-size: 21px; }

.route-menu {
  position: absolute;
  z-index: 30;
  top: 56px;
  right: 0;
  display: grid;
  min-width: 200px;
  padding: 7px;
  border: 1px solid var(--planner-line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 18px 45px #1b282129;
}

.route-menu[hidden] { display: none; }
.route-menu button { padding: 10px 11px; border-radius: 8px; background: transparent; color: #42474b; text-align: left; font-size: 12px; font-weight: 700; }
.route-menu button:hover { background: var(--planner-soft); }
.route-menu button.danger { color: #c64b4b; }

.planner-stats {
  grid-template-columns: repeat(4, 1fr);
  flex: 0 0 auto;
  border-top: 1px solid #f0f1f0;
  border-bottom: 0;
  background: #fff;
}

.planner-stats div { padding: 10px 3px 12px; border: 0; }
.planner-stats b { color: var(--planner-ink); font-size: 17px; }
.planner-stats span { color: var(--planner-muted); font-size: 9px; }

.workspace-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  flex: 0 0 auto;
  margin: 0 15px 12px;
  padding: 4px;
  border-radius: 14px;
  background: #f2f3f2;
}

.workspace-tabs button {
  height: 35px;
  border-radius: 10px;
  background: transparent;
  color: #626764;
  font-size: 11px;
  font-weight: 760;
}

.workspace-tabs button.active {
  background: var(--planner-ink);
  color: #fff;
  box-shadow: 0 4px 12px #22272d24;
}

.planner-workspace {
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  border-top: 1px solid #eef0ee;
  background: #fafbfa;
}

.workspace-view {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 15px;
  scrollbar-width: thin;
}

.workspace-view.active { display: block; }

.workspace-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.workspace-section-head b,
.workspace-section-head small { display: block; }
.workspace-section-head b { color: var(--planner-ink); font-size: 14px; }
.workspace-section-head small { margin-top: 2px; color: var(--planner-muted); font-size: 10px; }
.workspace-section-head > span { color: var(--planner-muted); font-size: 10px; white-space: nowrap; }
.workspace-section-head > span b { display: inline; color: var(--planner-ink); }
.workspace-section-head > button { padding: 8px 11px; border-radius: 10px; background: #ecefec; color: #4e5751; font-size: 10px; font-weight: 750; }

.workspace-view .route-node-tools,
.workspace-view .point-palette,
.workspace-view .planner-settings,
.workspace-view .edit-toolbar,
.workspace-view .route-display-options,
.workspace-view .analysis-tabs,
.workspace-view .route-analysis {
  padding-left: 0;
  padding-right: 0;
  background: transparent;
}

.workspace-view .route-node-tools { padding-bottom: 11px; }
.workspace-view .route-node-tools .point-type { height: 42px; border: 1px solid #e3e7e3; background: #fff; color: #444b47; }
.workspace-view .route-node-tools .point-type.active { border-color: #2d2f35; background: #2d2f35; color: #fff; }
.workspace-view .route-mode-settings {
  margin-bottom: 9px;
  padding: 10px;
  border: 1px solid #e2e6e2;
  border-radius: 13px;
  background: #fff;
}
.workspace-view .route-mode-settings select,
.workspace-view .route-mode-settings input { background: #f6f7f6; }
.workspace-view .route-edit-toolbar {
  display: grid;
  grid-template-columns: 38px 38px repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 0 10px;
}
.workspace-view .route-edit-toolbar button { min-width: 0; padding: 0 6px; }
.workspace-view .planner-help { margin: 0 0 13px; border: 0; border-radius: 11px; background: #fff7d9; color: #6e5b23; }
.workspace-view .route-stage-list { margin-bottom: 14px; }
.workspace-view .route-stage-card { box-shadow: 0 3px 12px #2531290a; }
.workspace-view .route-list-head { padding: 10px 2px 7px; border-top: 1px solid var(--planner-line); background: transparent; }
.workspace-view .route-points-list { min-height: 0; margin: 0; border: 0; background: transparent; }
.workspace-view .route-point-row { margin-bottom: 6px; border: 1px solid var(--planner-line); border-radius: 12px; background: #fff; }

.workspace-view .point-palette {
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  height: 150px;
  flex-basis: auto;
  margin-bottom: 13px;
  overflow: hidden;
}

.workspace-view .point-palette.expanded { height: auto; max-height: none; overflow: visible; }
.workspace-view .point-palette button { height: 49px; border: 1px solid #e4e8e4; border-radius: 13px; background: #fff; font-size: 23px; box-shadow: 0 3px 11px #2031270a; }
.workspace-view .point-palette button.active { border-color: #ffd45a; background: #fff3c3; color: #27292e; box-shadow: 0 0 0 2px #ffd45a; }
.workspace-empty { padding: 26px 12px; border: 1px dashed #d9ded9; border-radius: 13px; color: #89908b; text-align: center; font-size: 11px; }
.workspace-empty[hidden] { display: none; }

.photo-workspace-hero {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 18px;
  border: 1px solid #e2e7e3;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff, #f1f7f3);
}

.photo-workspace-hero > span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #2f3438; font-size: 22px; }
.photo-workspace-hero b,.photo-workspace-hero small { display: block; }
.photo-workspace-hero b { color: var(--planner-ink); font-size: 13px; }
.photo-workspace-hero strong { font-size: 18px; }
.photo-workspace-hero small { margin-top: 4px; color: var(--planner-muted); font-size: 10px; }
.workspace-view[data-workspace-view="photos"] > p { color: #6f7671; font-size: 12px; line-height: 1.55; }
.workspace-button-stack { display: grid; gap: 8px; margin-top: 16px; }
.workspace-button-stack button,.workspace-button-stack a { display: flex; align-items: center; justify-content: center; min-height: 43px; border: 1px solid #dfe4e0; border-radius: 12px; background: #fff; color: #3e4641; text-decoration: none; font-size: 12px; font-weight: 750; }
.workspace-button-stack a { border-color: #2f3438; background: #2f3438; color: #fff; }

.workspace-view .planner-settings { border: 0; }
.workspace-view .planner-settings label { background: transparent; }
.workspace-view .edit-toolbar { padding-top: 9px; padding-bottom: 11px; }
.workspace-view .edit-toolbar button { background: #fff; border: 1px solid #e1e5e1; }
.workspace-view .route-display-options { padding-bottom: 14px; border-top: 0; }
.workspace-view .analysis-tabs { grid-template-columns: repeat(2, 1fr); padding-top: 12px; border-top: 1px solid var(--planner-line); }
.workspace-view .route-analysis { border: 0; }

.planner-actions {
  position: static;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) 82px;
  padding: 11px 14px 14px;
}

.planner-actions .build-route { background: var(--planner-accent) !important; color: #2d2f35 !important; }
.planner-actions #river-export { background: #30343a !important; }

@media (max-width: 720px) {
  .app-shell .map-tools,
  .app-shell.planning .map-tools {
    top: auto !important;
    right: 5px !important;
    bottom: 115px;
    left: auto !important;
  }
  .map-stage > .map-layer-panel {
    top: 58px;
    right: 8px;
    width: 188px;
  }
  .layer-trigger { min-height: 44px; grid-template-columns: 32px minmax(0,1fr) 15px; gap: 7px; padding: 5px; border-radius: 14px; }
  .layer-selected-icon { width: 32px; height: 32px; border-radius: 10px; font-size: 16px; }
  .layer-selected-copy small { display: none; }
  .layer-selected-copy b { margin: 0; font-size: 11px; }
  .layer-menu { top: 51px; right: 0; width: min(310px, calc(100vw - 16px)); max-height: calc(100vh - 125px); }
  .map-stage > .photo-map-toggle { display: flex; left: 8px; bottom: 12px; }
  .planner-panel { top: 57px; }
  .planner-title { padding: 12px 15px 8px; }
  .planner-title input { font-size: 19px; }
  .route-switcher { margin: 0 10px 8px; }
  .planner-stats div { padding: 7px 2px 8px; }
  .workspace-tabs { margin: 0 10px 8px; }
  .workspace-view { padding: 12px; }
  .workspace-view .point-palette { grid-template-columns: repeat(6, 1fr); }
  .workspace-view .point-palette button { height: 46px; }
}
