:root {
  color-scheme: dark light;
  --bg: #12161c;
  --card: #1b2430;
  --fg: #e8ecf1;
  --muted: #93a1b3;
  --accent: #4f8cff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: var(--card);
  border-bottom: 1px solid #2a3441;
}

.topbar h1 { font-size: 1.1rem; margin: 0; flex: 1; }

.status { font-size: 0.85rem; color: var(--muted); }

.topbar-plus-btn {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  margin-right: 12px;
  border-radius: 50%;
  border: 1.5px solid var(--fg);
  background: none;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-plus-btn svg { width: 20px; height: 20px; }

.hamburger-btn {
  width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 1.4rem;
  padding: 0;
  margin-right: 8px;
}

.nav-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  width: 220px;
  background: var(--card);
  border-right: 1px solid #2a3441;
  padding: max(16px, env(safe-area-inset-top)) 0 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  width: 100%;
  min-height: 48px;
  background: none;
  color: var(--fg);
  text-align: left;
  padding: 0 20px;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.nav-item:active,
.nav-item.aktivni { background: #2a3441; }

.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.mapa-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.mapa-hlavicka {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: var(--card);
  border-bottom: 1px solid #2a3441;
}

.mapa-hlavicka span { font-size: 0.9rem; color: var(--muted); }
.mapa-hlavicka .btn-secondary { width: auto; padding: 0 14px; min-height: 36px; }

#mapa-plocha {
  flex: 1;
  min-height: 0;
}

.mapa-paticka {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid #2a3441;
}

main {
  padding: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
}

.card h2 { margin-top: 0; font-size: 1rem; }

.card p { color: var(--muted); line-height: 1.4; }

.card--nebezpecna {
  border: 1px solid #4a2320;
  margin-top: 24px;
}

.card--nebezpecna h2 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.btn-danger {
  display: block;
  width: auto;
  min-height: 36px;
  padding: 0 14px;
  margin: 0 auto;
  background: transparent;
  border: 1px solid #7a3530;
  color: #d97b76;
  font-size: 0.85rem;
  font-weight: 500;
}

.o-aplikaci-hlavicka {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.o-aplikaci-hlavicka img {
  border-radius: 18px;
  margin-bottom: 8px;
}

.o-aplikaci-hlavicka h2 { font-size: 1.2rem; }

.o-aplikaci-hlavicka .hint { margin: 0; }

.o-aplikaci-paticka {
  font-style: italic;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin: 0.5rem 0 1rem;
}

.o-aplikaci-paticka a {
  color: inherit;
}

button {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button:active { opacity: 0.8; }

.btn-secondary {
  background: #2a3441;
  color: var(--fg);
  font-weight: 500;
  min-height: 44px;
}

.btn-primary { margin-top: 8px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  background: #232e3d;
  border: 1px solid #2a3441;
  border-radius: 8px;
  color: var(--fg);
  padding: 10px;
  font-size: 1rem;
  min-height: 44px;
}

.field textarea { min-height: 60px; resize: vertical; }

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 0;
}

.checkbox-field input { min-height: auto; width: 22px; height: 22px; flex-shrink: 0; }

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

.row-inline select { flex: 1; min-width: 0; }
.row-inline .btn-secondary { width: auto; padding: 0 14px; }

.filtry-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.filtry-container select {
  background: #232e3d;
  border: 1px solid #2a3441;
  border-radius: 8px;
  color: var(--fg);
  padding: 10px;
  font-size: 1rem;
  min-height: 44px;
  width: 100%;
}

.heatmapa-legenda {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.heatmapa-rok {
  margin-bottom: 20px;
}

.heatmapa-rok h3 {
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.heatmapa-scroll-wrap {
  position: relative;
}

.heatmapa-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.heatmapa-stin {
  position: absolute;
  top: 0;
  bottom: 4px;
  width: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.heatmapa-stin--vlevo {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.5), transparent);
}

.heatmapa-stin--vpravo {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.5), transparent);
}

.heatmapa-stin--viditelny {
  opacity: 1;
}

.heatmapa-mesice {
  display: flex;
  gap: 3px;
  margin-bottom: 3px;
}

.heatmapa-mesic-label {
  width: 12px;
  flex-shrink: 0;
  font-size: 0.6rem;
  color: var(--muted);
  overflow: visible;
  white-space: nowrap;
}

.heatmapa-mrizka {
  display: flex;
  gap: 3px;
}

.heatmapa-tyden {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.heatmapa-den {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: #232e3d;
  flex-shrink: 0;
  display: inline-block;
}

.heatmapa-den--prazdny {
  background: transparent;
}

.heatmapa-mrizka .heatmapa-den:not(.heatmapa-den--prazdny) {
  cursor: pointer;
}

.heatmapa-den--uroven1 { background: #234a7a; }
.heatmapa-den--uroven2 { background: #2f6bb0; }
.heatmapa-den--uroven3 { background: #3f8ce0; }
.heatmapa-den--uroven4 { background: var(--accent); }

.heatmapa-den--zavod {
  box-shadow: 0 0 0 2px #e0b23f inset;
}

#heatmapa-detail {
  margin-top: 8px;
}

#heatmapa-detail .plain-list {
  margin-top: 8px;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1em;
}

.souhrn-radek {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.souhrn-radek strong {
  color: var(--fg);
}

.souhrn-vedlejsi {
  opacity: 0.7;
}

.inline-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding: 10px;
  background: #17202b;
  border-radius: 8px;
}

.inline-panel input {
  background: #232e3d;
  border: 1px solid #2a3441;
  border-radius: 8px;
  color: var(--fg);
  padding: 10px;
  font-size: 1rem;
  min-height: 44px;
}

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

.radek select,
.radek input {
  background: #232e3d;
  border: 1px solid #2a3441;
  border-radius: 8px;
  color: var(--fg);
  padding: 8px;
  font-size: 0.9rem;
  min-height: 44px;
  min-width: 0;
}

.radek .pocet-ran { width: 70px; }

.radek .inline-panel { grid-column: 1 / -1; }

.nasepovac-seznam {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
  background: #232e3d;
  border: 1px solid #2a3441;
  border-radius: 8px;
  margin-top: -2px;
}

.nasepovac-polozka {
  padding: 10px 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
}

.nasepovac-polozka:active { background: #2a3441; }

.remove-radek {
  width: 36px;
  min-height: 36px;
  padding: 0;
  background: #3a2a2a;
  color: #e88;
  font-size: 1.2rem;
  line-height: 1;
}

.hidden { display: none !important; }

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

.plain-list--preview {
  max-height: 320px;
  overflow-y: auto;
}

.plain-list li {
  background: #232e3d;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.polozka-hlavicka {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.polozka-ikona {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--muted);
}

.zbran-fotka-mini {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.upravit-zbran-fotka-nahled {
  display: block;
  max-width: 160px;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
}

.polozka-klikatelna {
  cursor: pointer;
}

.polozka-klikatelna:active {
  opacity: 0.7;
}

.import-stav {
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
}

.import-stav--ok {
  background: #1e3a2a;
  color: #6fd99a;
}

.import-stav--chyba {
  background: #3a2a2a;
  color: #e88;
}

.import-seznam {
  margin: 0;
  padding-left: 20px;
  font-size: 0.85rem;
  line-height: 1.5;
}

.import-seznam--chyby li { color: #e88; }
.import-seznam--varovani li { color: #d9b35c; }

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.najezd {
  color: var(--accent);
  font-weight: 600;
}

.najezd-celkem {
  color: var(--fg);
  font-weight: normal;
}
