/* Aplikacja (index.html), panel administratora i strona wyników dla klienta. Czcionki, barwy marki, przyciski
   i pola są w brand.css (wspólne ze stroną startową i logowaniem). */
:root { --panel-w: 412px; }
html, body { height: 100%; }
body { display: flex; flex-direction: column; background: var(--paper); }
h1 { font-size: 1.55rem; line-height: 1.12; }
h2 { font-size: 1.15rem; line-height: 1.2; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 0.95rem; font-weight: 700; margin: 18px 0 8px; color: var(--ink); }
.hint.small { font-size: 0.8rem; margin-top: 2px; }

/* ------------------------------------------------------------------ górny pasek */
.topbar {
  display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; min-height: 60px;
  background: var(--ink); color: var(--paper); padding: 10px 18px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(245, 243, 239, 0.08);
}
.brand { display: flex; flex: none; }
.brand img { display: block; height: 34px; width: auto; }
.project-switch { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.project-switch select {
  background: var(--ink-2); color: var(--paper); border: 1px solid var(--ink-3); border-radius: 9px;
  padding: 8px 12px; min-height: 40px; max-width: 340px; font: inherit; font-size: 0.98rem;
}
.project-switch select:focus { border-color: var(--muted-on-ink); }
.topbar .btn-ghost { color: var(--paper); border-color: rgba(245, 243, 239, 0.35); }
.topbar .btn-ghost:hover { border-color: var(--paper); background: rgba(245, 243, 239, 0.08); }
.topbar-title { font-family: var(--font-title); font-weight: 800; font-size: 1.02rem; color: var(--paper); margin-right: auto; }

/* ------------------------------------------------------------------ panel z krokami i mapa */
.layout { flex: 1; display: flex; min-height: 0; }
.panel {
  width: var(--panel-w); flex: none; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px;
  border-right: 1px solid var(--line); position: relative; background: var(--paper);
}
.map-wrap { flex: 1; position: relative; min-width: 0; background: #e6e2da; }
#map { position: absolute; inset: 0; }
.map-empty {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(14, 18, 22, 0.86);
  color: var(--paper); font-size: 0.92rem; padding: 8px 16px; border-radius: 999px; pointer-events: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); white-space: nowrap;
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.card > h2:first-child { margin-bottom: 4px; }
.step .num {
  display: inline-flex; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; flex: none;
  align-items: center; justify-content: center; font-size: 0.9rem; font-family: var(--font-title);
}
.step.done .num { background: var(--ok); }
.step h2 .opt { font-family: var(--font-text); font-weight: 400; font-size: 0.95rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* pierwsze wejście: mapa z izoliniami jak na stronie startowej */
.welcome { padding: 0; overflow: hidden; }
.welcome-art { position: relative; height: 132px; background: var(--ink); }
.welcome-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.welcome-body { padding: 18px; }
.welcome h1 { font-size: 1.5rem; }
.welcome .row { margin-top: 14px; }
.welcome .hint { margin-top: 12px; }

/* ------------------------------------------------------------------ pola i przełączniki w panelu */
.file { display: block; margin: 12px 0; position: relative; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file span {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 10px;
  border: 1.5px dashed var(--line-strong); border-radius: 12px; background: #faf9f6; font-weight: 650; cursor: pointer;
}
.file span::before { content: "↑"; font-size: 1.1rem; color: var(--red); }
.file:hover span { border-color: var(--ink); background: #fff; }
.file:focus-within span { outline: 3px solid var(--focus); outline-offset: 2px; }
.field select { min-height: 40px; }
.field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.field.inline select { max-width: 60%; }
.format-note { margin: 4px 0 10px; }
.format-note ul { margin: 6px 0 0; padding-left: 18px; }
.file span.busy { color: var(--muted); cursor: progress; }
.obs { background: #f7f5f1; border-radius: 10px; padding: 12px; margin: 10px 0; }
.obs-title { font-weight: 700; font-size: 0.92rem; margin: 0 0 8px; }
.obs .hint { margin: 8px 0 0; font-size: 0.85rem; }
.obs .note { margin: 8px 0 0; }
.new-project label { font-size: 0.9rem; font-weight: 650; }
.new-project .row input { flex: 1; min-width: 160px; }
.mapping select { width: 100%; font-size: 0.95rem; }

.mapping { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.mapping label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 650; }
.table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; font-size: 0.8rem; width: 100%; }
th, td { padding: 5px 8px; border-bottom: 1px solid #eee9e2; white-space: nowrap; text-align: left; }
th { background: #f7f5f1; position: sticky; top: 0; font-weight: 650; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0 4px; }
.stat { background: #f7f5f1; border-radius: 10px; padding: 9px 11px; }
.stat b { display: block; font-size: 1.08rem; font-weight: 700; }
.stat span { font-size: 0.8rem; color: var(--muted); }
.warnings { margin: 8px 0 0; padding-left: 18px; color: var(--warn); font-size: 0.9rem; }
.badge { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.badge.ok { background: #dff3e8; color: var(--ok); }
.badge.bad { background: #fde7e9; color: var(--red-dark); }
.kv { font-size: 0.92rem; margin: 6px 0; line-height: 1.5; }
.kv dt { color: var(--muted); float: left; clear: left; width: 46%; }
.kv dd { margin: 0 0 0 46%; font-weight: 650; }

.layers { border: 0; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.layers label {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; min-height: 44px; transition: border-color 0.15s, background-color 0.15s;
}
.layers label:hover { border-color: var(--line-strong); }
.layers label:has(input:checked) { border-color: var(--ink); background: #f7f5f1; font-weight: 650; }
.layers input { accent-color: var(--red); }
.layers small { color: var(--muted); margin-left: auto; font-weight: 400; }
.legend { margin: 12px 0; }
.legend .bar { height: 14px; border-radius: 4px; }
.legend .ticks { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
input[type="range"] { accent-color: var(--ink); }
.toggles { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.92rem; align-items: center; }
.toggles label { display: flex; gap: 6px; align-items: center; min-height: 32px; }
.toggles input { accent-color: var(--ink); }
.targets { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.targets button {
  width: 100%; text-align: left; font: inherit; font-size: 0.92rem; background: #f7f5f1; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 10px; cursor: pointer; display: flex; gap: 10px; align-items: center;
  min-height: 44px; color: var(--ink);
}
.targets button:hover { border-color: var(--ink); }
.pin, .target-marker {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 0.75rem; font-weight: 700; flex: none; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.target-marker { cursor: pointer; }
.targets .coords { display: block; font-size: 0.8rem; color: var(--muted); }

/* stan celu sprawdzonego w terenie: kolor i znak (nie sam kolor) */
.pin.st-found, .target-marker.st-found { background: var(--ok); }
.pin.st-nothing, .target-marker.st-nothing { background: #5f6670; }
.pin.st-skipped, .target-marker.st-skipped { background: var(--warn); }
.target-marker.st-found::after, .target-marker.st-nothing::after, .target-marker.st-skipped::after {
  position: absolute; top: -7px; right: -7px; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  color: var(--ink); font-size: 10px; line-height: 14px; text-align: center; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}
.target-marker.st-found::after { content: "✓"; }
.target-marker.st-nothing::after { content: "✕"; }
.target-marker.st-skipped::after { content: "–"; }
.me-marker {
  width: 18px; height: 18px; border-radius: 50%; background: #2a78d6; border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(42, 120, 214, 0.35), 0 1px 4px rgba(0, 0, 0, 0.4); pointer-events: none;
}

/* tryb terenowy: lista celów od najbliższego, stan i notatka */
body.field-mode #steps, body.field-mode #welcome { display: none !important; }
.field-panel { display: flex; flex-direction: column; gap: 10px; }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-head h2 { display: block; font-size: 1.08rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-gps { margin: 0; font-size: 0.92rem; color: var(--muted); }
.field-gps.bad { color: var(--warn); font-weight: 650; }
.field-sync, .offline-bar {
  background: #fff6dd; border: 1px solid #f0dca6; border-radius: 10px; padding: 8px 12px; font-size: 0.9rem; margin: 0;
}
.field-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.field-item { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.field-item.open { border-color: var(--ink); }
.field-row {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: none; border: 0;
  font: inherit; text-align: left; cursor: pointer; min-height: 56px; color: inherit;
}
.field-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.98rem; }
.field-main small { flex-basis: 100%; color: var(--muted); font-size: 0.84rem; }
.field-nav { display: flex; flex-direction: column; align-items: center; min-width: 64px; font-size: 0.98rem; }
.field-nav .arrow { font-size: 22px; line-height: 1; display: inline-block; transition: transform 0.3s; }
.chip { font-size: 0.78rem; font-weight: 650; border-radius: 999px; padding: 2px 9px; background: #fde3e8; color: var(--red-dark); }
.chip.st-found { background: #dcefe4; color: var(--ok); }
.chip.st-nothing { background: #eceae6; color: #4b5058; }
.chip.st-skipped { background: #fff0c2; color: var(--warn); }
.field-card { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.field-card > .btn { align-self: flex-start; }
.status-pick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.status-pick legend { font-size: 0.84rem; color: var(--muted); margin-bottom: 4px; padding: 0; }
.status-pick label {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 0.92rem; cursor: pointer;
}
.status-pick label:has(input:checked) { border-color: var(--ink); background: #f7f5f1; font-weight: 650; }
.note-label { font-size: 0.84rem; color: var(--muted); margin-bottom: -6px; }
.field-card textarea { font-size: 0.98rem; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; }
.downloads a {
  font-size: 0.9rem; color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; background: #fff; min-height: 40px; display: inline-flex; align-items: center;
}
.downloads a:hover { border-color: var(--ink); }

/* zadanie w toku (np. po odświeżeniu strony w trakcie obróbki) */
.job-bar {
  display: flex; align-items: center; gap: 10px; background: #fff6dd; border: 1px solid #f0dca6; border-radius: 12px;
  padding: 10px 12px; font-size: 0.92rem; font-weight: 650;
}

/* loty w projekcie */
.flights { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.flight {
  display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 12px; background: #fff;
}
.flight.active { border-color: var(--ink); background: #f7f5f1; }
.flight.pending .flight-meta { color: var(--warn); font-weight: 650; }
.flight-dot, .flight-marker {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--c); color: #fff; font-size: 0.75rem; font-weight: 700; flex: none;
}
.flight-dot { margin-top: 1px; }
.flight-marker { border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); pointer-events: none; }
.flight-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.92rem; }
.flight-body b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flight-meta { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.flight-warn { font-size: 0.8rem; color: var(--warn); }
.flight-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0; flex: none; }
.flight-actions .link { padding: 2px 0; font-size: 0.84rem; min-height: 24px; }
.link.danger { color: var(--red-dark); }
#qcBox h3 { margin-top: 16px; }
.fname { font-family: var(--font-text); font-weight: 650; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 12px 16px; border-radius: 12px; max-width: min(560px, 92vw); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  font-size: 0.92rem; z-index: 10;
}
.toast.error { background: var(--red-dark); }
.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ zgłoś uwagę */
.feedback-btn { flex: none; padding: 8px 14px; min-height: 40px; font-size: 0.94rem; font-weight: 600; }
.feedback-btn .ico { width: 18px; height: 18px; flex: none; }
.dialog .check { margin: 4px 0 0; }

/* ------------------------------------------------------------------ konto w nagłówku */
.account { position: relative; flex: none; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--red); color: #fff; border: 0; font: inherit;
  font-weight: 700; font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.avatar:hover { background: var(--red-dark); }
.avatar-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--focus); color: var(--ink); font-size: 11px; font-weight: 800; display: flex; align-items: center;
  justify-content: center; pointer-events: none; border: 2px solid var(--ink);
}
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; color: var(--ink); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28); width: max-content; min-width: 240px; max-width: min(320px, 92vw);
  padding: 6px; z-index: 30; display: flex; flex-direction: column;
}
.menu-head {
  padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex;
  flex-direction: column; gap: 2px; font-size: 0.98rem;
}
.menu-head span { color: var(--muted); font-size: 0.84rem; overflow-wrap: anywhere; }
.menu a, .menu button {
  display: flex; align-items: center; text-align: left; font: inherit; font-size: 0.98rem; padding: 10px; border-radius: 9px;
  color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; min-height: 44px;
}
.menu a:hover, .menu button:hover { background: var(--paper); }
.menu-foot { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.menu .menu-foot a, .menu .menu-foot button { min-height: 38px; padding: 7px 10px; font-size: 0.9rem; color: var(--muted); }
.menu .menu-foot .danger { color: var(--red-dark); }

/* ------------------------------------------------------------------ okna dialogowe */
.dialog {
  border: 0; border-radius: 16px; padding: 22px; width: min(440px, calc(100vw - 32px));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); color: var(--ink);
}
.dialog::backdrop { background: rgba(14, 18, 22, 0.55); }
.dialog h2 { margin-bottom: 6px; font-size: 1.3rem; }
.dialog a { color: var(--ink); text-underline-offset: 3px; }
.dialog-actions { margin-top: 14px; }
.link-row { display: flex; gap: 8px; margin-top: 8px; }
.link-row input { flex: 1; min-width: 0; font-size: 0.84rem; }

/* ------------------------------------------------------------------ panel administratora */
body.page-scroll { height: auto; min-height: 100%; }
.admin { width: min(1040px, 100%); margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.admin-head { padding: 8px 2px 2px; }
.admin-head h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.admin-head p { color: var(--muted); margin: 6px 0 0; }
.admin h2 { margin-bottom: 10px; }
.admin-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.admin-form .field { margin: 0; }
.count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 8px;
  border-radius: 999px; background: var(--red); color: #fff; font-size: 0.8rem; font-family: var(--font-text);
  font-weight: 700;
}
.count.muted { background: var(--paper); color: var(--ink); }
.items { display: flex; flex-direction: column; }
.item { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; padding-top: 2px; }
.item p { margin: 3px 0; overflow-wrap: anywhere; }
.item .msg { white-space: pre-line; background: #f7f5f1; border-radius: 9px; padding: 8px 10px; font-size: 0.92rem; }
.item-main { min-width: 0; }
.item .tech { margin: 4px 0; font-size: 0.86rem; }
.item .tech summary { cursor: pointer; color: var(--muted); width: max-content; }
.item .tech .hint { margin: 4px 0 0; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.badge.new { background: #fff0c2; color: var(--warn); }
.step h2 { flex-wrap: wrap; row-gap: 4px; }
.step h2 .badge { font-family: var(--font-text); letter-spacing: 0; white-space: nowrap; }
.plan-beta { background: #fff7dc; border-left: 3px solid var(--warn); border-radius: 0 9px 9px 0; padding: 8px 11px;
  font-size: 0.88rem; line-height: 1.45; margin: 10px 0; }
.badge:not(.ok):not(.bad):not(.new) { background: var(--paper); color: var(--ink); }
table.users { font-size: 0.92rem; }
table.users th, table.users td { padding: 10px; vertical-align: middle; }
table.users th { font-size: 0.84rem; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ------------------------------------------------------------------ plan nalotu */
.plan-editor { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.plan-hint { margin: 0; font-size: 0.92rem; background: #f7f5f1; border-radius: 9px; padding: 8px 10px; }
.plan-hint:empty { display: none; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.plan-grid .field { margin: 6px 0; }
.plan-grid .plan-wide { grid-column: 1 / -1; }
.plan-grid input, .plan-grid select { width: 100%; }
.file-btn { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.plan-flights { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.plan-flights li { display: flex; align-items: flex-start; gap: 8px; font-size: 0.92rem; line-height: 1.45; }
.plan-flights li > span:nth-child(2) { flex: 1; min-width: 0; padding-top: 2px; }
.plan-flights a { font-size: 0.84rem; color: var(--ink); padding-top: 3px; }
.plan-vertex {
  width: 14px; height: 14px; border-radius: 3px; background: #fff; border: 2px solid var(--red); cursor: grab;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.plan-vertex.first { width: 18px; height: 18px; border-width: 3px; }
.plan-home {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #fff; font-size: 0.8rem; font-weight: 800; border: 2px solid #fff; cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}
.plan-home.static { cursor: default; pointer-events: none; width: 24px; height: 24px; font-size: 0.75rem; }
.plan-search { display: flex; gap: 6px; }
.plan-search input { flex: 1; min-width: 0; }
body.plan-drawing .maplibregl-canvas-container.maplibregl-interactive { cursor: crosshair; }

/* poprawki i filtry (krok 3) */
.advanced { border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; margin: 10px 0 12px; background: #fbfaf8; }
.advanced summary { cursor: pointer; font-weight: 650; font-size: 0.92rem; padding: 11px 0; list-style-position: inside; }
.advanced[open] { padding-bottom: 10px; }
.advanced .check { margin: 8px 0; }
.advanced input[type="number"] { max-width: 160px; }

/* firma i logo */
.brand-logo {
  display: flex; align-items: center; justify-content: center; min-height: 72px; padding: 10px; border-radius: 12px;
  background: repeating-conic-gradient(#f3efe9 0% 25%, #fff 0% 50%) 50% / 16px 16px; border: 1px solid var(--line);
}
.brand-logo img { max-width: 100%; max-height: 90px; object-fit: contain; }
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 10px; }
.field-pair .field { margin-bottom: 4px; min-width: 0; }
.field-pair select, .field-pair input { width: 100%; min-width: 0; }

/* link dla klienta i widok 3D */
.share .row { flex-wrap: wrap; }
.share input[readonly] { width: 100%; font-size: 0.84rem; color: var(--ink); background: #f7f5f1; }
.share .hint { margin: 6px 0; }
.toggles .btn { margin-left: auto; }
[aria-pressed="true"].btn { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ------------------------------------------------------------------ strona wyników dla klienta (wyniki.html) */
.viewer-brand { display: flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; }
.viewer-credit { font-size: 0.8rem; line-height: 1.45; color: var(--muted); margin: 6px 0 0; }
.viewer-credit a { color: var(--ink); text-underline-offset: 2px; }
.viewer-brand .topbar-title { margin-right: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-logo { background: #fff; border-radius: 8px; padding: 4px 8px; display: inline-flex; flex: none; }
.viewer-logo img { display: block; height: 30px; max-width: 160px; object-fit: contain; }
.viewer-expires { font-size: 0.84rem; color: var(--muted-on-ink); }
.viewer-kicker { margin: 0 0 6px; font-size: 0.9rem; font-weight: 650; color: var(--red-dark); }
.viewer-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 14px;
  color: var(--muted); font-size: 0.84rem; text-decoration: none; }
.viewer-foot img { height: 18px; width: auto; }
.viewer-foot:hover { color: var(--ink); }
.viewer-legal { display: flex; justify-content: center; gap: 16px; margin: -6px 0 14px; font-size: 0.8rem; }
.viewer-legal a { color: var(--muted); text-underline-offset: 2px; }
.viewer .targets li { display: flex; gap: 6px; align-items: stretch; }
.viewer .targets li button { flex: 1; min-width: 0; }
.viewer .targets .nav {
  display: inline-flex; align-items: center; padding: 0 11px; font-size: 0.84rem; color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; flex: none;
}
.viewer .targets .nav:hover { border-color: var(--ink); }
.viewer .downloads a.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 650; }
.viewer .downloads a.primary:hover { background: var(--red-dark); }

/* logi lotu drona (pozycje RTK) pod listą lotów */
.logs h3 { margin-top: 12px; }
.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.log-list li {
  display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 8px 10px;
  border: 1px dashed var(--line-strong); border-radius: 10px; background: #fbfaf8; font-size: 0.92rem;
}
.log-list .flight-body { min-width: 0; }
.log-list b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ wąskie ekrany */
@media (max-width: 820px) {
  .layout { flex-direction: column-reverse; justify-content: flex-end; }
  body.field-mode .map-wrap { height: 44vh; }
  .panel { width: auto; border-right: 0; overflow: visible; }
  .map-wrap { flex: none; height: 52vh; }
  body { height: auto; min-height: 100%; }
  .topbar { flex-wrap: nowrap; padding-left: 12px; padding-right: 12px; gap: 10px; min-height: 56px; }
  .brand img { height: 28px; }
  .project-switch { flex: 1; min-width: 0; justify-content: flex-end; flex-wrap: nowrap; }
  .project-switch select { flex: 1; min-width: 0; max-width: none; }
  .hide-sm { display: none; }
  .feedback-btn { width: 40px; padding: 0; }
  .feedback-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .map-empty { white-space: normal; text-align: center; width: max-content; max-width: 86%; }
  .avatar { width: 38px; height: 38px; }
  .admin { padding: 14px 12px 32px; }
  .admin-form { grid-template-columns: 1fr; }
  .item { flex-direction: column; gap: 8px; }
  .item-actions { justify-content: flex-start; }
  .topbar-title { font-size: 0.92rem; }
  /* tabela użytkowników jako karty – na wąskim ekranie przyciski nie chowają się za krawędzią */
  table.users thead { display: none; }
  table.users, table.users tbody, table.users tr, table.users td { display: block; width: 100%; }
  table.users tr { border-top: 1px solid var(--line); padding: 10px 0; }
  table.users tr:first-child { border-top: 0; }
  table.users td { border: 0; padding: 3px 12px; white-space: normal; }
  table.users td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .cell-actions { justify-content: flex-start; flex-wrap: wrap; padding-top: 6px; }
  .viewer-logo img { height: 24px; max-width: 110px; }
  .viewer-expires { display: none; }
}
