:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

/* Atribut hidden platí i pro prvky, kterým CSS nastavuje display (např. .row). */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: #f5f6f8;
  color: #222;
  overflow: hidden;
}

.layout {
  display: grid;
  height: 100vh;
}

.app-layout {
  --left-panel-width: 360px;
  --right-panel-width: 360px;
  grid-template-columns: var(--left-panel-width) minmax(0, 1fr) var(--right-panel-width);
}

/* Pevné umístění do sloupců – sklopený (skrytý) panel pak nepřesune mapu do svého sloupce. */
.left-panel {
  grid-column: 1;
  grid-row: 1;
}

.map-area {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.right-panel {
  grid-column: 3;
  grid-row: 1;
}

.panel {
  /* relative: absolutně pozicované prvky (např. skrytý <select> od TomSelectu) zůstanou uvnitř panelu
     a nenatáhnou výšku dokumentu – jinak se dal dokument (body má overflow: hidden) programově odscrollovat. */
  position: relative;
  padding: 12px;
  overflow: auto;
  background: #fff;
}

.left-panel {
  border-right: 1px solid #d9dce3;
}

.right-panel {
  border-left: 1px solid #d9dce3;
}

.map-area {
  position: relative;
  padding: 10px;
  height: 100vh;
  /* Mapa nahoře (zabere zbytek výšky), pod ní pruh s výškovým profilem. */
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Mapa + prvky položené přes ni; pozice překryvů se počítají od mapy, ne od celé oblasti. */
.map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.map-search-overlay {
  position: absolute;
  top: 8px;
  left: 62px;
  z-index: 1200;
  width: min(520px, calc(100% - 80px));
}

.map-search-row {
  display: flex;
  gap: 8px;
}

.map-search-row input {
  flex: 1;
  background: rgba(255, 255, 255, 0.97);
}

.poi-filters {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d6deef;
  border-radius: 8px;
  padding: 6px 8px;
}

.poi-filters label {
  margin: 0;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.poi-filters input[type="checkbox"] {
  margin: 0;
}

.poi-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.poi-status {
  flex-basis: 100%;
}

.poi-popup-detail {
  margin-top: 2px;
  color: #4b5563;
  font-size: 12px;
}

.poi-status:empty {
  display: none;
}

.block {
  background: #fff;
  border: 1px solid #d9dce3;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

#map {
  width: 100%;
  height: 100%;
  border: 1px solid #d9dce3;
  border-radius: 8px;
}

.map-context-menu {
  position: fixed;
  z-index: 2000;
  display: none;
  background: #ffffff;
  border: 1px solid #cfd5df;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: 6px;
  min-width: 140px;
}

.map-context-menu button {
  width: 100%;
  margin: 2px 0;
  text-align: left;
  background: #f3f6ff;
  color: #1f2a44;
  border: 1px solid #d6ddf2;
}

.map-context-menu button:hover {
  background: #e8eeff;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  margin-bottom: 8px;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid #bcc3ce;
  border-radius: 6px;
  padding: 7px;
  background: #fff;
}

button {
  border: 1px solid #5679ea;
  background: #5f85ff;
  color: #fff;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
}

button:hover {
  background: #4f76f4;
}

button.danger {
  border-color: #9f2b2b;
  background: #b93131;
}

button.danger:hover {
  background: #a82828;
}

.row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.row.two > label {
  flex: 1;
}

.routing-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 8px;
  padding: 6px 8px;
  border: 1px solid #d9dce3;
  border-radius: 6px;
  background: #f7f9fc;
}

.routing-option-inline {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.hint {
  margin: 0;
  color: #5b6370;
  font-size: 12px;
}

.geocode-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  max-height: 220px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #d6deef;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.geocode-results:empty {
  display: none;
}

.geocode-result-item {
  text-align: left;
  border-color: #d6deef;
  background: #f5f8ff;
  color: #1f2a44;
  font-size: 12px;
  padding: 6px 8px;
}

.geocode-result-item:hover {
  background: #eaf0ff;
}

#geocodeStatus {
  margin-top: 6px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 6px;
  padding: 4px 6px;
}

.error {
  min-height: 16px;
  color: #c72f2f;
  font-size: 12px;
  margin: 4px 0 0;
}

.point-item {
  border: 1px solid #d6dbe5;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fafbff;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.point-item.point-item-highlight {
  border-color: #315efb;
  background: #eef3ff;
  box-shadow: 0 0 0 2px rgba(49, 94, 251, 0.2);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  border: 1px solid #d9dce3;
  border-radius: 6px;
  padding: 6px;
  background: #fff;
  font-size: 13px;
}

.metric.metric-wide {
  grid-column: 1 / -1;
}

.steps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.steps-table th,
.steps-table td {
  border: 1px solid #d9dce3;
  padding: 6px;
  text-align: left;
}

.steps-table .step-row-clickable {
  cursor: pointer;
  transition: background-color 140ms ease;
}

.steps-table .step-row-clickable:hover {
  background: #eef3ff;
}

.steps-table .step-row-active {
  background: #dbe7ff;
}

.step-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0 0 8px;
  padding: 6px 8px;
  border: 1px solid #d9dce3;
  border-radius: 6px;
  background: #f7f9fc;
}

