:root {
  color-scheme: dark;
  --bg: #050b12;
  --panel: #0b1622;
  --panel-2: #101f2e;
  --line: rgba(143, 210, 255, 0.18);
  --text: #eff8ff;
  --muted: #9bb0c2;
  --cyan: #70dbff;
  --orange: #ff7a3d;
  --red: #ff4d5d;
  --green: #52e3a4;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(112, 219, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(112, 219, 255, 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--text);
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.report-header {
  position: sticky;
  top: 0;
  z-index: 900;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 1rem;
  min-height: 4.6rem;
  padding: .65rem clamp(.8rem, 2vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 11, 18, .92);
  backdrop-filter: blur(18px);
}

.report-brand {
  display: flex;
  align-items: center;
  gap: .72rem;
  color: inherit;
  text-decoration: none;
}

.report-brand img { width: 2.8rem; height: 2.8rem; object-fit: contain; }
.report-brand span, .header-status > span:last-child { display: grid; }
.report-brand strong { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .08em; }
.report-brand small, .header-status small { color: var(--muted); }

.header-status {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .78rem;
}

.status-dot {
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
  background: #f0b94b;
  box-shadow: 0 0 12px currentColor;
}

.header-status.is-online .status-dot { background: var(--green); }
.header-status.is-offline .status-dot { background: var(--red); }

.primary-report-button, .mobile-report-button, .send-report-button, .support-button, .ko-fi-button {
  border: 0;
  border-radius: .8rem;
  background: linear-gradient(135deg, #ff5b45, #d52c42);
  box-shadow: 0 .5rem 1.8rem rgba(225, 48, 64, .24);
  font-weight: 700;
  cursor: pointer;
}

.primary-report-button {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.9rem;
  padding: .6rem 1rem;
}

.header-buttons { display: flex; align-items: center; gap: .55rem; }
.support-button {
  display: flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.9rem;
  padding: .6rem .85rem;
  border: 1px solid rgba(112, 219, 255, .45);
  background: rgba(112, 219, 255, .08);
  color: var(--text);
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 27rem);
  gap: .8rem;
  height: calc(100vh - 4.6rem);
  padding: .8rem;
}

.map-panel, .incident-panel {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: rgba(9, 20, 31, .96);
}

.map-panel { position: relative; display: grid; grid-template-rows: auto auto auto minmax(22rem, 1fr); }
.map-toolbar, .incident-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
}

.eyebrow {
  margin: 0 0 .2rem;
  color: var(--cyan);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1, h2 { margin-bottom: 0; line-height: 1.1; }
h1 { font-size: clamp(1.35rem, 2.2vw, 2rem); }
h2 { font-size: 1.15rem; }

.map-summary { display: flex; gap: .55rem; }
.map-summary span {
  display: grid;
  min-width: 7rem;
  padding: .45rem .7rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  color: var(--muted);
  font-size: .7rem;
  text-align: center;
}
.map-summary strong { color: var(--text); font-size: 1.15rem; }
.map-summary .incident-connection { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: .45rem; text-align: left; }
.incident-connection strong { font-size: .73rem; }
.incident-connection small { grid-column: 2; color: var(--muted); font-size: .65rem; }
.incident-status-dot { width: .55rem; height: .55rem; grid-row: span 2; border-radius: 50%; background: #f0b94b; box-shadow: 0 0 10px currentColor; }
.incident-connection.is-online .incident-status-dot { background: var(--green); }
.incident-connection.is-offline .incident-status-dot { background: var(--red); }

.map-notice,
.demo-warning {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 1rem .7rem;
  padding: .55rem .75rem;
  border-left: 3px solid var(--cyan);
  background: rgba(112, 219, 255, .07);
  color: #c8d9e5;
  font-size: .76rem;
}
#locationSelectionNotice[hidden] { display: none; }
#locationSelectionNotice { position: absolute; z-index: 700; left: 1rem; bottom: 4rem; border: 1px solid var(--cyan); border-radius: .5rem; background: #102638; }

.demo-warning {
  border-left-color: var(--red);
  background: rgba(255, 77, 93, .1);
  color: #ffd6da;
}

.demo-warning strong {
  color: #fff;
}

#incidentMap { min-height: 0; background: #09141f; }
.leaflet-container { font-family: inherit; }
.leaflet-control-attribution { font-size: 9px; }

.incident-marker {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 12%;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--marker) 22%, transparent), 0 .3rem 1rem rgba(0,0,0,.5);
  background: var(--marker);
  color: #fff;
  transform: rotate(-45deg);
}
.incident-marker span { font-size: 1.25rem; transform: rotate(45deg); }
.incident-marker.is-ongoing { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 11px transparent, 0 .3rem 1rem rgba(0,0,0,.5); } }

