/* Lašišos dienoraštis – Žvejo žemėlapio išdėstymas, visada tamsus: naktį ekranas mažai šviečia ir neišduoda saugotojo */
:root {
  --bg: #0b1419;
  --surface: #13212a;
  --surface-2: #1b2c36;
  --line: #284350;
  --text: #e8f1f3;
  --muted: #93a6ae;
  --accent: #2dd4bf;       /* pagrindinė (kaip Žvejo žemėlapio tamsioje temoje) */
  --accent-ink: #042f2b;
  --accent-2: #2dd4bf;
  --salmon: #ff7a59;       /* lašišos spalva – akcentams */
  --danger: #ef4444;
  --glass: rgba(19, 33, 42, 0.92);
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
h1 { font-size: 22px; margin: 6px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 19px; margin: 0 0 4px; letter-spacing: -0.01em; }
h3 { font-size: 12px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; }
.glass { background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow); }

/* ---------- mygtukai ir laukai */
.btn { border: 0; border-radius: 14px; padding: 12px 16px; background: var(--surface-2); cursor: pointer;
  font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  transition: transform 0.08s, filter 0.15s; text-decoration: none; color: var(--text); }
.btn:active { transform: scale(0.97); }
.btn.primary, .btn.teal { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.big { width: 100%; min-height: 54px; font-size: 16px; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 11px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
input, select, textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; outline: none; margin: 0 0 10px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[readonly] { opacity: 0.7; }
textarea { min-height: 84px; resize: vertical; }
label.lbl { display: block; font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.form-err { color: #fca5a5; min-height: 20px; font-size: 14px; margin-top: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: flex; background: var(--surface-2); border-radius: 14px; padding: 4px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 11px; font-weight: 600; color: var(--muted); cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--bg); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- prisijungimas */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; overflow-y: auto;
  background: radial-gradient(1200px 600px at 50% -10%, #12403e 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 380px; text-align: center; }
.auth-card form { margin-top: 18px; text-align: left; }
.auth-logo { width: 84px; height: 84px; }
.big-emoji { font-size: 60px; }
.auth-card:not(.register) .reg-only { display: none; }
.auth-card.register .login-only { display: none; }

/* ---------- žemėlapis */
#app, #map { position: fixed; inset: 0; }
#map { background: #0e171b; }
.leaflet-container { font: inherit; background: #0e171b; }
.leaflet-control-attribution { background: rgba(0, 0, 0, 0.45) !important; color: #8a9 !important; font-size: 10px; }
.leaflet-control-attribution a { color: #9ab !important; }
.leaflet-control-zoom { display: none; }
/* Naktinis režimas: pritemdytas žemėlapis; „raudona“ – visas ekranas raudonas (nesugadina akių prisitaikymo tamsai) */
body.night-dim .leaflet-tile-pane { filter: brightness(0.5) saturate(0.6); }
body.night-red #app { filter: grayscale(1) sepia(1) hue-rotate(-45deg) saturate(5) brightness(0.55); }

/* ---------- viršus (kaip Žvejo žemėlapyje) */
.topbar { position: absolute; z-index: 500; top: calc(var(--safe-t) + 10px); left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border-radius: 999px; border: 0; cursor: pointer; text-align: left; max-width: calc(100% - 72px); }
.brand img { width: 36px; height: 36px; border-radius: 10px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 14px; white-space: nowrap; }
.brand-text span { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #9ca3af; display: inline-block; flex: none; }
.dot.on { background: #22c55e; }
.dot.off { background: #f59e0b; }
.side { display: flex; flex-direction: column; gap: 8px; }
.tool { position: relative; width: 56px; height: 56px; border-radius: 16px; color: var(--text); border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; }
.tool span { font-size: 9.5px; font-weight: 600; color: var(--muted); }
.tool:active { transform: scale(0.95); }
.tool.on { background: #14532d; box-shadow: 0 0 0 2px #22c55e, var(--shadow); }
.tool.on span { color: #bbf7d0; }
.tool-dot { position: absolute; top: 6px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.filter-pill { position: absolute; z-index: 499; top: calc(var(--safe-t) + 66px); left: 12px; display: flex; align-items: center;
  border-radius: 999px; max-width: calc(100% - 92px); overflow: hidden; }
.filter-pill button { border: 0; background: none; color: var(--text); cursor: pointer; font-size: 13px; font-weight: 600; padding: 8px 6px 8px 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-pill button + button { padding: 8px 14px 8px 8px; color: var(--muted); flex: none; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.div-seg button { font-size: 13px; }
.chip { flex: none; border: 1px solid var(--line); background: var(--glass); border-radius: 999px; padding: 7px 12px; color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; backdrop-filter: blur(10px); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.div { border-color: var(--salmon); }
.chip.div.on { background: var(--salmon); color: #1b0d08; }
.bottombar { position: absolute; z-index: 500; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); display: flex; gap: 10px; }
.bottombar .add { flex: 1; min-height: 58px; font-size: 17px; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); border-radius: 18px; }
.bottombar .sos { width: 86px; min-height: 58px; font-size: 18px; font-weight: 800; letter-spacing: 0.05em; background: #b91c1c;
  color: #fff; border-radius: 18px; box-shadow: var(--shadow); }
.badge.div { background: rgba(255, 122, 89, 0.15); color: var(--salmon); }
.officer { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.officer .t { flex: 1; min-width: 0; }
.officer .t b { display: block; }
.officer .t small { display: block; color: var(--muted); font-size: 12px; }
.officer .t small.ph { color: var(--text); font-size: 14px; letter-spacing: 0.02em; }
.btn.call { background: #15803d; color: #fff; flex: none; min-height: 50px; padding: 10px 16px; }
.btn.call.danger-call { background: #b91c1c; }
.btn.big.call { width: 100%; }
.officers-tool svg { color: #4ade80; }
select.mini { width: auto; margin: 0; padding: 6px 8px; font-size: 13px; border-radius: 10px; }
.user-row { flex-wrap: wrap; cursor: default; }
.user-row .t { min-width: 160px; }
.info { text-align: left; }

/* ---------- žymekliai */
.mk { width: 38px; height: 38px; border-radius: 50% 50% 50% 6px; transform: rotate(-45deg); display: grid; place-items: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); border: 2px solid rgba(255, 255, 255, 0.9); }
.mk span { transform: rotate(45deg); font-size: 17px; line-height: 1; }
.mk.resolved { filter: grayscale(1) brightness(0.8); opacity: 0.75; }
.mk.pulse { animation: pulse 1.4s infinite; }
.mk-cam { width: 40px; height: 40px; border-radius: 12px; background: #0f1d20; border: 2px solid var(--accent-2); display: grid;
  place-items: center; font-size: 19px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); position: relative; }
.mk-cam.off { border-color: #555; filter: grayscale(1); }
.mk-cam.hot { border-color: var(--salmon); animation: pulse 1.4s infinite; }
.mk-cam b { position: absolute; top: -7px; right: -7px; background: var(--salmon); color: #1b0d08; border-radius: 999px; font-size: 11px;
  min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; }
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: #3b82f6; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.25); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 122, 89, 0.7); } 70% { box-shadow: 0 0 0 16px rgba(255, 122, 89, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 122, 89, 0); } }

/* ---------- patruliavimas */
.mk-pat { width: 40px; height: 40px; border-radius: 50%; background: #16a34a; color: #fff; border: 3px solid #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.3), 0 3px 10px rgba(0, 0, 0, 0.5); position: relative; }
.mk-pat.me { background: #2563eb; box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.3), 0 3px 10px rgba(0, 0, 0, 0.5); }
.mk-pat.stale { background: #6b7280; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); }
.mk-pat i { position: absolute; bottom: -6px; right: -8px; font-style: normal; font-size: 14px; }
.patrol-bar { position: absolute; z-index: 500; left: 10px; right: 66px; bottom: calc(84px + var(--safe-b)); display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: 14px; padding: 0 14px; height: 46px; background: rgba(22, 101, 52, 0.95); color: #fff; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }
.patrol-bar b { margin-left: auto; background: rgba(0, 0, 0, 0.25); padding: 4px 10px; border-radius: 9px; font-size: 13px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #4ade80; animation: blink 1.2s infinite; flex: none; }
@keyframes blink { 50% { opacity: 0.25; } }
.on-duty { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.on-duty .av { width: 36px; height: 36px; border-radius: 50%; background: #16a34a; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.on-duty .av.stale { background: #6b7280; }
.info { background: rgba(45, 212, 191, 0.08); border: 1px solid rgba(45, 212, 191, 0.25); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: #b9e9e2; margin: 10px 0; }

/* ---------- kameros */
.list-item.pick { border: 2px solid transparent; border-radius: 14px; padding: 8px; margin-bottom: 4px; border-bottom: 2px solid transparent; background: var(--surface-2); }
.list-item.pick.on { border-color: var(--accent-2); }
.list-item .radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #4b6266; flex: none; }
.list-item.pick.on .radio { border: 7px solid var(--accent-2); }
.steps { padding-left: 20px; margin: 8px 0; }
.steps li { margin-bottom: 8px; }
.type-btn.cam-tile { grid-column: 1 / -1; border: 2px dashed #2f4a4e; background: transparent; }

/* ---------- apatinis langas */
.sheet-back { position: fixed; inset: 0; z-index: 900; background: rgba(0, 0, 0, 0.35); }
.sheet { position: fixed; z-index: 901; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: var(--surface);
  border-radius: 24px 24px 0 0; padding: 6px 16px calc(20px + var(--safe-b)); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  animation: up 0.22s ease-out; max-width: 640px; margin: 0 auto; }
@media (min-width: 900px) { .sheet { left: auto; right: 16px; bottom: 16px; top: 16px; max-height: none; width: 420px; border-radius: 24px; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.grip { width: 42px; height: 5px; border-radius: 9px; background: #33474b; margin: 6px auto 12px; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; }
.sheet-head > div { flex: 1; min-width: 0; }
.close-x { border: 0; background: var(--surface-2); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.descr { white-space: pre-wrap; margin: 12px 0 4px; }

/* tipų pasirinkimas */
.types { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.type-btn { border: 2px solid transparent; background: var(--surface-2); border-radius: 16px; padding: 12px; text-align: left; cursor: pointer;
  display: flex; gap: 10px; align-items: center; font-weight: 600; min-height: 58px; }
.type-btn .em { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; flex: none; }
.type-btn.on { border-color: var(--text); }

/* nuotraukos */
.strip { display: flex; gap: 8px; overflow-x: auto; margin: 12px -16px 0; padding: 0 16px; scroll-snap-type: x mandatory; }
.strip img { height: 190px; border-radius: 14px; scroll-snap-align: start; cursor: zoom-in; object-fit: cover; flex: none; max-width: 85%; background: #1a2a2e; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.thumbs .th { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; position: relative; }
.photo-add { width: 72px; height: 72px; border-radius: 12px; border: 2px dashed #3a5155; display: grid; place-items: center; font-size: 24px; cursor: pointer; background: transparent; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid .cell { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.grid .cell img { width: 100%; height: 100%; object-fit: cover; }
.grid .cell span { position: absolute; left: 4px; bottom: 4px; font-size: 11px; background: rgba(0, 0, 0, 0.65); padding: 1px 6px; border-radius: 6px; }
.day { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin: 10px 0 2px; font-weight: 600; }

/* dalinimasis */
.share { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.share a, .share button { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; border: 0; background: var(--surface-2);
  border-radius: 14px; padding: 10px 4px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text); }
.share i { font-style: normal; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; color: #fff; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.toggle input { width: auto; margin: 0; }

/* sąrašai */
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-item .em { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex: none; overflow: hidden; }
.list-item .em img { width: 100%; height: 100%; object-fit: cover; }
.list-item .t { flex: 1; min-width: 0; }
.list-item .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .t small { color: var(--muted); }
.menu-item { width: 100%; display: flex; gap: 12px; align-items: center; border: 0; background: transparent; padding: 14px 4px; border-bottom: 1px solid var(--line);
  cursor: pointer; text-align: left; font-weight: 600; }
.menu-item .em { font-size: 20px; width: 28px; text-align: center; }
.menu-item small { display: block; color: var(--muted); font-weight: 400; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment b { font-size: 13px; }
.comment small { color: var(--muted); margin-left: 6px; }
.code { font-family: ui-monospace, Consolas, monospace; background: var(--bg); border-radius: 10px; padding: 10px; word-break: break-all; font-size: 13px; user-select: all; }
.live { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 16/9; margin-top: 10px; }
.cam-hero { position: relative; margin-top: 12px; border-radius: 16px; overflow: hidden; background: var(--surface-2); aspect-ratio: 4/3; cursor: zoom-in; }
.cam-hero img { width: 100%; height: 100%; object-fit: cover; }
.cam-hero span { position: absolute; left: 10px; bottom: 10px; background: rgba(0, 0, 0, 0.65); padding: 3px 10px; border-radius: 8px; font-size: 13px; }
.progress { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress div { height: 100%; width: 0; background: var(--accent-2); transition: width 0.2s; }

/* ---------- taikiklis vietai pasirinkti */
.crosshair { position: absolute; inset: 0; z-index: 600; pointer-events: none; }
.cross { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border: 3px solid var(--accent); border-radius: 50%; }
.cross::after { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; background: var(--accent); border-radius: 50%; }
.pick-bar { position: absolute; left: 10px; right: 10px; bottom: calc(12px + var(--safe-b)); display: flex; gap: 10px; pointer-events: auto; }
.pick-bar .btn { flex: 1; min-height: 58px; background: var(--surface); }
.pick-bar .btn.primary { background: var(--accent); }

/* ---------- peržiūra visu ekranu */
.viewer { position: fixed; inset: 0; z-index: 2000; background: #000; display: grid; place-items: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px calc(14px + var(--safe-b)); background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); font-size: 14px; }
.viewer-close { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.15); font-size: 18px; cursor: pointer; }
.viewer-nav { position: absolute; top: 50%; margin-top: -30px; width: 48px; height: 60px; border: 0; background: rgba(255, 255, 255, 0.1); font-size: 32px; cursor: pointer; }
.viewer-nav.prev { left: 6px; border-radius: 12px; }
.viewer-nav.next { right: 6px; border-radius: 12px; }

/* ---------- pranešimai */
#toasts { position: fixed; z-index: 3000; top: calc(12px + var(--safe-t)); left: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; align-items: center; }
.toast { pointer-events: auto; background: #f4f7f6; color: #0b1416; border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow); font-weight: 600; max-width: 460px; width: 100%;
  animation: up 0.2s; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.toast img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; }
.toast.err { background: #fee2e2; color: #7f1d1d; }
.toast.alert { background: var(--danger); color: #fff; }