.step-filters label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.surface-breakdown {
  margin-top: 10px;
  border: 1px solid #d9dce3;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  font-size: 12px;
}

.surface-breakdown strong {
  display: block;
  margin-bottom: 6px;
}

.surface-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  color: #3d4654;
}

#plannerOutput {
  width: 100%;
  resize: vertical;
  background: #f7f9fc;
}

/* ---------- Boční panely: sklápění (široká obrazovka) / výsuvné vrstvy (úzká obrazovka) ---------- */

.panel-edge-toggle {
  position: absolute;
  top: 50%;
  z-index: 1100;
  width: 22px;
  height: 64px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid #c9d2e3;
  background: rgba(255, 255, 255, 0.96);
  color: #334155;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

.panel-edge-toggle:hover {
  background: #eef2ff;
}

.panel-edge-toggle-left {
  left: 0;
  border-left: 0;
  border-radius: 0 8px 8px 0;
}

.panel-edge-toggle-right {
  right: 0;
  border-right: 0;
  border-radius: 8px 0 0 8px;
}

.mobile-panel-bar,
.panel-close,
.panel-backdrop {
  display: none;
}

/* ---------- Výškový profil (pruh pod mapou) ---------- */

.elevation-profile {
  flex: 0 0 auto;
  background: #ffffff;
  border: 1px solid #d9dce3;
  border-radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.elevation-profile-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 4px 10px;
}

.elevation-profile-toggle {
  padding: 2px 0;
  border: 0;
  background: none;
  color: #191919;
  font-weight: bold;
}

.elevation-profile-toggle:hover {
  background: none;
  text-decoration: underline;
}

.elevation-profile-toggle::before {
  content: "▾ ";
}

.elevation-profile.is-collapsed .elevation-profile-toggle::before {
  content: "▸ ";
}

.elevation-profile-summary {
  color: #191919;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.elevation-profile-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-left: auto;
  color: #666666;
  font-size: 12px;
}

.elevation-profile-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.elevation-profile-legend-swatch {
  width: 12px;
  height: 10px;
  border-radius: 2px;
}

.elevation-profile-body {
  position: relative;
  height: 170px;
}

.elevation-profile.is-collapsed .elevation-profile-body {
  display: none;
}

.elevation-profile-chart {
  position: absolute;
  inset: 0;
}

.elevation-profile-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}

.elevation-profile-chart.is-loading {
  opacity: 0.5;
}

.elevation-profile-overlay {
  cursor: crosshair;
  outline: none;
}

.elevation-profile-overlay:focus-visible {
  stroke: #257de0;
  stroke-width: 2;
}

.elevation-profile-tooltip {
  position: absolute;
  z-index: 2;
  padding: 6px 8px;
  border: 1px solid rgba(11, 11, 11, 0.1);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
  color: #666666;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  white-space: nowrap;
}

.elevation-profile-tooltip strong {
  color: #191919;
  font-size: 13px;
}

.elevation-profile-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: #666666;
  font-size: 13px;
  pointer-events: none;
}

.elevation-profile-status:empty {
  display: none;
}

/* ---------- Ubytování na noc ---------- */

.accommodation-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.accommodation-item {
  padding: 8px 0;
  border-top: 1px solid #e5e7eb;
  cursor: pointer;
}

.accommodation-item:hover,
.accommodation-item.is-active {
  background: #f5f8ff;
}

.accommodation-name {
  font-weight: bold;
  font-size: 14px;
}

.accommodation-meta {
  color: #666666;
  font-size: 12px;
}