.map-legend {
  position: absolute;
  z-index: 500;
  left: .8rem;
  bottom: .8rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  max-width: calc(100% - 1.6rem);
  pointer-events: none;
}
.map-legend span {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .5rem;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  background: rgba(5, 11, 18, .88);
  font-size: .65rem;
  backdrop-filter: blur(8px);
}
.map-legend i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--legend); }
.aircraft-symbol { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; flex-shrink: 0; }
.aircraft-symbol svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hazard-button > .aircraft-symbol { width: 2.8rem; height: 2.8rem; padding: .4rem; color: var(--hazard); }
.map-legend .aircraft-symbol { width: .9rem; height: .9rem; }
.map-legend .route-legend i { width: 1rem; height: 0; border: 0; border-top: 2px dashed var(--red); border-radius: 0; background: transparent; }
.map-support-link {
  position: absolute;
  z-index: 500;
  right: .8rem;
  bottom: .8rem;
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .36rem .58rem .36rem .4rem;
  border: 1px solid rgba(112, 219, 255, .35);
  border-radius: 999px;
  background: rgba(5, 11, 18, .88);
  color: var(--text);
  font-size: .7rem;
  font-weight: 700;
  text-decoration: none;
  backdrop-filter: blur(8px);
}
.map-support-link img { width: 1.5rem; height: 1.5rem; object-fit: contain; }

