﻿:root {
  /* Theme: amber (ASTERIX). Revert: copy style.legacy-teal.css over style.css */
  --sea-deep: #1c1408;
  --sea: #5c3d14;
  --sea-mid: #c47a1a;
  --foam: #faf6ef;
  --paper: #fbf8f2;
  --ink: #1f1810;
  --muted: #6b5c48;
  --accent: #b45309;
  --accent-hot: #ea580c;
  --line: rgba(31, 24, 16, 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(28, 20, 8, 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%, #f3e6d0 0%, transparent 55%),
    radial-gradient(800px 420px at 100% 0%, #efe8dc 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(28, 20, 8, 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;
}

.edition-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  align-items: center;
  margin: 0 0 0.3rem;
}

.edition-chip-sep {
  flex: 0 0 1px;
  align-self: stretch;
  width: 1px;
  min-height: 1.4rem;
  margin: 0 0.2rem;
  background: var(--line);
}

.edition-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  font: 500 0.78rem/1 var(--mono);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.edition-chip.is-planned {
  opacity: 0.55;
}

.edition-chip.is-ready {
  opacity: 1;
  border-color: rgba(31, 122, 76, 0.35);
}

.edition-chip.is-selected {
  background: var(--sea);
  color: #fff;
  border-color: var(--sea);
  opacity: 1;
}

.edition-chip-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--ok);
}

.edition-chip.is-selected .edition-chip-dot {
  background: #8fefb4;
}

.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 #hex-hint,
.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-nmea .form-warning {
  margin: 0.28rem 0 0;
  padding: 0.35rem 0.5rem;
}

.hint-deferred {
  margin: 0.35rem 0 0;
  font-size: 0.86rem;
  line-height: 1.35;
  color: var(--muted);
}

.anomaly-bar {
  margin: 0.65rem 0 0;
  padding: 0.55rem 0.7rem 0.6rem;
  border: 1px solid rgba(160, 90, 20, 0.35);
  border-radius: 8px;
  background: rgba(255, 244, 230, 0.92);
}

.anomaly-check {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink);
}

.anomaly-check span {
  font-weight: 700;
}

.hint-anomaly {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
}

.form-stack {
  display: block;
  margin: 0.55rem 0 0;
}

.form-stack > .card-block {
  margin-bottom: 0.35rem;
}

@media (min-width: 900px) {
  .form-stack {
    column-count: 2;
    column-gap: 0.5rem;
  }
  .form-stack > .card-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

.legend-frn {
  padding: 0;
}

.frn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: var(--sea-deep);
  text-transform: none;
}

.frn-toggle.is-mandatory {
  cursor: default;
}

.frn-toggle input {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}

.frn-toggle span b {
  font-weight: 800;
}

.card-block.is-frn-off {
  opacity: 0.45;
}

.card-block.is-frn-off .fields-row {
  pointer-events: none;
}

.fields-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.4rem 0.55rem;
}

.field-compact {
  flex: 0 1 7.5rem;
  min-width: 5.5rem;
}

.field-compact.field-wide {
  flex: 1 1 14rem;
  min-width: 10rem;
}

.hint-inline {
  margin: 0;
  align-self: center;
  font-size: 0.8rem;
}

.msg-panel[hidden] { display: none !important; }

.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: 1fr 1fr;
  gap: 0.85rem;
}

.card-block {
  margin: 0;
  padding: 0.45rem 0.65rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  display: block;
  min-width: 0;
}

/* Panes stay content-height and top-aligned â€” do not stretch with taller siblings */
.form-grid > .card-block,
.form-stack > .card-block {
  align-self: start;
  height: fit-content;
}

.card-block .field {
  align-content: start;
}

.card-block legend {
  padding: 0 0.25rem;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--sea-deep);
}

.pos-block {
  position: relative;
}

.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, 122, 26, 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, 122, 26, 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, 122, 26, 0.55);
  background: rgba(255, 255, 255, 0.95);
}

.map-picker-body {
  position: relative;
  height: min(52vh, 420px);
  min-height: 260px;
  background: #e8dcc8;
}

.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;
}

.field-place > span {
  font-size: 0.78rem;
}

.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, 122, 26, 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: 1fr 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: 8px;
  padding: 0.35rem 0.45rem;
  font: 500 0.92rem/1.2 var(--sans);
  background: #fff;
  color: var(--ink);
}

.field-compact > span {
  font-size: 0.78rem;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(26, 107, 114, 0.35);
  border-color: var(--sea-mid);
}

.field-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  padding: 0.15rem 0.1rem 0.3rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.field-check input { width: auto; margin: 0; }

.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, 122, 26, 0.45);
}

.btn-ghost:hover {
  background: rgba(196, 122, 26, 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, 122, 26, 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: #2a2014;
  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: 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; }
}

.msg-panel.is-dimmed {
  opacity: 0.55;
}

label.field[title],
label.field-check[title],
label.frn-toggle[title],
label.anomaly-check[title] {
  cursor: help;
}