.accommodation-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 3px;
  font-size: 13px;
}

.accommodation-links:empty {
  display: none;
}

.accommodation-links a {
  color: #1d4ed8;
}

.accommodation-add-note {
  padding: 1px 8px;
  font-size: 12px;
}

.popup-link-button {
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

/* ---------- Levý panel: hlavička, účet, navigace Projekty › Projekt › Trasa ---------- */

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

.panel-header h1 {
  margin: 0;
  font-size: 20px;
}

.account-menu {
  position: relative;
}

.account-menu > summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid #c9d2e3;
  border-radius: 999px;
  background: #f7f9fc;
  font-size: 13px;
  white-space: nowrap;
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu[open] > summary {
  background: #eef2ff;
  border-color: #9fb2f5;
}

.account-menu-body {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  width: min(320px, calc(100vw - 40px));
  padding: 10px;
  border: 1px solid #d9dce3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.link-button {
  border: 0;
  background: none;
  padding: 0;
  color: #315efb;
  cursor: pointer;
}

.link-button:hover {
  background: none;
  text-decoration: underline;
}

.link-button:disabled {
  color: #222;
  font-weight: bold;
  cursor: default;
  text-decoration: none;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-bottom: 10px;
  font-size: 13px;
}

.breadcrumb-sep {
  color: #8a93a3;
}

.breadcrumb-current {
  font-weight: bold;
}

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

.view-header h2,
.view-header h3 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.view-header h2 {
  font-size: 17px;
}

.view-header h3 {
  font-size: 15px;
}

.view-header-actions {
  display: flex;
  gap: 6px;
}

.view-header button,
.view-header-actions button {
  padding: 5px 9px;
  font-size: 13px;
  white-space: nowrap;
}

.list-filter {
  width: 100%;
  margin-bottom: 8px;
}

.nav-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Položka seznamu projektů / tras: celá je tlačítko. */
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #d6dbe5;
  border-radius: 6px;
  background: #fafbff;
  color: #222;
  text-align: left;
}

.nav-item:hover {
  background: #eef3ff;
  border-color: #9fb2f5;
}

.nav-item.is-active {
  border-color: #315efb;
  box-shadow: inset 3px 0 0 #315efb;
}

.nav-item-icon {
  flex: none;
  font-size: 20px;
}

.nav-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.nav-item-title {
  font-weight: bold;
  overflow-wrap: anywhere;
}

.nav-item-meta {
  color: #5b6370;
  font-size: 12px;
}

/* Seznam projektů: jeden řádek na projekt (název vlevo, počet tras a datum vpravo). */
.nav-item-compact {
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 6px 10px;
}

.nav-item-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.nav-item-compact .nav-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item-compact .nav-item-meta {
  flex: none;
  white-space: nowrap;
}

.nav-item-match {
  overflow: hidden;
  color: #315efb;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#projectsList,
#archivedProjectsList {
  gap: 4px;
}

/* Listování seznamem projektů po stránkách. */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
}

.pager button {
  padding: 5px 10px;
  font-size: 13px;
}

.pager button:disabled {
  border-color: #c9d2e3;
  background: #eef0f4;
  color: #8a93a3;
  cursor: default;
}

.pager-info {
  color: #4d5562;
  font-size: 13px;
}

.archived-projects {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.archived-projects > summary {
  cursor: pointer;
  margin-bottom: 8px;
  color: #4d5562;
  font-size: 14px;
  font-weight: bold;
}

.badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef0f4;
  color: #4d5562;
  font-size: 12px;
}

/* Menu "⋯" u projektu a trasy. */
.item-menu {
  position: relative;
  margin-left: auto;
}

.item-menu > summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 10px;
  border: 1px solid #c9d2e3;
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
  line-height: 1.2;
}

.item-menu > summary::-webkit-details-marker {
  display: none;
}

