﻿:root {
  /* Theme: rose (MAVLink). Revert: copy style.legacy-teal.css over style.css */
  --sea-deep: #1a0f14;
  --sea: #5c2438;
  --sea-mid: #c44d6e;
  --foam: #faf0f3;
  --paper: #fcf6f8;
  --ink: #1f1218;
  --muted: #6b4a56;
  --accent: #9f1239;
  --accent-hot: #f08a2a;
  --line: rgba(31, 18, 24, 0.12);
  --ok: #1f7a4c;
  --err: #9b2c2c;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Source Sans 3", system-ui, sans-serif;
  --display: "Source Sans 3", system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(26, 15, 20, 0.08);
  --app-nav-h: 3rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(1200px 600px at 8% -8%, #f3dce4 0%, transparent 55%),
    radial-gradient(800px 420px at 100% 0%, #f0e4ea 0%, transparent 48%),
    linear-gradient(180deg, var(--foam) 0%, var(--paper) 100%);
}

a { color: var(--sea-mid); }

.app-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(26, 15, 20, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-nav-inner {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.4rem 1.25rem;
  min-height: 2.6rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-nav-links {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  align-items: center;
  min-width: max-content;
}

.app-nav-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: #fff;
  font: 700 1.05rem/1.2 var(--display);
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-align: center;
  pointer-events: none;
  max-width: calc(100% - 2.5rem);
}

.app-nav-logo {
  position: relative;
  z-index: 1;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  flex-shrink: 0;
}

.app-nav-logo img {
  display: block;
  height: 1.85rem;
  width: auto;
}

.app-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font: 600 0.82rem/1 var(--sans);
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-nav-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

.app-nav-btn.is-active {
  color: #fff;
  background: var(--sea-mid);
  border-color: var(--sea-mid);
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem 2.5rem;
}

.sticky-workspace {
  position: sticky;
  top: var(--app-nav-h);
  z-index: 30;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 249, 0.97) 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(10, 36, 44, 0.07);
  max-height: calc(100vh - var(--app-nav-h));
  overflow-y: auto;
}

.sticky-workspace-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.35rem 1.25rem 0.4rem;
}

.sticky-workspace .tabs {
  margin-bottom: 0.25rem;
}

.sticky-nmea {
  margin-bottom: 0;
  padding: 0.4rem 0.6rem 0.4rem;
}

.sticky-nmea .wire-head {
  gap: 0.45rem;
  align-items: center;
  margin: 0;
}

.sticky-nmea .panel-head h2 {
  font-size: 0.92rem;
  flex: 0 0 auto;
}

.sticky-nmea .encode-status-inline {
  margin: 0;
  flex: 1 1 6rem;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sticky-nmea .row-actions {
  flex: 0 0 auto;
  gap: 0.3rem;
}

.sticky-nmea .row-actions .btn {
  padding: 0.28rem 0.65rem;
  font-size: 0.82rem;
}

.sticky-nmea textarea.nmea {
  margin-top: 0.28rem;
  padding: 0.28rem 0.55rem;
  border-radius: 7px;
  font-size: 0.84rem;
  line-height: 1.3;
}

.sticky-nmea .wire-foot {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin-top: 0.22rem;
  flex-wrap: wrap;
}

.sticky-nmea #nmea-hint {
  margin: 0;
  flex: 1 1 auto;
  font-size: 0.74rem;
  line-height: 1.25;
}

.sticky-nmea .payload-details {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.sticky-hex {
  margin-bottom: 0;
  padding: 0.4rem 0.6rem 0.4rem;
}

.sticky-hex .wire-head {
  gap: 0.45rem;
  align-items: center;
  margin: 0;
}

.sticky-hex .panel-head h2 {
  font-size: 0.92rem;
  flex: 0 0 auto;
}

.sticky-hex .encode-status-inline {
  margin: 0;
  flex: 1 1 6rem;
  min-width: 0;
  font-size: 0.78rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sticky-hex .row-actions {
  flex: 0 0 auto;
  gap: 0.3rem;
}

.sticky-hex .row-actions .btn {
  padding: 0.28rem 0.65rem;
  font-size: 0.82rem;
}

.sticky-hex textarea.nmea {
  margin-top: 0.28rem;
  padding: 0.28rem 0.55rem;
  border-radius: 7px;
  font-size: 0.84rem;
  line-height: 1.3;
}

.sticky-hex .wire-foot {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin-top: 0.22rem;
  flex-wrap: wrap;
}

.sticky-hex #hex-hint {
  margin: 0;
  flex: 1 1 auto;
  font-size: 0.74rem;
  line-height: 1.25;
}

.sticky-hex .payload-details {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.msg-panel[hidden] { display: none !important; }

.msg-head h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--sea-deep);
}

.msg-head h1 em {
  font-style: normal;
  font-weight: 500;
  font-size: 0.85em;
  color: var(--muted);
}

.flag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.35rem 0.55rem;
}

