/* Shared colors, typography and sheet dimensions. */
:root {
  color-scheme: light;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
  --canvas: #ffffff;
  --paper: #ffffff;
  --ink: #000000;
  --accent: #000000;
  --line: #cccccc;
  --line-strong: #999999;
  --calculated: #f4f4f4;
  --editing: #eaf4ff;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-data: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --page-width: 1152px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

input, textarea {
  font: inherit;
}

a, input, textarea {
  -webkit-tap-highlight-color: transparent;
}

input, textarea {
  color: var(--ink);
}

input, textarea, output, .notes-editor {
  font-weight: 600;
}

input {
  min-width: 0;
}

:focus, :focus-visible {
  outline: none;
  box-shadow: none;
}

.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 12px;
  background: var(--paper);
  color: var(--accent);
}

.workspace {
  width: min(var(--page-width), calc(100% - 80px));
  margin: 44px auto 36px;
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.heading-actions {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 42px;
  flex: none;
  width: min(444px, 100%);
  margin-left: auto;
  gap: 10px;
}

.heading-button {
  flex: none;
  width: 100%;
  min-height: 42px;
  padding: 10px 8px;
  border: 1px solid #cccccc;
  border-radius: 0;
  background: #e5e5e5;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.heading-button:hover {
  background: #d6d6d6;
}

.heading-button--clear { background: #ffffff; border-color: #b42318; color: #b42318; }
.heading-button--clear:hover { background: #ffffff; border-color: #912018; color: #912018; }
.heading-button--settings { width: 42px; height: 42px; min-height: 42px; padding: 10px; align-self: center; background: #fff; color: #666; }
.heading-button--settings:hover { background: #f4f4f4; color: #222; }
.heading-button--settings svg { display: block; width: 20px; height: 20px; }

.settings-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 24px; border: 1px solid #aaa; background: #fff; color: #111; }
.settings-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.settings-dialog h2 { margin: 0 32px 22px 0; font-size: 19px; font-weight: 600; }
.settings-close { position: absolute; top: 12px; right: 14px; border: 0; background: transparent; color: #666; font-size: 25px; cursor: pointer; }
.settings-dialog form > label { display: block; margin: 16px 0 7px; font-size: 13px; color: #444; }
.settings-dialog form > input, .settings-dialog form > select { width: 100%; border: 1px solid #ccc; background: #fff; padding: 9px; font: inherit; font-size: 14px; }
.settings-dialog input { font-weight: 400; }
.settings-schedule { margin: 16px 0; font-size: 13px; line-height: 1.5; color: #555; }
.settings-database { margin-top: 20px; font-size: 12px; line-height: 1.5; color: #555; }
.settings-database p { margin: 8px 0; white-space: pre-line; }
.settings-database progress { width: 100%; height: 7px; accent-color: #777; }
.settings-database pre { max-height: 150px; padding: 10px; overflow: auto; border: 1px solid #ddd; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 10px; }
#airport-database-error { color: #b42318; }
.settings-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.settings-actions button { min-width: 108px; padding: 9px 14px; border: 1px solid #ccc; background: #e5e5e5; color: #111; font: inherit; font-size: 13px; cursor: pointer; }
.settings-actions button:hover:enabled { background: #d6d6d6; }
.settings-actions button:disabled { opacity: .5; cursor: default; }
.settings-credit { display: inline-block; margin-top: 20px; color: #777; font-size: 10px; text-decoration: none; }

h1 {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 37px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -1.3px;
}

/* Sheet structure: flight overview above, semantic tables below. */
.flight-sheet {
  overflow: visible;
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--accent);
  border-radius: 0;
  background: var(--paper);
  box-shadow: none;
}

.network-status {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  color: #666;
  font: 11px/18px var(--font-ui);
  pointer-events: none;
}
.network-status[hidden] { display: none; }
.network-status span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.network-status .network-error { color: #b42318; }
@media print {
  .network-status, .settings-dialog { display: none !important; }
}

.flight-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-strong);
}

.phase-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-strong);
}

.phase-group { min-width: 0; padding: 14px 24px 17px; border-right: 1px solid var(--line); }
.phase-group:last-child { border-right: 0; }
.phase-title { margin: 0 0 10px; color: #444444; font-size: 11px; font-weight: 400; line-height: 1.4; }
.phase-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.phase-fields .summary-field { padding: 0; gap: 5px; border: 0; }
.phase-fields .field-label { display: block; font-size: 9px; color: #777777; letter-spacing: .4px; }

.summary-field {
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
  padding: 17px 24px 19px;
  border-right: 1px solid var(--line);
  cursor: text;
}

.summary-field:last-child {
  border-right: 0;
}

.field-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #444444;
  font-size: 11px;
  line-height: 1.4;
}

.field-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.wind-label { align-items: center; }
.wind-online-option { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.wind-online-option input { width: 12px; height: 12px; margin: 0; accent-color: #555; cursor: pointer; }
.wind-online-option input[aria-busy="true"] { opacity: .45; }
.field-value input.online-wind-value { cursor: default; }
.wind-source { align-self: flex-start; margin-top: -7px; color: #777; font-size: 9px; text-decoration: none; }
.wind-source:hover { text-decoration: underline; }

@media screen {
  .summary-field--wind { position: relative; }
  .wind-source {
    position: absolute;
    bottom: 3px;
    left: 24px;
    right: 24px;
    margin: 0;
    line-height: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.field-value input {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  font-family: var(--font-data);
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -.8px;
}

.unit {
  color: #555555;
  font-family: var(--font-data);
  font-size: 10px;
  white-space: nowrap;
}

.clock-field-value { gap: 7px; }
.clock-field-value input { flex: none; width: 5ch; min-width: 0; }

.now-button {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  align-self: center;
  width: 33px;
  height: 22px;
  margin-left: -11px;
  padding: 0 0 0 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #7da7c9;
  cursor: pointer;
  transition: color .15s, background-color .15s, transform .15s;
}

.now-button::before {
  content: '';
  width: 17px;
  height: 17px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.now-button::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 50%;
  width: 8px;
  height: 12px;
  transform: translateY(-50%);
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 8H2m4-4-4 4 4 4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 16' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 8H2m4-4-4 4 4 4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.now-button:hover { background: #b9d9f5; color: #205b8d; transform: scale(1.08); }
.now-button:active { transform: scale(.95); }
.now-button[hidden] { display: none; }

.ata-cell { text-align: center; white-space: nowrap; }
.ata-cell input { display: inline-block; width: 5ch; padding: 0; vertical-align: middle; }
.ata-cell .now-button { margin-left: -4px; vertical-align: middle; }

.wind-unit {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex: none;
}

.field-value .unit-select {
  flex: none;
  font-family: var(--font-data);
}

.table-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #aaaaaa #f5f5f5;
}

.airports-scroll {
  padding-bottom: 16px;
  margin-bottom: -16px;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

.route-table {
  min-width: 620px;
}

.airports-table {
  min-width: 900px;
}

.airport-code-column { width: 14%; }
.airport-frequency-column { width: 19%; }
.airport-elevation-column { width: 10%; }
.airport-distance-column { width: 21%; }
.airport-runway-column { width: 22%; }
.airport-circuit-column { width: 14%; }

.waypoint-column {
  width: 25%;
}

.route-origin :is(td:nth-child(3), td:nth-child(4)) > *,
.route-origin:not(.route-origin-with-time) td:nth-child(7) > * {
  visibility: hidden;
}

.route-origin :is(td:nth-child(3), td:nth-child(4)),
.route-origin:not(.route-origin-with-time) :is(td:nth-child(6), td:nth-child(7)) {
  background-color: var(--paper);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, #d7d7d7 6px 7px);
}

.route-table :is(input, output)[hidden] {
  display: none;
}

th {
  position: relative;
  height: 54px;
  text-align: center;
  vertical-align: middle;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  background: #f4f4f4;
  color: #111111;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .4px;
}

td {
  position: relative;
  height: 44px;
  padding: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.column-unit {
  display: block;
  margin-top: 4px;
  color: #555555;
  font-family: var(--font-data);
  font-size: 9px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: .2px;
}

.unit-select {
  min-height: 18px;
  padding: 0 2px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  cursor: pointer;
}

.column-unit.unit-select {
  margin-right: auto;
  margin-left: auto;
}

th:last-child, td:last-child {
  border-right: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.route-table th:first-child {
  padding-left: 24px;
  text-align: left;
}

td input {
  display: block;
  width: 100%;
  height: 43px;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-family: var(--font-data);
  font-size: 14px;
}

td .text-input {
  font-family: var(--font-ui);
}

td output {
  display: block;
  padding: 0 8px;
  color: var(--ink);
  text-align: center;
  font-family: var(--font-data);
  font-size: 14px;
}

.calculated {
  background: var(--calculated);
}

.waypoint-cell input {
  padding-left: 24px;
  padding-right: 32px;
  text-align: left;
}

.waypoint-cell.has-airport-symbol input { padding-right: 53px; }
.airport-marker {
  position: absolute;
  top: 50%;
  left: 24px;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 56px);
  transform: translateY(-50%);
  pointer-events: none;
  font: 600 14px var(--font-ui);
}
.airport-marker[hidden] { display: none; }
.airport-name-width {
  min-width: 0;
  overflow: hidden;
  visibility: hidden;
  white-space: pre;
}
.airport-symbol {
  flex: none;
  width: 16px;
  height: 16px;
  margin-left: 5px;
  object-fit: contain;
  pointer-events: none;
}
.altitude-cell { font-family: var(--font-data); font-size: 14px; }
.altitude-arrow {
  position: absolute;
  top: 50%;
  left: calc(50% + var(--altitude-width, 2ch) + 3px);
  width: 10px;
  height: 10px;
  transform: translateY(-50%);
  color: #000000;
  pointer-events: none;
}
.altitude-arrow::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  border-top: 1.5px solid #000000;
  transform: rotate(-45deg);
}
.altitude-arrow::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 0;
  width: 5px;
  height: 5px;
  border-top: 1.5px solid #000000;
  border-right: 1.5px solid #000000;
}
.altitude-descent { transform: translateY(-50%) scaleY(-1); }

.row-insert, .row-remove {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 20px;
  line-height: 22px;
  visibility: hidden;
  pointer-events: none;
  cursor: pointer;
  transition: background-color 120ms, color 120ms, transform 120ms;
}

.row-insert {
  top: 0;
  left: var(--insert-position, 50%);
  transform: translate(-50%, -50%);
  z-index: 6;
  border: 1px solid #2e7d32;
  border-radius: 50%;
  background: var(--paper);
  color: #2e7d32;
  font-size: 0;
}

.row-insert::before, .row-insert::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: currentColor;
  pointer-events: none;
}

.row-insert::before {
  width: 10px;
  height: 1.5px;
}

.row-insert::after {
  width: 1.5px;
  height: 10px;
}

.row-insert-after .row-insert {
  top: 100%;
}

.row-remove {
  right: 6px;
  width: 24px;
  height: 24px;
  color: #c62828;
  font-size: 24px;
  line-height: 24px;
}

.row-name-cell:hover > .row-remove {
  visibility: visible;
  pointer-events: auto;
}

.row-insert:hover {
  color: #1b5e20;
  background: #e8f5e9;
  transform: translate(-50%, -50%) scale(1.1);
}

.row-remove:hover {
  color: #b71c1c;
  background: #ffebee;
  transform: translateY(-50%) scale(1.1);
}

.row-insert[hidden] {
  display: none;
}

@media screen {
  .flight-sheet:not(.row-drag-active) :is(.row-insert-before, .row-insert-after) > .row-name-cell {
    z-index: 4;
  }

  .flight-sheet:not(.row-drag-active) :is(.row-insert-before, .row-insert-after) .row-insert {
    visibility: visible;
    pointer-events: auto;
  }

}

.row-drag {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #999999;
  font: 16px/22px var(--font-ui);
  letter-spacing: -2px;
  visibility: hidden;
  pointer-events: none;
  cursor: grab;
  user-select: none;
}

.row-name-cell:hover > .row-drag,
.row-dragging .row-drag {
  visibility: visible;
  pointer-events: auto;
}

.row-drag:hover {
  background: #eeeeee;
  color: #555555;
}

.row-drag:active {
  cursor: grabbing;
}

.row-dragging {
  opacity: .5;
}

.row-drop-before > td::after,
.row-drop-after > td::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #555555;
  pointer-events: none;
}

.row-drop-before > td::after {
  top: -1px;
}

.row-drop-after > td::after {
  bottom: -1px;
}

td:focus-within {
  z-index: 2;
}

.route-summary th, .route-summary td {
  height: 43px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
  background: #f4f4f4;
}

.route-summary th {
  text-align: right;
  padding-right: 8px;
  color: #777;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
}

.route-summary .calculated {
  background: var(--calculated);
}

.route-summary output {
  color: var(--ink);
  font-family: var(--font-data);
  font-size: 14px;
}

.heading-cell {
  font-family: var(--font-data);
  font-size: 14px;
}

.heading-degree {
  position: absolute;
  top: 50%;
  left: calc(50% + var(--course-width, 1.5ch));
  transform: translateY(-50%);
  color: #000000;
  font-size: inherit;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.route-table tbody td:nth-child(6) {
  background: var(--calculated);
}

.route-table tbody tr.current-waypoint > td {
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.route-table tbody tr.current-waypoint > td:first-child {
  border-left: 2px solid var(--ink);
}

.route-table tbody tr.current-waypoint > td:last-child {
  border-right: 2px solid var(--ink);
}

.notes-section {
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.notes-title { margin: 14px 24px 0; color: #777; font-size: 11px; font-weight: 600; letter-spacing: .5px; }

.notes-section .notes-editor {
  display: block;
  width: calc(100% - 48px);
  min-height: 180px;
  height: auto;
  overflow: visible;
  margin: 6px 24px 16px;
  padding: 8px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notes-editor > :is(div, p) {
  margin: 0;
  min-height: 1.5em;
}
.notes-editor > :is(div, p) + :is(div, p) { margin-top: 8px; }

.printed-notes {
  display: none;
}

.airports-table td:first-child {
  background: var(--paper);
}

.airports-table td:first-child input {
  font-family: var(--font-data);
  text-transform: uppercase;
}

.airports-table .row-name-cell input {
  padding-left: 24px;
  padding-right: 32px;
}

@media screen {
  .flight-sheet tbody td:has(> input:enabled:not([readonly])):hover,
  .flight-sheet tbody td:has(> input:enabled:not([readonly]):focus),
  .summary-field:has(input:enabled):hover,
  .summary-field:has(input:enabled:focus),
  .notes-section:has(.notes-editor):hover,
  .notes-section:has(.notes-editor:focus) {
    background-color: var(--editing);
  }
}

/* Keep data columns readable on small screens, with a pinned waypoint / airport. */
@media (max-width: 900px) {
  .workspace {
    width: calc(100% - 48px);
    margin-top: 32px;
  }

  .summary-field {
    padding: 17px 18px;
  }

  .field-value input {
    font-size: 20px;
  }

  th:first-child, td:first-child {
    position: sticky;
    z-index: 1;
    left: 0;
    border-right-color: var(--line-strong);
  }

  th:first-child {
    z-index: 3;
  }

  .table-scroll:focus-within {
    scroll-margin: 16px;
  }
}

@media screen and (max-width: 900px) {
  .wind-source { left: 18px; right: 18px; }
  .phase-overview { grid-template-columns: minmax(0, 1fr); }
  .phase-group { border-right: 0; }
  .phase-group + .phase-group { border-top: 1px solid var(--line); }
}

@media screen and (max-width: 600px) {
  .wind-source { left: 16px; right: 16px; }
  .phase-group { padding-right: 16px; padding-left: 16px; }
  .phase-fields { gap: 16px; }
  .phase-fields .field-label { min-height: 2.8em; }
  .phase-fields .field-value input { font-size: 18px; letter-spacing: -.5px; }
}

@media (max-width: 600px) {
  .flight-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flight-overview .summary-field:nth-child(even) {
    border-right: 0;
  }

  .flight-overview .summary-field:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .flight-overview .summary-field:last-child { grid-column: 1 / -1; }

  .workspace {
    width: calc(100% - 48px);
    margin-top: 28px;
  }

  .page-heading {
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 0 4px;
  }

  h1 {
    font-size: 30px;
    letter-spacing: -1px;
  }

  .flight-sheet {
    border-radius: 0;
  }

  .summary-field {
    min-height: 88px;
    gap: 12px;
    padding: 15px 16px;
  }

  .field-label {
    font-size: 10px;
  }

  .field-value input {
    font-size: 21px;
  }

  .unit {
    font-size: 9px;
  }

  .notes-title { margin-right: 16px; margin-left: 16px; }

  .notes-section .notes-editor {
    width: calc(100% - 32px);
    margin-right: 16px;
    margin-left: 16px;
    min-height: 180px;
    font-size: 16px;
  }

  /* 16px prevents automatic input zoom in mobile Safari. */
  td input {
    font-size: 16px;
  }

  .heading-cell {
    font-size: 16px;
  }
}

/* Fixed A5 portrait. The shared grayscale palette is also used on paper. */
@page {
  size: 148mm 210mm;
  margin: 6mm;
}

@media print {
  .wind-online-option { display: none !important; }
  .wind-source { margin: -1mm 0 0; font-size: 4.5pt; color: #555; }
  html, body {
    width: auto;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  button, input[type="button"], input[type="submit"], input[type="reset"], .skip-link, noscript {
    display: none !important;
  }

  .workspace {
    width: 100%;
    max-width: 135mm;
    min-width: 0;
    margin: 0;
  }

  .page-heading {
    display: block;
    margin: 0 0 3mm;
    padding: 0;
  }

  h1 {
    font-size: 14pt;
    letter-spacing: -.3pt;
  }

  .flight-sheet {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
    border-width: .2mm;
    border-top-width: .4mm;
    border-radius: 0;
  }

  .flight-overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .phase-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  :is(.flight-overview, .phase-overview) .summary-field:nth-child(n) {
    grid-column: auto;
    min-height: 14mm;
    gap: 1.5mm;
    padding: 2mm;
    border-top: 0;
    border-right: .2mm solid var(--line);
  }

  .phase-group { padding: 1.5mm 2mm; border-right: .2mm solid var(--line); }
  .phase-group:last-child { border-right: 0; }
  .phase-title { margin-bottom: 1mm; font-size: 6.5pt; }
  .phase-fields { gap: 3mm; }
  .phase-overview .phase-fields .summary-field { padding: 0; border: 0; min-height: 0; gap: .5mm; }
  .phase-fields .field-label { font-size: 5.5pt; }
  .phase-fields .field-value input { font-size: 9pt; }

  .flight-overview .summary-field:last-child {
    border-right: 0;
  }

  .field-label {
    font-size: 6.5pt;
  }

  .field-value {
    gap: 1mm;
  }

  .field-value input {
    font-size: 10pt;
    letter-spacing: -.3pt;
  }


  .table-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .route-table, .airports-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .airport-code-column { width: 9%; }
  .airport-distance-column { width: 26%; }

  .heading-cell {
    font-size: 8pt;
  }

  .route-table tbody tr.current-waypoint > td {
    border-top-width: .5mm;
    border-bottom-width: .5mm;
  }

  .route-table tbody tr.current-waypoint > td:first-child {
    border-left-width: .5mm;
  }

  .route-table tbody tr.current-waypoint > td:last-child {
    border-right-width: .5mm;
  }

  /* Close each printed table inside its width, including fragmented page borders. */
  .route-table th:last-child, .route-table td:last-child,
  .airports-table th:last-child, .airports-table td:last-child {
    border-right: .2mm solid var(--line-strong);
  }

  .table-scroll th:first-child, .table-scroll td:first-child {
    position: static;
    z-index: auto;
  }

  .route-table tbody td.waypoint-cell { position: relative; }

  th {
    height: 7mm;
    font-size: 6.5pt;
    letter-spacing: .1mm;
  }

  td {
    height: 6mm;
  }

  td input {
    height: 5.8mm;
    padding: 0 .6mm;
    font-size: 8pt;
  }

  .ata-cell input { display: block; width: 100%; padding: 0 .6mm; }
  .clock-field-value input { width: 100%; }

  .route-origin:not(.route-origin-with-time) td:nth-child(5) {
    background-color: var(--paper);
    background-image: repeating-linear-gradient(135deg, transparent 0 6px, #d7d7d7 6px 7px);
  }

  .airports-table td input {
    font-size: 7pt;
  }

  td output, .route-summary output {
    padding: 0 .6mm;
    font-size: 8pt;
  }

  .route-table th:first-child, .waypoint-cell input {
    padding-left: 2mm;
  }

  .waypoint-cell input {
    padding-right: .6mm;
  }

  .waypoint-cell.has-airport-symbol input { padding-right: 4.2mm; }
  .airport-marker { left: 2mm; max-width: calc(100% - 2.6mm); font-size: 8pt; }
  .airport-symbol { width: 3mm; height: 3mm; margin-left: .6mm; }
  .altitude-cell { font-size: 8pt; }
  .altitude-arrow { width: 2mm; height: 2mm; left: calc(50% + var(--altitude-width, 2ch) + .5mm); }
  .altitude-arrow::before { width: 2mm; border-top-width: .2mm; }
  .altitude-arrow::after { top: 0; width: 1mm; height: 1mm; border-width: .2mm; }

  .airports-table .row-name-cell input {
    padding: 0 .6mm;
  }

  .route-summary th, .route-summary td {
    height: 6mm;
  }

  .route-summary th {
    padding-right: 2mm;
    font-size: 6.5pt;
    letter-spacing: .5px;
  }

  .unit, .column-unit {
    font-size: 6pt;
    line-height: 1.2;
  }

  .column-unit {
    margin-top: .5mm;
  }

  .unit-select {
    appearance: none;
    -webkit-appearance: none;
    min-height: 0;
    padding: 0;
  }

  .notes-title { margin: 1.5mm 2mm 0; font-size: 6.5pt; }

  .notes-section .notes-editor {
    display: none;
  }

  .printed-notes {
    display: block;
    min-height: 22mm;
    margin: 0 2mm;
    padding: 1mm 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 8pt;
    font-weight: 600;
    line-height: 5mm;
  }

  tr, .flight-overview {
    break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-row-group;
  }

  *:focus-visible {
    outline: 0 !important;
  }
}