.item-menu-body {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d9dce3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

.item-menu-body label,
.item-menu-body .row {
  margin-bottom: 0;
}

/* Položky menu jako seznam akcí, ne řada modrých tlačítek. */
.item-menu-body > button {
  border-color: transparent;
  background: #fff;
  color: #222;
  text-align: left;
  padding: 6px 8px;
  font-size: 14px;
}

.item-menu-body > button:hover {
  background: #eef3ff;
}

.item-menu-body > button.danger {
  color: #b93131;
}

.item-menu-body > button.danger:hover {
  background: #fdecec;
}

.item-menu-body {
  gap: 4px;
}

.menu-sep {
  width: 100%;
  margin: 2px 0;
  border: 0;
  border-top: 1px solid #e5e7eb;
}

/* Souhrn projektu: náklady a km. */
.trip-summary {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #d6dbe5;
  border-radius: 6px;
  background: #fafbff;
  font-size: 13px;
}

.trip-summary-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.trip-summary-total strong {
  font-size: 18px;
}

.trip-summary-line {
  margin-top: 4px;
  color: #4d5562;
}

.trip-summary .hint {
  margin-top: 6px;
}

/* Další náklady projektu: upravitelné řádky (název, částka). */
.cost-list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cost-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.cost-list .cost-row {
  margin-bottom: 0;
}

.cost-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.cost-row input[type="number"] {
  width: 86px;
  flex: none;
}

.currency-select,
.point-editor .field-row .currency-select,
.cost-row .currency-select {
  flex: none;
  width: 68px;
  min-width: 0;
  padding-left: 4px;
  padding-right: 2px;
}

.cost-row .cost-amount,
#projectCostAmount {
  width: 76px;
}

.settings-currency {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 8px;
}

/* Další náklad v cizí měně: přepočet pod řádkem. */
.cost-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cost-converted {
  padding-left: 4px;
  color: #5b6370;
  font-size: 12px;
}

.budget-note {
  flex-basis: 100%;
  font-size: 12px;
  font-weight: normal;
}

.cost-row button {
  flex: none;
  padding: 6px 10px;
}

.cost-delete {
  font-size: 18px;
  line-height: 1;
}

.nav-item-sub {
  color: #4d5562;
  font-size: 12px;
}

.link-danger {
  color: #b93131;
}

/* Sbalitelné sekce editoru trasy (Bod, Nástroje, Sdílet a export, Pokročilé). */
.collapsible-block > summary {
  cursor: pointer;
  font-weight: bold;
  font-size: 15px;
}

.collapsible-block[open] > summary {
  margin-bottom: 10px;
}

/* ---------- Nastavení uživatele ---------- */

.user-settings {
  margin-top: 8px;
  border-top: 1px solid #e5e7eb;
  padding-top: 8px;
}

.user-settings summary,
.collapsible-tool summary {
  cursor: pointer;
  font-weight: bold;
  margin-bottom: 6px;
}

.collapsible-tool {
  margin: 4px 0 10px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.user-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}

@media (min-width: 1101px) {
  .app-layout.left-collapsed {
    --left-panel-width: 0px;
  }

  .app-layout.right-collapsed {
    --right-panel-width: 0px;
  }

  .app-layout.left-collapsed .left-panel,
  .app-layout.right-collapsed .right-panel {
    display: none;
  }
}

@media (max-width: 1100px) {
  /* Mapa přes celou obrazovku, panely vyjíždějí přes ni. */
  .app-layout {
    grid-template-columns: minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
  }

  .map-area {
    grid-column: 1;
    height: 100vh;
    height: 100dvh;
  }

  .elevation-profile-body {
    height: 140px;
  }


  .panel-edge-toggle {
    display: none;
  }

  .mobile-panel-bar {
    display: flex;
    position: absolute;
    bottom: 28px;
    left: 50%;
    z-index: 1100;
    gap: 8px;
    max-width: calc(100% - 40px);
    transform: translateX(-50%);
  }

  .mobile-panel-bar button {
    flex: 0 0 auto;
    padding: 10px 16px;
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.3);
  }

  /* Plán se nezkracuje, dlouhý souhrn ano. */
  .mobile-panel-bar #rightPanelMobileBtn {
    flex: 0 1 auto;
    min-width: 0;
  }

  .left-panel,
  .right-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 1500;
    width: min(380px, 92vw);
    box-shadow: 0 0 24px rgba(15, 23, 42, 0.28);
    visibility: hidden;
    transition: transform 0.2s ease, visibility 0s linear 0.2s;
  }

  .left-panel {
    left: 0;
    transform: translateX(-105%);
  }

  .right-panel {
    right: 0;
    transform: translateX(105%);
  }

  .app-layout.left-open .left-panel,
  .app-layout.right-open .right-panel {
    visibility: visible;
    transform: none;
    transition: transform 0.2s ease;
  }

  .panel-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .app-layout.left-open .panel-backdrop,
  .app-layout.right-open .panel-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .panel-close {
    display: block;
    position: sticky;
    top: 0;
    z-index: 1;
    width: 36px;
    height: 36px;
    margin: 0 0 4px auto;
    padding: 0;
    border: 1px solid #c9d2e3;
    border-radius: 50%;
    background: #fff;
    color: #334155;
    font-size: 22px;
    line-height: 1;
  }

  .panel-close:hover {
    background: #eef2ff;
  }
}

