:root {
  --bg: #f3f4f6; --panel: #fff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --accent: #1d4ed8; --accent-soft: #dbeafe; --ok: #15803d; --ok-soft: #dcfce7;
  --warn: #b45309; --warn-soft: #fef3c7; --danger: #b91c1c; --danger-soft: #fee2e2; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 16px; min-height: 44px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
button.danger { color: var(--danger); border-color: #fca5a5; }
button.small { padding: 6px 12px; min-height: 36px; font-size: 14px; }
button.block { width: 100%; }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=search], input[type=number], select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; width: 100%; min-height: 44px; }
textarea { min-height: 90px; resize: vertical; }
label.f { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; padding-top: calc(8px + env(safe-area-inset-top)); }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; font-weight: 800; }
nav a { display: inline-block; padding: 7px 10px; border-radius: 8px; color: var(--text); font-size: 15px; }
nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.supportbar { display: block; position: sticky; top: 52px; z-index: 4; background: var(--ok-soft); color: var(--ok); border-bottom: 1px solid #86efac; padding: 7px 14px; font-size: 14px; text-align: center; }
.supportbar b { font-weight: 700; }
.supportbar .muted { color: #3f6b4f; font-size: 12px; }

main { max-width: 900px; margin: 0 auto; padding: 12px 14px calc(40px + env(safe-area-inset-bottom)); }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 15px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 8px; text-align: center; }
.tile .n { font-size: 22px; font-weight: 700; }
.tile .l { font-size: 11px; color: var(--muted); }
.tile.active { outline: 2px solid var(--accent); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: #fff; white-space: nowrap; font-size: 14px; }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; cursor: pointer; }
.list li:active { background: #f9fafb; }
.list .th { width: 112px; height: 84px; border-radius: 8px; object-fit: cover; background: #e5e7eb; flex: none; display: grid; place-items: center; color: var(--muted); font-size: 22px; }
.list .th.nophoto { font-size: 20px; line-height: 1; gap: 2px; grid-auto-rows: min-content; align-content: center; }
.list .th.nophoto small { font-size: 11px; }
.list .t { flex: 1; min-width: 0; }
.list .t b { display: block; font-size: 16px; }
.list .t span { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .t a.ext { color: var(--accent); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-no { background: var(--danger-soft); color: var(--danger); }
.b-done { background: var(--accent-soft); color: var(--accent); }

.gps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gps .big { grid-column: 1 / -1; }
#map, #minimap { height: 240px; border-radius: 10px; border: 1px solid var(--line); background: #e5e7eb; }
#map { height: calc(100vh - 150px); min-height: 400px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo .pn { padding: 6px 8px; font-size: 13px; }
.photo textarea { border: 0; border-top: 1px solid var(--line); border-radius: 0; min-height: 56px; font-size: 13px; padding: 6px 8px; }
.photo .acts { display: flex; gap: 4px; padding: 4px 6px; border-top: 1px solid var(--line); }
.photo .acts button { flex: 1; min-height: 32px; padding: 4px; font-size: 12px; border-radius: 6px; }
/* fotky sa nikdy neorezávajú – zvislá fotka sa zobrazí celá, len s obmedzenou výškou */
.mainphoto { position: relative; border-radius: 12px; overflow: hidden; background: #e5e7eb; min-height: 160px; display: grid; place-items: center; color: var(--muted); }
.mainphoto img { width: 100%; height: auto; max-height: 70vh; object-fit: contain; display: block; }
.capture { position: relative; overflow: hidden; }
.capture input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.progress { font-size: 13px; color: var(--muted); }

.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 92vw; }
.alertbox { background: var(--danger-soft); border: 1px solid #fca5a5; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.okbox { background: var(--ok-soft); border: 1px solid #86efac; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.empty { padding: 30px; text-align: center; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 calc(8px + env(safe-area-inset-bottom)); }
@media (max-width: 480px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .top { padding: 6px 10px; padding-top: calc(6px + env(safe-area-inset-top)); }
  .brand { font-size: 15px; }
  .brand .t { display: none; }
  nav { display: flex; align-items: center; gap: 2px; }
  nav a { padding: 6px 7px; font-size: 14px; }
  .supportbar { top: 46px; font-size: 13px; padding: 6px 10px; }
  .supportbar .muted { display: none; }
  #logout button { min-height: 30px; padding: 4px 8px; font-size: 12px; }
}

.pair .pairimg { width: 100%; height: auto; max-height: 60vh; object-fit: contain; border-radius: 10px; display: block; background: #e5e7eb; }
.pair textarea { min-height: 70px; }

.leaflet-control-layers { font-size: 13px; }
.leaflet-control-layers label { margin: 2px 4px; }
#pickmapel { height: 380px !important; }