.incident-panel { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.icon-button, .dialog-close, .back-button {
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: rgba(255,255,255,.04);
  cursor: pointer;
}
.icon-button { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; }
.incident-panel-actions { display: flex; align-items: center; gap: .45rem; }
.form-launch-button { display: flex; align-items: center; gap: .4rem; min-height: 2.4rem; padding: .4rem .65rem; border: 1px solid rgba(255,77,93,.5); border-radius: .65rem; background: rgba(255,77,93,.12); color: #ffd6da; font-size: .7rem; font-weight: 700; cursor: pointer; }
.form-launch-button:hover, .form-launch-button:focus-visible { border-color: var(--red); outline: 2px solid rgba(255,77,93,.28); outline-offset: 2px; }

.filter-row { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1rem .8rem; }
.filter-row-time { padding-top: 0; }
.filter-status { flex-basis: 100%; margin: .1rem 0 0; color: var(--muted); font-size: .67rem; line-height: 1.5; }
.marker-demo-label { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); padding: 1px 3px; border-radius: 3px; background: #171327; color: #eee6ff; font: 700 8px sans-serif; letter-spacing: .03em; }
.route-schematic-label { width: 170px; white-space: normal; border: 1px solid #b099ff; background: rgba(10,15,28,.92); color: #fff; font-size: 10px; text-align: center; }
.route-schematic-label.is-demo { width: 110px; }
.filter-row button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .4rem .7rem;
  background: transparent;
  color: var(--muted);
  font-size: .72rem;
  cursor: pointer;
}
.filter-row button.is-active { border-color: var(--cyan); background: rgba(112,219,255,.1); color: var(--text); }

.incident-list { min-height: 0; overflow: auto; padding: 0 .7rem .7rem; }
.incident-card {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: start;
  margin-bottom: .48rem;
  padding: .72rem;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: .8rem;
  background: rgba(255,255,255,.025);
  cursor: pointer;
}
.incident-card:hover { border-color: rgba(112,219,255,.35); }
.incident-card-icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: .65rem;
  background: var(--card-color);
}
.incident-card-copy { min-width: 0; }
.incident-card-copy strong { display: block; font-size: .86rem; }
.incident-card-copy p { margin: .18rem 0 0; overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.incident-card time { color: var(--muted); font-size: .67rem; white-space: nowrap; }
.incident-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .38rem; }
.incident-badges span { padding: .16rem .38rem; border-radius: .3rem; background: rgba(255,255,255,.06); color: #c8d8e5; font-size: .62rem; }
.incident-badges .danger { background: rgba(255,77,93,.16); color: #ff8c97; }
.incident-badges .demo-badge { background: rgba(255,193,7,.13); color: #ffe08a; }
.incident-badges .route-badge { background: rgba(255,64,85,.14); color: #ff9aa5; }
.incident-popup-note { display: inline-block; margin-top: .35rem; color: #a8bbc9; line-height: 1.5; }
.incident-popup-sources { display: flex; flex-wrap: wrap; gap: .25rem .4rem; margin-top: .45rem; }
.incident-popup-sources a { color: #0088cc; }
.incident-card-copy p { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.route-legend { color: #d6e8f1; }

.mobile-report-button { display: none; margin: .65rem; min-height: 3.25rem; }
.empty-state { padding: 2rem 1rem; color: var(--muted); text-align: center; }

.report-dialog {
  width: min(55rem, calc(100% - 1.2rem));
  max-height: min(54rem, calc(100vh - 1.2rem));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(112,219,255,.28);
  border-radius: 1.2rem;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 2rem 8rem rgba(0,0,0,.65);
}
.report-dialog::backdrop { background: rgba(0, 5, 10, .78); backdrop-filter: blur(7px); }
.report-dialog-shell { max-height: inherit; overflow: auto; }
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(11,22,34,.96);
}
.dialog-head p:last-child { max-width: 38rem; margin: .35rem 0 0; color: var(--muted); font-size: .8rem; }
.support-dialog { width: min(32rem, calc(100% - 1.2rem)); }
.support-content { padding: 1.4rem 1.25rem 1.5rem; text-align: center; }
.support-icon { display: grid; place-items: center; width: 4rem; height: 4rem; margin: 0 auto 1rem; border-radius: 50%; background: rgba(112, 219, 255, .12); color: var(--cyan); font-size: 2rem; }
.support-content p { max-width: 28rem; margin: 0 auto .8rem; color: var(--muted); line-height: 1.55; }
.ko-fi-button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; margin-top: .7rem; min-height: 3rem; padding: .6rem 1rem; color: white; text-decoration: none; }
.dialog-close { flex: 0 0 auto; width: 2.6rem; height: 2.6rem; }
.report-step { padding: 1.1rem 1.2rem 1.3rem; }

.hazard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}
.hazard-button {
  display: grid;
  grid-template-columns: 3rem 1fr;
  align-items: center;
  gap: .7rem;
  min-height: 5.4rem;
  padding: .75rem;
  border: 1px solid color-mix(in srgb, var(--hazard) 48%, transparent);
  border-radius: .85rem;
  background: color-mix(in srgb, var(--hazard) 10%, var(--panel-2));
  text-align: left;
  cursor: pointer;
}
.hazard-button:hover, .hazard-button:focus-visible { outline: 2px solid var(--hazard); outline-offset: 2px; }
.hazard-button .material-symbols-rounded { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: .72rem; background: var(--hazard); font-size: 1.65rem; }
.hazard-button strong { display: block; font-size: .84rem; line-height: 1.2; }
.hazard-button small { display: block; margin-top: .25rem; color: var(--muted); font-size: .68rem; }

.location-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .65rem;
  margin-top: .8rem;
  padding: .7rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: rgba(255,255,255,.025);
}
.location-card > .material-symbols-rounded { color: var(--cyan); }
.location-card span { display: grid; }
.location-card small { color: var(--muted); font-size: .7rem; }
.location-card button { border: 0; background: transparent; color: var(--cyan); cursor: pointer; }
.location-card.is-error { border-color: rgba(255,77,93,.5); }
.location-card.is-error > .material-symbols-rounded { color: var(--red); }
.ip-location-card { border-style: dashed; }

.emergency-note {
  margin: .7rem 0 0;
  color: #ffc0c5;
  font-size: .74rem;
  text-align: center;
}

.back-button { display: flex; align-items: center; gap: .35rem; margin-bottom: .8rem; padding: .4rem .65rem; }
.selected-hazard { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; padding: .65rem .8rem; border-left: 4px solid var(--selected-color); background: color-mix(in srgb, var(--selected-color) 10%, transparent); }
.selected-hazard .material-symbols-rounded { color: var(--selected-color); }

fieldset { margin: 0 0 .85rem; padding: 0; border: 0; }
legend, .note-field > span { display: block; margin-bottom: .45rem; font-size: .8rem; font-weight: 700; }
legend small, .note-field small { color: var(--muted); font-weight: 400; }

.choice-grid { display: flex; flex-wrap: wrap; gap: .4rem; }
.choice-grid label, .direction-grid label { cursor: pointer; }
.choice-grid input, .direction-grid input { position: absolute; opacity: 0; pointer-events: none; }
.choice-grid span {
  display: block;
  min-width: 5.1rem;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: rgba(255,255,255,.025);
  font-size: .78rem;
  text-align: center;
}
.choice-grid input:checked + span, .direction-grid input:checked + span { border-color: var(--cyan); background: rgba(112,219,255,.14); color: #fff; }

.direction-grid { display: grid; grid-template-columns: repeat(3, 3.7rem); gap: .3rem; }
.direction-grid span { display: grid; place-items: center; height: 3.35rem; border: 1px solid var(--line); border-radius: .6rem; font-size: 1.2rem; }
.direction-grid small { display: block; color: var(--muted); font-size: .55rem; }

.two-column-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.note-field textarea {
  width: 100%;
  resize: vertical;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  outline: 0;
  background: rgba(0,0,0,.2);
  color: var(--text);
}
.note-field textarea:focus { border-color: var(--cyan); }

.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.submit-row p { margin: 0; color: var(--muted); font-size: .72rem; }
.send-report-button { display: flex; align-items: center; justify-content: center; gap: .45rem; min-width: 12rem; min-height: 3.25rem; }
.send-report-button:disabled { cursor: wait; opacity: .6; }

.report-result { min-height: 20rem; text-align: center; }
.report-result .result-icon { margin-top: 2rem; color: var(--green); font-size: 4rem; }
.report-result p { color: var(--muted); }
.report-result button { min-width: 10rem; padding: .7rem 1rem; border: 0; border-radius: .65rem; background: var(--green); color: #032015; font-weight: 700; cursor: pointer; }

.toast {
  position: fixed;
  z-index: 1200;
  right: 1rem;
  bottom: 1rem;
  max-width: 24rem;
  padding: .75rem 1rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: #102234;
  opacity: 0;
  pointer-events: none;
  transform: translateY(1rem);
  transition: 180ms ease;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .report-header { grid-template-columns: 1fr auto; }
  .header-status { display: none; }
  .report-layout { grid-template-columns: 1fr; height: auto; }
  .map-panel { min-height: 34rem; }
  .incident-panel { min-height: 30rem; }
}

@media (max-width: 620px) {
  .report-header { min-height: 4rem; padding: .55rem .7rem; }
  .report-brand img { width: 2.25rem; height: 2.25rem; }
  .report-brand small { display: none; }
  .primary-report-button, .support-button { padding: .55rem .7rem; font-size: .78rem; }
  .support-button .material-symbols-rounded { display: none; }
  .report-layout { padding: .45rem; }
  .map-panel { min-height: calc(100vh - 4.9rem); grid-template-rows: auto auto auto minmax(25rem, 1fr); }
  .map-toolbar { align-items: start; padding: .75rem; }
  .map-summary { display: grid; }
  .map-summary span { min-width: 5.8rem; }
  .incident-panel { min-height: 75vh; }
  .incident-panel-actions .form-launch-button { display: none; }
  .mobile-report-button { position: sticky; bottom: .55rem; display: flex; align-items: center; justify-content: center; gap: .5rem; }
  .hazard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hazard-button { grid-template-columns: 2.6rem 1fr; min-height: 4.7rem; padding: .58rem; }
  .hazard-button .material-symbols-rounded { width: 2.6rem; height: 2.6rem; font-size: 1.4rem; }
  .hazard-button small { display: none; }
  .two-column-fields { grid-template-columns: 1fr; gap: 0; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .send-report-button { width: 100%; }
}

@media (max-width: 380px) {
  .hazard-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Granice administracyjne zachowane z panelu lokalnego. */
.boundary-control{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px 15px;background:#0e2030;color:#dceff8;border-bottom:1px solid #2f5369;font-size:13px}
.boundary-control select{background:#122e42;color:#eef8ff;border:1px solid #4e8298;border-radius:7px;padding:7px 10px}
.boundary-control span{flex:1;min-width:240px;color:#9fc6d8}
.boundary-control a{color:#78daff;text-decoration:underline}

.incident-state{border-left:3px solid var(--state-color);padding-left:6px}
.incident-card-actions{grid-column:2 / -1}.incident-map-button{padding:5px 9px;color:#dceff8;background:#122e42;border:1px solid #4e8298;border-radius:6px}

.map-panel{grid-template-rows:auto auto auto auto minmax(22rem,1fr)}

@media(max-width:1300px){.map-toolbar{flex-wrap:wrap}.map-summary{width:100%;justify-content:flex-start}.map-toolbar h1{font-size:clamp(1.4rem,2.4vw,2rem)}}

.report-form-error{padding:.85rem 1rem;border:1px solid #ff647b;border-radius:.65rem;background:#341c29;color:#ffe8ed;font-weight:600}.report-form-error[hidden]{display:none}