@media (max-width: 600px) {
  /* Telefon: souhrn jako panel zespodu. */
  .right-panel {
    top: auto;
    left: 0;
    right: 0;
    width: auto;
    max-height: 75vh;
    max-height: 75dvh;
    border-radius: 12px 12px 0 0;
    transform: translateY(105%);
  }
}

#pointLat, #pointLng {
  width: 100%;
}

#pointElevation, #pointStop {
  width: 100%;
}

.itinerary-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.itinerary-modal.is-open {
  display: flex;
}

.itinerary-modal-dialog {
  width: min(980px, 96vw);
  max-height: calc(100vh - 40px);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
  border: 1px solid #d9dce3;
  display: flex;
  flex-direction: column;
}

.itinerary-modal-header,
.itinerary-modal-footer {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.itinerary-modal-footer {
  border-bottom: none;
  border-top: 1px solid #e5e7eb;
  justify-content: flex-end;
}

.itinerary-modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.itinerary-modal-close {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #d1d5db;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.itinerary-modal-content {
  padding: 16px;
  overflow: auto;
  color: #111827;
}

.itinerary-title {
  margin: 0 0 8px;
  font-size: 24px;
}

.itinerary-meta {
  color: #4b5563;
  margin-bottom: 12px;
}

.itinerary-summary {
  background: #f3f4f6;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}

.segment-block {
  margin-bottom: 20px;
  page-break-inside: avoid;
}

.segment-block h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.segment-summary {
  margin: 0 0 8px;
  color: #374151;
}

.itinerary-list {
  margin: 0;
  padding-left: 20px;
}

.itinerary-list li {
  margin-bottom: 8px;
}

.itinerary-step-main {
  font-weight: 600;
}

.itinerary-step-meta {
  color: #4b5563;
  font-size: 13px;
}

body.itinerary-modal-open {
  overflow: hidden;
}

@media print {
  body * {
    visibility: hidden !important;
  }

  #itineraryModal,
  #itineraryModal * {
    visibility: visible !important;
  }

  #itineraryModal {
    position: static;
    inset: auto;
    display: block !important;
    background: #fff;
    padding: 0;
  }

  .itinerary-modal-dialog {
    width: auto;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .itinerary-modal-header,
  .itinerary-modal-footer {
    display: none !important;
  }

  .itinerary-modal-content {
    padding: 0;
    overflow: visible;
  }
}
/* ---------- Přehlednost: název jako upravitelný nadpis, stav ukládání, hlášky, sdílení, body trasy ---------- */

/* Název projektu / trasy: vypadá jako nadpis, klik ho upraví. */
.title-input {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 17px;
  font-weight: bold;
}

.title-input:hover {
  border-color: #d6dbe5;
}

.title-input:focus {
  border-color: #9fb2f5;
  background: #fff;
  outline: none;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.save-indicator {
  color: #5b6370;
}

.save-indicator.is-error {
  color: #c72f2f;
}

/* Jediné místo pro hlášky: dole uprostřed, nad mobilní lištou panelů. */
.app-message {
  position: fixed;
  left: 50%;
  bottom: 90px;
  z-index: 3000;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: min(92vw, 520px);
  padding: 10px 12px;
  border-radius: 8px;
  background: #1f2937;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.3);
  transform: translateX(-50%);
}

.app-message.is-error {
  background: #b42318;
}

.app-message-close {
  flex: none;
  padding: 0 4px;
  border: 0;
  background: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
}

.app-message-close:hover {
  background: none;
}

.share-dialog {
  width: min(92vw, 440px);
  padding: 16px;
  border: 1px solid #d9dce3;
  border-radius: 10px;
}

.share-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.share-dialog h3 {
  margin: 0 0 6px;
}

.share-dialog .row {
  margin: 10px 0 0;
}

.share-dialog input {
  flex: 1;
  min-width: 0;
}

.share-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.secondary-button,
.secondary-button:hover {
  border-color: #c9d2e3;
  background: #fff;
  color: #222;
}

/* Body trasy: jeden řádek na bod, klik rozbalí úpravu přímo v seznamu. */
.points-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.points-list .point-item {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.point-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #222;
  text-align: left;
}

.point-row:hover {
  background: #eef3ff;
}

.point-number {
  flex: none;
  min-width: 18px;
  color: #5b6370;
  font-size: 12px;
}

.kind-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.point-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.point-extra {
  flex: none;
  color: #5b6370;
  font-size: 12px;
  white-space: nowrap;
}

.point-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

/* ---------- Ikony, menu s řádky, nástroje trasy, rozpočet projektu ---------- */
.icon-button,
.icon-button:hover {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  border: 1px solid #c9d2e3;
  background: #fff;
  color: #334155;
}

.icon-button:hover {
  background: #eef3ff;
}

.icon-button.icon-danger {
  color: #b93131;
}

.icon-button.icon-danger:hover {
  background: #fdecec;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 2px 0;
  flex-direction: row;
  font-size: 13px;
}

.menu-row > span {
  flex: 1;
}

.menu-row input[type="number"] {
  width: 70px;
}

.menu-row select {
  flex: 1;
  min-width: 0;
}

.menu-row-end {
  justify-content: flex-end;
}

/* Hlavička bodu: akce nahoře vedle názvu, aby se po rozbalení nemuselo dolů. */
.point-head-row {
  display: flex;
  align-items: center;
}

.point-head-row .point-row {
  flex: 1;
  min-width: 0;
}

.point-row-actions {
  display: flex;
  gap: 4px;
  padding-right: 6px;
}

.point-row-actions .icon-button {
  padding: 3px 6px;
}

.tools-panel {
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fafbff;
}

.tools-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.tools-actions button {
  padding: 5px 9px;
  font-size: 13px;
}

.tools-panel .collapsible-tool {
  margin: 6px 0 0;
  background: #fff;
}

/* Projekt: součet tras pod seznamem, rozpočet se součtem. */
.list-totals {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 10px;
  margin: 0 0 12px;
  padding: 6px 10px;
  border-top: 2px solid #d6dbe5;
  font-size: 13px;
}

.budget-list {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
}

.budget-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 10px;
  font-size: 13px;
  color: #4d5562;
}

.budget-total {
  font-weight: bold;
  font-size: 15px;
}

/* Úprava bodu a skupiny nastavení: popisek vlevo, pole vpravo, jednotka za číslem. */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 10px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.settings-group legend {
  padding: 0 4px;
  font-size: 13px;
  font-weight: bold;
}

.settings-group .field-row,
.point-editor .field-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

.settings-group .field-row > span:first-child,
.point-editor .field-row > span:first-child {
  color: #5b6370;
}

.point-editor .field-row-top {
  align-items: start;
}

.point-editor .field-row-top > span:first-child {
  padding-top: 7px;
}

.settings-group .field-row select,
.point-editor .field-row select,
.point-editor .field-row input[type="text"],
.point-editor .field-row textarea {
  width: 100%;
  min-width: 0;
}

.point-editor .field-row input[type="time"] {
  width: 120px;
}

.input-unit {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5b6370;
}

.input-unit input {
  width: 100px;
}

/* Varianty trasy v projektu. */
.variant-bar {
  display: flex;
  gap: 14px;
  padding: 4px 10px 0 44px;
  font-size: 12px;
}

.variant-list {
  list-style: none;
  margin: 4px 0 0 34px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 2px solid #d6dbe5;
}

.variant-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px 8px;
  padding: 4px 8px;
  font-size: 13px;
}

.variant-row.is-active {
  background: #eef3ff;
}

.variant-row input {
  margin: 0;
}

.variant-row .link-button {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.variant-row .nav-item-meta {
  grid-column: 2;
}

.variant-state {
  color: #5b6370;
}

.compare-dialog {
  width: min(94vw, 640px);
}

.compare-table-wrap {
  overflow-x: auto;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.compare-table th,
.compare-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: right;
  white-space: nowrap;
}

.compare-table th:first-child,
.compare-table td:first-child {
  text-align: left;
  color: #5b6370;
}

.compare-table .is-chosen {
  background: #eef3ff;
}

.compare-table .is-best {
  font-weight: bold;
}

#routeToolsToggle.is-active {
  border-color: #9fb2f5;
  background: #eef3ff;
}
