/* The Nav Log page (/nav-log, scripts/nav-log.js): on top of preflight.css. The printed PLOG is .nl-print, shown only when printing. */

.nl-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nl-status { font-size: 12px; color: var(--muted); }
.nl-status.nl-dirty { color: #fcd34d; }

/* The route */
.nl-route-form { display: flex; gap: 8px; flex-wrap: wrap; }
.nl-route-form input[type=text] { flex: 1 1 260px; min-width: 0; font-size: 14px; padding: 9px 12px; }
.nl-route-form button.active { background: var(--blue-light); border-color: var(--blue); color: #bfdbfe; }
.nl-map { height: 460px; margin-top: 10px; }
.nl-map.nl-picking, .nl-map.nl-picking .leaflet-interactive { cursor: crosshair; }
.nl-marker span {
  display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue-active); border: 2px solid #bfdbfe; color: #fff; font-size: 12px; font-weight: 800;}
.nl-pop b { display: block; color: #fff; }
.nl-pop span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.nl-suggest { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.nl-suggest:empty { display: none; }
.nl-points { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.nl-point {
  display: grid; grid-template-columns: 36px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.1fr) auto; gap: 6px; align-items: center;
  background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px;
}
.nl-point.nl-placing { border-color: var(--amber); }
.nl-point input { min-width: 0; width: 100%; padding: 5px 8px; }
.nl-point-n { font-weight: 800; color: #fff; font-size: 12px; display: flex; gap: 3px; align-items: center; }
.nl-point-n i { font-style: normal; color: var(--muted); font-size: 12px; }
.nl-point-pos { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nl-point-pos em { color: #fcd34d; font-style: normal; }
.nl-point-btns { display: flex; gap: 2px; }
.nl-point-btns button { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 2px 6px; font-size: 13px; line-height: 1; cursor: pointer; box-shadow: none; border-radius: 6px; }
.nl-point-btns button:hover:not(:disabled) { color: #fff; border-color: var(--line-light); }
.nl-point-btns button:disabled { opacity: .3; cursor: default; }
.nl-route-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nl-route-tools a.pf-chip { text-decoration: none; display: inline-block; }

/* Saved nav logs */
.nl-list { display: flex; flex-direction: column; gap: 6px; max-height: 620px; overflow-y: auto; }
.nl-list-item {
  text-align: left; background: var(--inset); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--text); box-shadow: none;
}
.nl-list-item:hover { border-color: var(--line-light); }
.nl-list-item.active { border-color: var(--blue); background: var(--blue-light); }
.nl-list-item b { display: block; font-size: 13px; color: #fff; }
.nl-list-item span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Aircraft, Wind & Fuel */
.nl-form .field { flex: 1 1 110px; }
.nl-form .field label small { text-transform: none; font-weight: 600; }
.nl-dev { margin-top: 14px; }
.nl-dev summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--text-soft); }
.nl-dev-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.nl-dev-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); font-weight: 700; text-align: center; }
.nl-dev-grid input { width: 100%; min-width: 0; text-align: center; padding: 5px 2px; }
.nl-notes { margin-top: 12px; }
.nl-notes textarea { width: 100%; box-sizing: border-box; resize: vertical; font: inherit; font-size: 12px; }

/* The log */
.nl-tiles { margin-bottom: 10px; }
.nl-table-wrap { overflow-x: auto; }
.nl-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 1080px; }
.nl-table th { text-align: center; color: var(--muted); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--line-light); white-space: nowrap; }
.nl-table th small { display: block; text-transform: none; font-weight: 600; letter-spacing: 0; }
.nl-table th:first-child { text-align: left; }
.nl-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.nl-table td input { padding: 4px 5px; text-align: center; font-variant-numeric: tabular-nums; }
.nl-table td input::placeholder { color: #64748b; }
.nl-table td input.nl-w4 { width: 54px; }
.nl-table td input.nl-w5 { width: 66px; }
.nl-table td input.nl-w6 { width: 74px; }
.nl-leg { white-space: nowrap; }
.nl-leg b { color: #fff; }
.nl-leg small { display: block; color: #fcd34d; font-size: 12px; }
.nl-num { text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nl-key { color: #fff; font-weight: 800; }
.nl-ch { color: #7dd3fc; font-size: 14px; }
.nl-err { color: #fcd34d; font-size: 12px; text-align: center; }
.nl-total td { font-weight: 800; color: #fff; border-top: 1px solid var(--line-light); }
.nl-alt-row td { background: rgba(245, 158, 11, 0.06); }

/* Fuel Plan */
.nl-fuel { width: 100%; border-collapse: collapse; font-size: 13px; }
.nl-fuel td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.nl-fuel td small { display: block; color: var(--muted); font-size: 12px; }
.nl-fuel td.nl-num { text-align: right; font-weight: 700; color: #fff; }
.nl-fuel .nl-total td { border-top: 1px solid var(--line-light); }
.nl-ok, .nl-fuel .nl-ok td { color: #6ee7b7; }
.nl-short td, .nl-late { color: var(--alert-urgent); }
.nl-early { color: #93c5fd; }
.nl-endurance { margin: 10px 0 0; font-size: 13px; }
.nl-endurance b { color: #fff; }

/* Checkpoints & ETAs */
.nl-atd { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.nl-atd .field { flex: 0 1 200px; }
.nl-eta { width: 100%; border-collapse: collapse; font-size: 12px; }
.nl-eta th { text-align: left; color: var(--muted); font-size: 12px; padding: 5px 4px; border-bottom: 1px solid var(--line-light); }
.nl-eta td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.nl-eta td b { color: #fff; }
.nl-eta td small { display: block; color: var(--muted); font-size: 12px; }
.nl-eta td s { color: var(--muted); }
.nl-eta input[type=time] { width: 96px; }
.nl-eta .pf-inline button { padding: 4px 8px; }

/* Diversion */
.nl-div-start { margin-top: 10px; }
.nl-div-dest { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.nl-div-dest b { color: #fff; margin-right: 4px; }
.nl-div-dest em { color: #fcd34d; font-style: normal; }
.nl-div-row td { background: rgba(148, 163, 184, 0.08); }
.nl-div-row .nl-leg small { color: var(--text-soft); }
#nlDivCard .pf-chip small { color: var(--muted); font-size: 12px; margin-left: 2px; }
#nlDivCard .pf-inline button.active { background: var(--line); border-color: var(--line-light); color: var(--text-soft); }

.nl-print { display: none; }

@media (max-width: 900px) {
  #nlRouteCard, #nlListCard, #nlFuelCard, #nlEtaCard { grid-column: span 12; }
}
@media (max-width: 640px) {
  .nl-map { height: 360px; }
  .nl-point { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .nl-point .nl-freq-input, .nl-point-pos { grid-column: 2 / span 2; }
  .nl-dev-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .nl-tiles .stat { grid-column: span 6; }
  .nl-head-actions { width: 100%; }
}

/* The printed PLOG: A5 portrait (148 x 210 mm) for a kneeboard, black on white, with room to write. Longer routes run on
   to more pages, the table's heading repeated on each */
@media print {
  @page { size: A5 portrait; margin: 6mm; }
  html, body { background: #fff !important; color: #000 !important; }
  /* Only the PLOG: everything else on the page, and anything app.js adds to the body (the feedback popup, the demo's
     notice, the cookie notice, banners), is left off */
  body > :not(.wrap), .wrap > :not(.nl-print) { display: none !important; }
  .wrap { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .nl-print { display: block; color: #000; font-family: Arial, Helvetica, sans-serif; font-size: 8pt; line-height: 1.2; }
  .nlp-head { margin-bottom: 2.5mm; }
  .nlp-title { display: block; font-size: 11pt; }
  .nlp-head > span { display: block; font-size: 7.5pt; margin-top: 0.5mm; }
  .nlp-boxes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5mm; margin-top: 1.5mm; }
  .nlp-boxes span { border: 1px solid #000; padding: 1mm 1.5mm; white-space: nowrap; font-size: 7pt; min-height: 6mm; }
  .nlp-boxes b { font-size: 9pt; margin-left: 1mm; }
  .nlp-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .nlp-table th, .nlp-table td { border: 1px solid #000; padding: 0.6mm 0.4mm; text-align: center; vertical-align: middle; overflow: hidden; }
  .nlp-table th { background: #e5e7eb !important; font-size: 6.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* To 21%, the times wide enough to write in, the rest shared */
  .nlp-table th:nth-child(1) { width: 21%; }
  .nlp-table th:nth-child(11), .nlp-table th:nth-child(12) { width: 9.5%; }
  .nlp-table td small { display: block; font-size: 5.5pt; color: #333; white-space: nowrap; }
  .nlp-table .nlp-to { text-align: left; padding-left: 1mm; word-break: break-word; }
  .nlp-table .nlp-ch b { font-size: 10pt; }
  .nlp-table .nlp-err { font-size: 6.5pt; }
  .nlp-table tr { page-break-inside: avoid; break-inside: avoid; }
  .nlp-table tbody td { height: 9mm; }
  .nlp-total td { font-weight: 700; height: auto !important; }
  .nlp-alt td { font-style: italic; }
  .nlp-div { margin-top: 2mm; }
  .nlp-div th:nth-child(1) { width: 21%; }
  .nlp-div th:nth-child(2) { width: 13%; }
  .nlp-div th:nth-child(11), .nlp-div th:nth-child(12) { width: auto; }
  .nlp-points { width: 100%; border-collapse: collapse; margin-top: 2mm; font-size: 7pt; }
  .nlp-points td { border: 1px solid #000; padding: 0.6mm 1mm; vertical-align: top; }
  .nlp-points td:first-child { width: 21%; }
  .nlp-points td:nth-child(2) { width: 18%; }
  .nlp-foot { display: grid; grid-template-columns: auto 1fr; gap: 2mm; margin-top: 2mm; break-inside: avoid; page-break-inside: avoid; }
  .nlp-fuel { border-collapse: collapse; font-size: 7pt; }
  .nlp-fuel th, .nlp-fuel td { border: 1px solid #000; padding: 0.5mm 1.5mm; text-align: left; }
  .nlp-fuel td:last-child { text-align: right; min-width: 12mm; }
  .nlp-box { border: 1px solid #000; padding: 1mm 1.5mm; min-height: 22mm; font-size: 7pt; }
  .nlp-box b { display: block; margin-bottom: 0.5mm; }
  .nlp-notes-box { margin-top: 2mm; min-height: 0; break-inside: avoid; }
  .nlp-small { font-size: 6pt; margin: 1.5mm 0 0; color: #333; }
}