label.check {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
}

label.check input {
  margin-top: 0.15rem;
  flex: 0 0 auto;
}

label.check em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.82em;
}

textarea.nmea.hex-one-line {
  min-height: 0;
  height: auto;
  min-height: 2.6rem;
  max-height: 4.2rem;
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  line-height: 1.3;
  padding-top: 0.28rem;
  padding-bottom: 0.28rem;
}

.toolbar-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 1rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
  max-width: 100%;
}

.tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font: 600 0.82rem/1.2 var(--sans);
  cursor: pointer;
}

.tab.is-active {
  background: var(--sea);
  border-color: var(--sea);
  color: #fff;
}

.tab.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.75fr);
  gap: 1.1rem;
  align-items: start;
}

.layout-wide {
  grid-template-columns: 1fr;
}

.nmea-panel {
  margin-bottom: 1.1rem;
  min-width: 0;
}

.panel {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 1.25rem;
  backdrop-filter: blur(8px);
  min-width: 0;
}

.panel-head h1,
.panel-head h2,
.tips h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  color: var(--sea-deep);
}

.panel-head h1 { font-size: 1.45rem; }
.panel-head h2,
.tips h2 { font-size: 1.15rem; }

.lede, .hint {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.panel-head.row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.row-actions { display: flex; gap: 0.45rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1rem 0 0.85rem;
  align-items: end;
}

/* toolbar now lives in .toolbar-panel */

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.card-block {
  margin: 0;
  padding: 0.65rem 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  display: grid;
  gap: 0.45rem;
  min-width: 0;
  align-content: start;
  align-items: stretch;
}

/* Keep short panes (e.g. Routing) content-sized and top-aligned in the form grid */
.form-grid > .card-block,
.form-grid > .card-fit {
  align-self: start;
  align-content: start;
  height: fit-content;
}

.card-block .field,
.card-fit .field {
  align-content: start;
}

.card-block legend {
  padding: 0 0.35rem;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sea);
}

.pos-block {
  position: relative;
}

.pos-coords {
  display: grid;
  gap: 0.45rem;
}

.place-tools {
  position: relative;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin: 0.15rem 0 0.25rem;
}

.place-finder {
  position: static;
}

.place-finder-toggle,
.map-picker-toggle {
  appearance: none;
  border: 1px dashed rgba(196, 77, 110, 0.45);
  background: rgba(255, 255, 255, 0.55);
  color: var(--sea-mid);
  font: 600 0.78rem/1.2 var(--sans);
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  width: fit-content;
}

.place-finder-toggle:hover,
.place-finder.is-open .place-finder-toggle,
.map-picker-toggle:hover {
  background: rgba(196, 77, 110, 0.1);
  border-style: solid;
}

.place-finder-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.28rem);
  z-index: 8;
  padding: 0.55rem 0.6rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 28px rgba(10, 36, 44, 0.14);
}

.map-picker-dialog {
  border: none;
  padding: 0;
  border-radius: 12px;
  width: min(720px, calc(100vw - 1.5rem));
  max-width: 100%;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(10, 36, 44, 0.28);
  color: var(--ink);
}

.map-picker-dialog::backdrop {
  background: rgba(10, 36, 44, 0.45);
}

.map-picker-shell {
  display: flex;
  flex-direction: column;
}

.map-picker-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.map-picker-header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--sea-deep);
  flex: 0 0 auto;
}

.map-picker-coords {
  margin: 0;
  flex: 1 1 10rem;
  min-width: 0;
  font: 500 0.82rem/1.3 var(--mono);
  color: var(--muted);
}

.map-picker-close {
  margin-left: auto;
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: 600 0.82rem/1.2 var(--sans);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}

.map-picker-close:hover {
  border-color: rgba(196, 77, 110, 0.55);
  background: rgba(255, 255, 255, 0.95);
}

.map-picker-body {
  position: relative;
  height: min(52vh, 420px);
  min-height: 260px;
  background: #e8d0d8;
}

.map-picker-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-picker-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  z-index: 2;
  pointer-events: none;
}

.map-picker-crosshair::before,
.map-picker-crosshair::after {
  content: "";
  position: absolute;
  background: #c0392b;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.map-picker-crosshair::before {
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  margin-left: -1px;
}

.map-picker-crosshair::after {
  top: 50%;
  left: 0;
  height: 2px;
  width: 100%;
  margin-top: -1px;
}

.map-picker-hint {
  margin: 0;
  padding: 0.45rem 0.75rem 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.pos-block.place-open .pos-coords {
  opacity: 0.45;
}

.field-place {
  margin: 0;
}

.place-status {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  min-height: 1.1em;
}

.place-status.is-err {
  color: var(--err);
}

.place-results {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
  max-height: 14rem;
  overflow-y: auto;
}

.place-result {
  display: grid;
  gap: 0.2rem;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.place-result:hover,
.place-result:focus {
  border-color: rgba(196, 77, 110, 0.55);
  background: rgba(255, 255, 255, 0.95);
  outline: none;
}

.place-result-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.place-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.25;
}

.place-score {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.place-score.is-strong { color: var(--ok); }
.place-score.is-fair { color: #9a6b12; }
.place-score.is-weak { color: var(--muted); }

.place-ll {
  font-family: var(--mono);
  font-size: 0.7rem;
}

.card-advanced { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }

.field {
  display: grid;
  gap: 0.28rem;
}

.field > span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}

.field > span em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.82rem;
}

.field input,
.field select,
.field-inline select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font: 500 1rem/1.2 var(--sans);
  background: #fff;
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(26, 107, 114, 0.35);
  border-color: var(--sea-mid);
}

.field-check {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.55rem;
  padding-top: 0.35rem;
}

.field-check input { width: auto; }

.field-inline {
  min-width: 10rem;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.55rem 0.95rem;
  font: 700 0.95rem/1.2 var(--sans);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.btn-secondary {
  background: var(--sea-mid);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--sea-mid);
  border: 1px solid rgba(196, 77, 110, 0.45);
}

.btn-ghost:hover {
  background: rgba(196, 77, 110, 0.12);
}

.hint-small {
  margin-top: 0.4rem;
  font-size: 0.85rem;
}

textarea.nmea {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.9rem;
  border: 1px solid rgba(215, 240, 236, 0.2);
  border-radius: 10px;
  background: var(--sea-deep);
  color: #d7f0ec;
  font: 500 0.9rem/1.45 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  overflow-x: hidden;
  overflow-y: auto;
  resize: none;
  box-sizing: border-box;
}

textarea.nmea.nmea-two-line {
  min-height: 0;
  height: 2.75rem;
  max-height: 2.75rem;
  line-height: 1.3;
}

textarea.nmea:focus {
  outline: 2px solid rgba(196, 77, 110, 0.55);
  border-color: var(--sea-mid);
}

.payload {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  background: #2a1520;
  color: #d7f0ec;
  font: 500 0.8rem/1.4 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  max-height: 14rem;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

.payload-details {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.hint.is-ok { color: var(--ok); }
.hint.is-err { color: var(--err); }

.tips ul {
  margin: 0.55rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.tips li { margin: 0.35rem 0; }

.side { display: grid; gap: 1rem; min-width: 0; }

.side-logo {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.35rem 0.15rem;
}

.side-logo-img {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  max-height: 72px;
  object-fit: contain;
  object-position: right center;
}

.main { min-width: 0; }

.foot {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (max-width: 1100px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-advanced { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .app-nav-inner {
    flex-direction: column;
    justify-content: center;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
  }
  .app-nav-links {
    justify-content: center;
    flex-wrap: wrap;
    min-width: 0;
  }
  .app-nav-title {
    position: static;
    transform: none;
    left: auto;
    top: auto;
    order: -1;
    white-space: normal;
    font-size: 0.98rem;
    margin-bottom: 0.2rem;
    max-width: 100%;
  }
  .app-nav-logo {
    margin-left: auto;
    align-self: flex-end;
  }
  .side-logo {
    max-width: min(220px, 70vw);
    margin: 0 auto;
  }
  .side-logo-img { object-position: center; }
  .layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .card-advanced { grid-template-columns: 1fr; }
}

label.field[title],
label.field-check[title],
label.frn-toggle[title],
label.anomaly-check[title] {
  cursor: help;
}
