/* components.css - Shared component styles */
.signin-page {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px var(--spacing-lg) var(--spacing-lg);
  padding-top: max(60px, 10vh);
  position: relative;
  z-index: 2;
}
.landing-page .signin-page {
  min-height: 0;
}
.signin-container {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
}
.branding {
  text-align: center;
}
.branding-link {
  text-decoration: none;
  color: inherit;
}
.logo {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--spacing-sm);
}
.logo svg {
  width: 100%;
  height: 100%;
}
.propeller {
  transform-origin: 40px 40px;
  animation: spin 15s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0);
  }
  to {
    transform: rotate(360deg);
  }
}
.app-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}
.tagline {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}
.signin-card {
  width: 100%;
  background: rgba(var(--color-bg-card-rgb), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}
.form-group {
  margin-bottom: var(--spacing-md);
}
.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-xs);
}
.form-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-accent-light);
  font-style: italic;
}
.form-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.form-input::placeholder {
  color: var(--color-text-muted);
}
.form-input:focus {
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px #3b82f633;
}
.form-input:hover:not(:focus) {
  border-color: var(--color-text-muted);
}
.form-input-clickable {
  cursor: pointer;
  user-select: none;
}
.form-input-clickable:hover {
  border-color: var(--color-accent-primary);
}
input[type="number"].form-input {
  max-width: 120px;
  -moz-appearance: textfield;
}
input[type="number"].form-input::-webkit-outer-spin-button,
input[type="number"].form-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.form-section {
  background: #8080800d;
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}
.form-section-title {
  margin: 0 0 var(--spacing-md) 0;
  color: var(--color-text-primary);
  font-size: var(--font-size-lg);
  font-weight: 600;
}

/* ── Flight Plan Form: Borderless Sections ── */
#flight-plan-form .form-section {
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  padding: 0 0 var(--spacing-lg) 0;
  margin-bottom: var(--spacing-lg);
}
#flight-plan-form .form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
#flight-plan-form .form-section-title {
  color: var(--color-text-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Section header row (title + inline control) */
.form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}
.form-section-header .form-section-title {
  margin-bottom: 0;
}

/* Flex form group (replaces inline style="flex:1; position:relative") */
.form-group-flex {
  flex: 1;
  position: relative;
}

/* Uppercase text input (ICAO fields) */
.form-input-uppercase {
  text-transform: uppercase;
}

/* Input + unit label layout (altitude, fuel) */
.form-input-with-unit {
  display: flex;
  align-items: center;
  gap: 6px;
}
.form-unit {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Narrow monospace inputs (altitude, FOB) */
.form-input-narrow {
  width: 100px;
  font-family: monospace;
}
.form-input-fob {
  width: 90px;
}

/* Altitude recommendation inline displays */
.altitude-rec {
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: var(--spacing-xs);
}
.altitude-rec-label {
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 1rem;
}
.altitude-rec-value {
  font-weight: 700;
  font-size: 1rem;
  font-family: monospace;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 1px 4px;
}
.altitude-rec-value:hover {
  text-decoration: underline;
}
.altitude-rec-mea {
  color: #f59e0b;
}
.altitude-rec-wind {
  color: #60a5fa;
}
.altitude-hint-mea {
  display: inline-block;
  font-size: 0.75rem;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  margin-top: 4px;
}
.altitude-hint-wind {
  font-size: 0.75rem;
  color: #60a5fa;
  margin-left: var(--spacing-xs);
}

/* Route input (contenteditable pill container) */
.form-input-route {
  min-height: 60px;
  padding: var(--spacing-sm);
  cursor: text;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

/* Label row with inline action button */
.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-xs);
}

/* View on Map icon button */
.fp-icon-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  display: flex;
}
.fp-icon-btn:hover {
  color: var(--color-text-primary);
}
.fp-icon-btn svg {
  width: 18px;
  height: 18px;
}


.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-family);
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background-color 0.2s,
    transform 0.1s;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary,
.btn-success {
  background: #16a34a;
  color: #fff;
}
.btn-primary:hover,
.btn-success:hover {
  background: #15803d;
}
.btn-primary:focus,
.btn-success:focus {
  outline: none;
  box-shadow: 0 0 0 3px #16a34a66;
}
.btn-accent {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: var(--radius-lg);
  background: var(--color-accent-primary);
  color: #fff;
}
.btn-accent:hover {
  background: var(--color-accent-hover);
}
.btn-accent:focus {
  outline: none;
  box-shadow: 0 0 0 3px #3b82f666;
}
.signin-footer {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}
.signin-footer a {
  color: var(--color-accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.signin-footer a:hover {
  color: var(--color-accent-light);
  text-decoration: underline;
}
.signin-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.signin-footer-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
}
.signin-footer-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}
.error-message {
  background: #ef44441a;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
  font-size: var(--font-size-sm);
  text-align: center;
}
@media (max-width: 480px) {
  .signin-page {
    padding: var(--spacing-sm);
    padding-top: max(40px, 6vh);
  }
  .app-title {
    font-size: var(--font-size-xl);
  }
  .logo {
    width: 48px;
    height: 48px;
  }
  .signin-card {
    padding: var(--spacing-md);
  }
  .cloud-1,
  .cloud-2,
  .cloud-3,
  .cloud-4,
  .cloud-5 {
    transform: scale(0.6);
  }
}

.characteristics-group {
  margin-bottom: var(--spacing-lg);
}
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.2s;
}
.checkbox-label:hover {
  background: var(--color-bg-secondary);
}
.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-accent-primary);
}
.checkbox-label span {
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}
.search-box {
  position: relative;
  min-width: 250px;
}
.search-box input {
  width: 100%;
  padding-left: 40px;
}
.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-text-secondary);
  pointer-events: none;
}
.page-controls {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-lg);
}
.page-controls .search-box {
  flex: 1;
}
.per-page-selector {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}
.per-page-selector label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.per-page-selector select {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-sm);
  min-width: 70px;
}
.pagination-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}
.pagination-row .pagination {
  flex: 1;
}
@media (max-width: 600px) {
  .page-controls {
    flex-wrap: wrap;
  }
  .page-controls .btn {
    align-self: center;
  }
  .search-box {
    min-width: 100%;
  }
  .pagination-row {
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: center;
  }
  .pagination-row .pagination {
    flex: none;
    width: 100%;
    max-width: 100%;
  }
  .pagination-row .per-page-selector {
    order: -1;
  }
}
@media (max-width: 768px) {
  .aircraft-page,
  .logbook-page {
    padding: calc(48px + var(--spacing-lg) + env(safe-area-inset-top, 0px))
      var(--spacing-md) var(--spacing-lg);
  }
  .aircraft-item {
    padding: var(--spacing-sm) var(--spacing-md);
  }
  .aircraft-header {
    flex-wrap: wrap;
  }
}
.admin-actions {
  margin-bottom: var(--spacing-xl);
}
.admin-table-container {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.admin-table thead {
  background: var(--color-bg-card);
}
.admin-table th {
  padding: var(--spacing-md);
  text-align: left;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--color-bg-primary);
}
.admin-table td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-bg-primary);
  font-size: var(--font-size-sm);
  color: var(--color-text-primary);
}
.admin-table tbody tr:hover {
  background: var(--color-bg-card);
}
.admin-table tbody tr:last-child td {
  border-bottom: none;
}
.actions-cell {
  white-space: nowrap;
}
.actions-cell .btn {
  margin-right: var(--spacing-xs);
}
.badge-admin {
  background: #dc262633;
  color: #fca5a5;
}
.badge-user {
  background: #3b82f633;
  color: var(--color-accent-light);
}
.stats-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
  padding: var(--spacing-md) 0;
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  padding: var(--spacing-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  text-align: center;
}
.stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.stat-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--color-accent-primary);
}
@media (max-width: 768px) {
  .admin-table {
    font-size: var(--font-size-sm);
  }
  .admin-table th,
  .admin-table td {
    padding: var(--spacing-sm);
  }
  .stats-container {
    grid-template-columns: 1fr;
  }
  .actions-cell .btn {
    display: block;
    width: 100%;
    margin-bottom: var(--spacing-xs);
    margin-right: 0;
  }
}
.twofa-step {
  margin-bottom: var(--spacing-xl);
}
.qr-code-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--spacing-xl);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
  min-height: 280px;
}
.qr-code-image {
  max-width: 256px;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  background: #fff;
  padding: var(--spacing-sm);
}
.manual-entry {
  padding: var(--spacing-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
}
.manual-code {
  display: block;
  width: 100%;
  padding: var(--spacing-md);
  background: var(--color-bg-primary);
  color: var(--color-accent-primary);
  border-radius: var(--radius-sm);
  font-family:
    Courier New,
    monospace;
  font-size: var(--font-size-lg);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.15em;
  user-select: all;
  cursor: pointer;
  transition: background-color 0.2s;
}
.manual-code:hover {
  background: var(--color-bg-card);
}
.backup-codes-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  max-height: 400px;
  overflow-y: auto;
}
.backup-code-item {
  padding: var(--spacing-sm);
  background: var(--color-bg-primary);
  border-radius: var(--radius-sm);
  text-align: center;
}
.backup-code-item code {
  display: block;
  font-family:
    Courier New,
    monospace;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-accent-light);
  letter-spacing: 0.1em;
}
@media (max-width: 768px) {
  .qr-code-container {
    min-height: 220px;
    padding: var(--spacing-lg);
  }
  .qr-code-image {
    max-width: 200px;
  }
  .backup-codes-list {
    grid-template-columns: 1fr;
  }
  .manual-code {
    font-size: var(--font-size-base);
    letter-spacing: 0.1em;
  }
}
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0009;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-content {
  background: rgba(var(--color-bg-card-rgb), 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow:
    var(--shadow-lg),
    0 0 40px #0000004d;
  border: 1px solid var(--color-border);
  animation: modalSlideIn 0.2s ease-out;
}
@keyframes modalSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-bg-secondary);
}
.modal-body {
  margin-bottom: var(--spacing-lg);
}
.modal-header h2 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition:
    background-color 0.2s,
    color 0.2s;
}
.modal-close:hover {
  background: rgba(var(--color-bg-secondary-rgb, 128, 128, 128), 0.3);
  color: var(--color-text-primary);
}
.modal-actions {
  display: flex;
  gap: var(--spacing-md);
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-bg-secondary);
  flex-wrap: wrap;
}
.modal-actions .btn {
  flex: none;
}
.icao-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-sm);
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--spacing-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-lg);
}
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    padding: var(--spacing-lg);
  }
  .modal-actions {
    flex-direction: column;
  }
}
.modal-header h2,
.modal-close,
.modal-close:hover,
.form-label,
.form-hint,
.form-section-title,
.checkbox-label span {
  color: #fff;
}
[data-theme="white"] .modal-header h2,
[data-theme="cloud"] .modal-header h2,
[data-theme="cream"] .modal-header h2,
[data-theme="white"] .modal-close,
[data-theme="cloud"] .modal-close,
[data-theme="cream"] .modal-close,
[data-theme="white"] .modal-close:hover,
[data-theme="cloud"] .modal-close:hover,
[data-theme="cream"] .modal-close:hover,
[data-theme="white"] .form-label,
[data-theme="cloud"] .form-label,
[data-theme="cream"] .form-label,
[data-theme="white"] .form-hint,
[data-theme="cloud"] .form-hint,
[data-theme="cream"] .form-hint,
[data-theme="white"] .form-section-title,
[data-theme="cloud"] .form-section-title,
[data-theme="cream"] .form-section-title,
[data-theme="white"] .checkbox-label span,
[data-theme="cloud"] .checkbox-label span,
[data-theme="cream"] .checkbox-label span {
  color: #000;
}
.flatpickr-calendar {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
}
.flatpickr-months {
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
}
.flatpickr-current-month {
  color: var(--color-text-primary) !important;
}
.flatpickr-current-month .cur-month,
.flatpickr-current-month input.cur-year,
.flatpickr-current-month .numInputWrapper input,
.flatpickr-current-month .numInput {
  color: var(--color-text-primary) !important;
  font-weight: 600;
}
.flatpickr-current-month select.flatpickr-monthDropdown-months {
  color: var(--color-text-primary) !important;
  background: var(--color-bg-secondary) !important;
}
.flatpickr-current-month .numInputWrapper span {
  border-color: var(--color-text-secondary);
}
.flatpickr-current-month .numInputWrapper span:hover {
  background: var(--color-bg-secondary);
}
.flatpickr-current-month .numInputWrapper span.arrowUp:after {
  border-bottom-color: var(--color-text-primary) !important;
}
.flatpickr-current-month .numInputWrapper span.arrowDown:after {
  border-top-color: var(--color-text-primary) !important;
}
.flatpickr-monthDropdown-months,
.numInputWrapper input {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}
.flatpickr-monthDropdown-months:hover,
.numInputWrapper:hover input,
.flatpickr-weekdays {
  background: var(--color-bg-secondary);
}
.flatpickr-weekday {
  color: var(--color-text-secondary);
  font-weight: 600;
}
.flatpickr-day {
  color: var(--color-text-primary);
  border: 1px solid transparent;
}
.flatpickr-day:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-accent-primary);
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
  color: var(--color-text-primary);
}
.flatpickr-day.today {
  border-color: var(--color-accent-primary);
}
.flatpickr-day.disabled,
.flatpickr-day.disabled:hover {
  color: var(--color-text-muted);
  background: transparent;
  cursor: not-allowed;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  color: var(--color-text-primary);
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  color: var(--color-accent-primary);
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
  fill: var(--color-text-primary);
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
  fill: var(--color-accent-primary);
}
[data-theme="white"] .flatpickr-day.selected,
[data-theme="cloud"] .flatpickr-day.selected,
[data-theme="cream"] .flatpickr-day.selected,
[data-theme="white"] .flatpickr-day.selected:hover,
[data-theme="cloud"] .flatpickr-day.selected:hover,
[data-theme="cream"] .flatpickr-day.selected:hover {
  background: var(--color-accent-primary);
  color: #fff;
}

.password-strength-container {
  margin-top: var(--spacing-xs);
}
.password-strength-bar {
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--spacing-xs);
}
.password-strength-fill {
  height: 100%;
  width: 0%;
  transition:
    width 0.3s ease,
    background-color 0.3s ease;
  border-radius: 2px;
}
.password-strength-fill.weak {
  width: 25%;
  background: #dc2626;
}
.password-strength-fill.fair {
  width: 50%;
  background: #f59e0b;
}
.password-strength-fill.good {
  width: 75%;
  background: #10b981;
}
.password-strength-fill.strong {
  width: 100%;
  background: #059669;
}
.password-strength-text {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}
.password-strength-text.weak {
  color: #dc2626;
}
.password-strength-text.fair {
  color: #f59e0b;
}
.password-strength-text.good {
  color: #10b981;
}
.password-strength-text.strong {
  color: #059669;
}
.password-match {
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-xs);
  display: none;
}
.password-match.visible {
  display: block;
}
.password-match.match {
  color: #10b981;
}
.password-match.no-match {
  color: #dc2626;
}
.username-availability {
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-xs);
  display: none;
}
.username-availability.visible {
  display: block;
}
.username-availability.checking {
  color: var(--color-text-secondary);
}
.username-availability.available {
  color: #10b981;
}
.username-availability.taken {
  color: #dc2626;
}

.autocomplete-container {
  position: relative;
}
.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
  display: none;
}
.autocomplete-results.active {
  display: block;
}
.autocomplete-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid var(--color-border);
}
.autocomplete-item:last-child {
  border-bottom: none;
}
.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--color-bg-secondary);
}
.autocomplete-item-icao {
  font-family:
    Courier New,
    monospace;
  font-weight: 700;
  color: var(--color-accent-primary);
  font-size: var(--font-size-base);
  min-width: 60px;
}
.autocomplete-item-name {
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
  flex: 1;
}
.autocomplete-loading {
  padding: var(--spacing-md);
  text-align: center;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-style: italic;
}
.autocomplete-item-custom {
  background: #3b82f61a;
  border-top: 1px solid var(--color-accent-primary);
}
.autocomplete-item-custom:hover,
.autocomplete-item-custom.selected {
  background: #3b82f633;
}
.autocomplete-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--color-accent-primary);
  color: #fff;
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.uppercase-input {
  text-transform: uppercase;
}

/* Airport Typeahead Dropdown */
.airport-typeahead-dropdown {
  position: fixed;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1001;
  box-shadow: var(--shadow-lg);
}

.airport-typeahead-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.airport-typeahead-item:hover,
.airport-typeahead-item.selected {
  background: var(--color-bg-hover);
}

.airport-typeahead-item .airport-icao {
  font-weight: 600;
  font-family: monospace;
}

.airport-typeahead-item .airport-name {
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.airport-typeahead-item .airport-type {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
}

/* Flight Plan Toolbar (icon buttons) */
.fp-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: var(--spacing-md);
  padding-bottom: 0;
  border-bottom: 1px solid var(--color-border);
}

.fp-toolbar-row {
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  gap: 6px;
  padding: 4px 0;
}

.fp-toolbar-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-muted, #999);
  writing-mode: vertical-rl;
  line-height: 1;
  padding: 4px 4px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 2px solid var(--color-border, #ddd);
  margin-right: 2px;
}

.fp-toolbar-fss {
  gap: 6px;
  justify-content: flex-start;
  padding-top: 4px;
  padding-bottom: 4px;
  border-top: 1px solid var(--color-border);
}

.fp-toolbar-actions {
  display: flex;
  gap: 6px;
}

.fp-toolbar button {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border, #d1d5db);
  border-radius: 9999px;
  cursor: pointer;
  color: var(--color-text-secondary, #6b7280);
  padding: 0;
  width: 32px;
  transition: all 0.2s;
}

.fp-toolbar button:active:not(:disabled) {
  transform: scale(0.98);
}

.fp-toolbar button:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.fp-toolbar button.fp-toolbar-labeled {
  width: auto;
  padding: 0 12px;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 500;
}

.fp-toolbar button.fp-toolbar-labeled:hover,
.fp-toolbar button:hover {
  background: var(--color-bg-secondary, #f3f4f6);
  border-color: var(--color-text-secondary, #9ca3af);
  color: var(--color-text-primary, #374151);
}

.fp-toolbar button.fp-toolbar-danger {
  color: var(--color-danger, #dc2626);
  border-color: var(--color-danger, #dc2626);
  background: transparent;
}
.fp-toolbar button.fp-toolbar-danger:hover {
  background: var(--color-danger-bg, #fef2f2);
}

.fp-toolbar button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Aircraft Typeahead Dropdown */
.aircraft-typeahead-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 250px;
  overflow-y: auto;
  z-index: 1001;
  margin-top: 4px;
}

.aircraft-typeahead-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  transition: background-color 0.15s;
  border-bottom: 1px solid var(--color-border);
}

.aircraft-typeahead-item:last-child {
  border-bottom: none;
}

.aircraft-typeahead-item:hover,
.aircraft-typeahead-item.selected {
  background: var(--color-bg-secondary);
}

.aircraft-typeahead-item .aircraft-reg {
  font-family: monospace;
  font-weight: 700;
  color: var(--color-accent-primary);
  min-width: 70px;
}

.aircraft-typeahead-item .aircraft-info {
  flex: 1;
  color: var(--color-text-primary);
  font-size: var(--font-size-sm);
}

.aircraft-typeahead-item .aircraft-type {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  background: var(--color-bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
}

.aircraft-typeahead-empty {
  padding: var(--spacing-md);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-style: italic;
}

/* Aircraft Info Display (below selector) */
.aircraft-info-display {
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.aircraft-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.aircraft-info-item {
  color: var(--color-text-secondary);
}

.aircraft-info-item strong {
  color: var(--color-text-primary);
  font-weight: 500;
}

.aircraft-info-item.aircraft-info-missing {
  color: #ef4444;
}

.aircraft-info-item.aircraft-info-missing strong {
  color: #ef4444;
}

.aircraft-info-warning {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
  padding-top: var(--spacing-xs);
  border-top: 1px solid var(--color-border);
  color: #ef4444;
  font-size: 0.8rem;
}

.aircraft-info-warning svg {
  flex-shrink: 0;
}

.aircraft-info-warning a {
  color: #ef4444;
  text-decoration: underline;
}

.aircraft-info-warning a:hover {
  color: #dc2626;
}

/* Route Builder Wrapper - overlay panel */
.route-builder-wrapper {
  display: none;
  position: absolute;
  right: 20px;
  top: 16px;
  z-index: 1001;
}

.route-builder-wrapper.visible {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}


/* Route Builder Panel */
.route-builder-panel {
  width: 340px;
  max-height: calc(100vh - 120px);
  background: rgba(var(--color-bg-card-rgb), 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), 0 4px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s ease;
}
.route-builder-panel.terrain-expanded {
  width: min(510px, calc(100vw - 280px));
}

/* ═════════════════════════════════════════════════════════════════════════
   Route-builder modal — shared design primitives
   ═════════════════════════════════════════════════════════════════════════
   All controls inside the route-builder wrapper compose these primitives so
   the modal reads as one consistent surface. Avoid bespoke padding / border
   / shadow rules on individual widgets — add a variant class instead. */

/* Field row: small uppercase label on the left, control on the right.
   Used for ALT, Aircraft, Max-alt, and any future key/value row. */
.rb-field-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-height: 34px;
}

.rb-field-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  flex: 0 0 auto;
  min-width: 64px;
}

/* Text input / typeahead input. 34px tall matches the button / row height
   so they align cleanly when side-by-side. */
.rb-input {
  flex: 1;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.12s ease, background 0.12s ease;
  box-sizing: border-box;
}

.rb-input:focus {
  border-color: var(--color-accent-primary);
  background: var(--color-bg-primary);
}

.rb-input::placeholder {
  color: var(--color-text-muted);
}

/* Monospace variant for numeric / identifier inputs (altitudes, ICAOs). */
.rb-input--mono {
  font-family: monospace;
  font-weight: 600;
  text-align: right;
}

/* Secondary button — the dominant interactive style inside the modal.
   Same 34px frame as .rb-input so Dep/App / Clear / etc. align with rows.
   No gradient, no strong shadow — the modal's hierarchy comes from color
   accents on active states, not chrome. */
.rb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
  user-select: none;
  box-sizing: border-box;
}

.rb-btn:hover {
  border-color: var(--color-border-light);
  background: var(--color-bg-card);
}

.rb-btn:active {
  background: var(--color-bg-primary);
}

.rb-btn.is-active,
.rb-btn.has-selection {
  border-color: var(--color-accent-primary);
  color: var(--color-accent-light);
}

.rb-btn--block {
  width: 100%;
}

.rb-btn--subtle {
  background: transparent;
  border-color: transparent;
  color: var(--color-text-secondary);
}

.rb-btn--subtle:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  border-color: transparent;
}

/* Icon button — ghost by default. Used in the route-builder header and any
   in-modal action affordance. Buttons that include a `.rb-icon-btn-label`
   child become taller to accommodate the stacked icon + text layout; icon-
   only buttons stay 32×32. */
.rb-icon-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 32px;
  min-height: 32px;
  padding: 4px 6px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.rb-icon-btn:hover {
  background: var(--color-bg-secondary);
}

.rb-icon-btn:active {
  background: var(--color-bg-primary);
}

.rb-icon-btn--danger:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

.rb-icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Text label under the icon. Rendered on every target so buttons in a
   bouncing cockpit are self-describing. Buttons without a label child
   stay icon-only. */
.rb-icon-btn-label {
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  color: inherit;
  white-space: nowrap;
}

/* Chip / badge. Small read-only label used for MEA, kind markers, etc. */
.rb-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.rb-chip--warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}

/* Notice: a block-level warning / info message. Replaces the bespoke
   .route-mea-disclaimer style so future notices use one pattern. */
.rb-notice {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-primary);
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  line-height: 1.4;
}

.rb-notice--warning {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}

/* Underline tab. Used by Route Suggestions tabs and the procedure picker. */
.rb-tab {
  padding: 8px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.rb-tab:hover {
  color: var(--color-text-primary);
}

.rb-tab.is-active {
  color: var(--color-accent-primary);
  border-bottom-color: var(--color-accent-primary);
}

/* ═════════════════════════════════════════════════════════════════════════ */

.route-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  background: transparent;
  user-select: none;
}

/* Collapsible sections */
.rb-section-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px var(--spacing-sm);
  cursor: pointer;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  border: none;
  user-select: none;
  background: rgba(var(--color-border-rgb, 128, 128, 128), 0.12);
}
.rb-section-toggle:hover {
  color: var(--color-text-primary);
  background: rgba(var(--color-border-rgb, 128, 128, 128), 0.22);
}
.rb-section-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.rb-collapsed .rb-section-chevron {
  transform: rotate(-90deg);
}
.rb-collapsed .rb-section-body {
  display: none;
}

.route-builder-header h3 {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.route-builder-header h3 svg {
  width: 16px;
  height: 16px;
  color: var(--color-accent-primary);
}

.route-builder-header-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.route-header-btn {
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.route-header-btn:hover {
  background: rgba(var(--color-bg-secondary-rgb, 128, 128, 128), 0.4);
}

.route-header-btn:active {
  transform: scale(0.98);
}

.route-header-btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.route-header-btn svg {
  width: 18px;
  height: 18px;
}

/* Pill-style waypoint input */
.route-builder-waypoints {
  flex: 0 1 auto;
  overflow-y: auto;
  padding: var(--spacing-sm) var(--spacing-md);
  min-height: 80px;
  max-height: 160px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: var(--spacing-xs);
  cursor: text;
}

.route-pill-input {
  background: rgba(var(--color-bg-secondary-rgb, 128, 128, 128), 0.3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(var(--color-border-rgb, 128, 128, 128), 0.5);
  margin: var(--spacing-sm);
}

/* Route builder controls (altitude, notice, aircraft).
   Rows inside use .rb-field-row; this container just adds the side padding
   and stacks rows with a consistent gap. */
.route-builder-controls {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-sm);
}

.route-control-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.route-toggle-group {
  display: inline-flex;
  background: rgba(var(--color-bg-secondary-rgb, 128, 128, 128), 0.3);
  border-radius: 9999px;
  padding: 3px;
  border: none;
}

.route-toggle-btn {
  padding: 4px 14px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 9999px;
  transition: all 0.2s ease;
}

.route-toggle-btn.active {
  background: var(--color-accent-primary);
  color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.route-toggle-btn:hover:not(.active) {
  color: var(--color-text-primary);
  background: rgba(var(--color-bg-secondary-rgb, 128, 128, 128), 0.3);
}

.route-altitude-group {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(var(--color-border-rgb, 128, 128, 128), 0.5);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  position: relative;
}

.route-altitude-field-label {
  color: var(--color-text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--color-bg-secondary);
}

.route-altitude-input {
  width: 50px;
  border: none;
  background: transparent;
  color: var(--color-text-primary);
  font-family: monospace;
  font-size: 0.85rem;
  text-align: right;
  outline: none;
}

.route-altitude-input::placeholder {
  color: var(--color-text-muted);
}

.route-altitude-unit {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.route-altitude-label {
  display: none;
  color: #f59e0b;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 6px;
  padding: 2px 6px;
  background: rgba(245, 158, 11, 0.15);
  border-radius: 4px;
  white-space: nowrap;
}

.route-mea-disclaimer {
  font-size: 0.7rem;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  border-radius: 4px;
  padding: 4px 8px;
  margin: 4px var(--spacing-sm) 0;
  line-height: 1.4;
}

.route-distance-label {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  margin-left: 8px;
  white-space: nowrap;
}

/* Waypoint pill */
.waypoint-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #2563eb;
  color: white;
  padding: 4px 8px;
  border-radius: 999px;
  font-family: monospace;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.waypoint-pill.unresolved {
  background: #f59e0b;
  color: #1a1a1a;
}

.waypoint-pill-remove {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  margin-left: 2px;
}

.waypoint-pill-remove:hover {
  color: white;
}

/* Drag handle on waypoint pills */
.waypoint-pill-grip {
  display: inline-flex;
  align-items: center;
  cursor: grab;
  opacity: 0.4;
  padding: 0 2px;
  margin-left: -2px;
  touch-action: none;
}
.waypoint-pill-grip:active {
  cursor: grabbing;
  opacity: 0.8;
}
.waypoint-pill-grip svg {
  width: 10px;
  height: 14px;
}

/* Draggable pill states */
.waypoint-pill.sortable-chosen {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transform: scale(1.05);
}

.waypoint-pill.dragging {
  opacity: 0.4;
}

/* Airway indicator button on waypoint pills */
.airway-indicator-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 0 2px;
  margin-left: 2px;
  display: flex;
  align-items: center;
}

.airway-indicator-btn:hover {
  color: #fff;
}

.airway-indicator-btn svg {
  width: 12px;
  height: 12px;
}

.waypoint-pill.has-airways {
  padding-right: 4px;
}

/* Airway pill (collapsed representation) */
.waypoint-pill.airway-pill {
  background: #059669;
  gap: 2px;
}

.waypoint-pill.airway-pill.expanded {
  background: #047857;
}

.airway-expand-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}

.airway-expand-btn:hover {
  color: #fff;
}

.airway-expand-btn svg {
  width: 14px;
  height: 14px;
}

/* Fixes that are part of an expanded airway */
.waypoint-pill.airway-fix-pill {
  background: #065f46;
  opacity: 0.85;
  font-size: 0.75rem;
  padding: 3px 6px;
}

/* Holding pattern pill */
.waypoint-pill.hold-pill {
  background: #7e22ce;
  gap: 2px;
  padding-right: 4px;
}

.hold-pill-body {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}

/* Read-only variant — rendered in contexts that can't open the hold editor
   (e.g. RouteInput in the flight plan modal). Same visuals, no pointer. */
.hold-pill-body-static {
  cursor: default;
}

.hold-pill-icon {
  display: inline-flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.85);
}

.hold-pill-icon svg {
  width: 12px;
  height: 12px;
}

.hold-pill-label {
  letter-spacing: 0.02em;
}

/* Pill body (fix id label) — transparent button that opens the action menu. */
.waypoint-pill-body {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  touch-action: manipulation;
  letter-spacing: 0.01em;
  -webkit-appearance: none;
  appearance: none;
}

.waypoint-pill-body:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Pill action popover menu */
.pill-menu {
  position: fixed;
  min-width: 220px;
  max-width: 320px;
  padding: 6px;
  background: rgba(var(--color-bg-card-rgb), 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
  border-radius: var(--radius-md, 8px);
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(0, 0, 0, 0.25));
  z-index: 1200;
  color: var(--color-text-primary, #111);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pill-menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 4px;
  touch-action: manipulation;
  line-height: 1.2;
}

.pill-menu-item:hover,
.pill-menu-item:focus-visible {
  background: rgba(var(--color-bg-secondary-rgb, 128, 128, 128), 0.2);
  outline: none;
}

.pill-menu-item.disabled {
  color: var(--color-text-secondary, #666);
  cursor: not-allowed;
  opacity: 0.6;
}

.pill-menu-item.disabled:hover {
  background: none;
}

.pill-menu-item.destructive {
  color: #dc2626;
}

.pill-menu-item.destructive:hover {
  background: rgba(220, 38, 38, 0.1);
}

.pill-menu-item-label {
  font-weight: 500;
}

.pill-menu-item-hint {
  font-size: 0.75rem;
  color: var(--color-text-secondary, #777);
  font-weight: 400;
}

.pill-menu-separator {
  height: 1px;
  background: var(--color-border, rgba(0, 0, 0, 0.1));
  margin: 4px 2px;
}

.pill-menu-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary, #666);
  padding: 6px 10px 2px;
  font-weight: 600;
}

/* Hold panel — shared base */
.hold-panel {
  color: var(--color-text-primary, #111);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.hold-panel * {
  box-sizing: border-box;
}

/* Desktop: docked panel in the top-left of the map viewport, matching
 * .route-builder-wrapper / .route-builder-panel styling so the two feel
 * like peers. Positioning is relative to .map-viewport (see hold-panel.js). */
.hold-panel-popover {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 340px;
  max-width: calc(100vw - 280px);
  /* Relative to .map-viewport (the positioning parent), not the visual
   * viewport — on iPad the map area sits below a header, so 100vh would
   * push the panel's bottom off-screen and hide the action buttons. */
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 14px;
  background: rgba(var(--color-bg-card-rgb), 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-lg, 0 8px 32px rgba(0, 0, 0, 0.25)), 0 4px 30px rgba(0, 0, 0, 0.2);
  /* Sits over the route builder (z-index: 1001). Covers it while editing
   * a hold so the user can focus on the holding pattern fields. */
  z-index: 1100;
}

/* Mobile bottom sheet */
.hold-panel-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--color-bg-primary, #fff);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--color-border, rgba(0, 0, 0, 0.1));
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.25);
  z-index: 1200;
}

.hold-panel-sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(128, 128, 128, 0.4);
  border-radius: 2px;
  margin: 0 auto 12px;
}

.hold-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 1199;
}

.hold-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hold-panel-title {
  font-size: 1rem;
  font-weight: 600;
}

.hold-panel-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-secondary, #666);
  padding: 4px 8px;
}

.hold-panel-instruction {
  font-size: 0.9rem;
  line-height: 1.4;
  padding: 10px 12px;
  background: var(--color-bg-secondary, #f5f5f5);
  border-radius: 8px;
  border-left: 3px solid #7e22ce;
}

.hold-panel-entry {
  font-size: 0.85rem;
  color: var(--color-text-secondary, #666);
}

.hold-panel-entry-type {
  font-weight: 700;
}

.hold-panel-entry-type.entry-direct { color: #16a34a; }
.hold-panel-entry-type.entry-teardrop { color: #dc2626; }
.hold-panel-entry-type.entry-parallel { color: #2563eb; }

.hold-panel-entry-hint {
  font-style: italic;
}

.hold-panel-canvas-wrap {
  display: flex;
  justify-content: center;
  background: var(--color-bg-secondary, #f5f5f5);
  border-radius: 8px;
  padding: 4px;
}

.hold-panel-canvas {
  display: block;
  max-width: 100%;
}

.hold-panel-procedures {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hold-panel-proc-card {
  background: var(--color-bg-secondary, #f5f5f5);
  border-radius: 8px;
  padding: 10px 12px;
}

.hold-panel-proc-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary, #666);
  font-weight: 700;
  margin-bottom: 6px;
}

.hold-panel-steps {
  margin: 0;
  padding: 0 0 0 20px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--color-text-primary, #111);
}

.hold-panel-steps li {
  padding-left: 2px;
}

.hold-panel-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hold-panel-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hold-panel-field-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary, #666);
  font-weight: 600;
}

.hold-panel-course-row,
.hold-panel-leg-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hold-panel-course,
.hold-panel-legval {
  flex: 0 0 90px;
  padding: 6px 10px;
  font-size: 0.95rem;
  border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
  border-radius: 6px;
  background: var(--color-bg-primary, #fff);
  color: inherit;
  font-family: inherit;
  /* Tells Safari/Chromium to render the number-input spinner arrows in a
   * theme-appropriate color. Without this the native up/down arrows render
   * near-black on dark themes and vanish against the input background. */
  color-scheme: light dark;
}

/* Force dark UA rendering for number spinners on dark themes. color-scheme
 * alone isn't always enough — some WebKit builds need an explicit dark hint
 * even when the page is obviously dark. */
[data-theme="midnight"] .hold-panel-course,
[data-theme="midnight"] .hold-panel-legval,
[data-theme="tarmac"] .hold-panel-course,
[data-theme="tarmac"] .hold-panel-legval,
[data-theme="dusk"] .hold-panel-course,
[data-theme="dusk"] .hold-panel-legval {
  color-scheme: dark;
}

.hold-panel-unit,
.hold-panel-leg-unit {
  color: var(--color-text-secondary, #666);
  font-size: 0.9rem;
  font-weight: 600;
}

.hold-panel-auto {
  margin-left: auto;
  background: var(--color-bg-secondary, #f5f5f5);
  border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
}

.hold-panel-auto:hover {
  background: var(--color-bg-tertiary, #ebebeb);
}

.hold-panel-segmented {
  display: inline-flex;
  border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
  border-radius: 6px;
  overflow: hidden;
  align-self: flex-start;
}

.hold-panel-segmented button {
  background: var(--color-bg-primary, #fff);
  border: none;
  padding: 6px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  touch-action: manipulation;
}

.hold-panel-segmented button + button {
  border-left: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
}

.hold-panel-segmented button.active {
  background: #7e22ce;
  color: white;
}

.hold-panel-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding-top: 4px;
}

.hold-panel-remove {
  background: none;
  border: 1px solid #dc2626;
  color: #dc2626;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
}

.hold-panel-remove:hover {
  background: rgba(220, 38, 38, 0.08);
}

.hold-panel-done {
  background: #7e22ce;
  border: none;
  color: white;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  touch-action: manipulation;
}

.hold-panel-done:hover {
  background: #6b21a8;
}

/* Route search dropdown (for standalone RouteInput) */
.route-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
}

.route-search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
}

.route-search-item:last-child {
  border-bottom: none;
}

.route-search-item:hover {
  background: var(--color-bg-secondary);
}

.route-search-id {
  font-weight: 600;
  color: var(--color-text-primary);
  min-width: 50px;
}

.route-search-name {
  flex: 1;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-search-type {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

/* Route search dropdown in map route builder (dark theme, fixed position) */
.route-search-dropdown-fixed {
  background: #1a1a2e;
  border-color: #333;
  z-index: 10000;
}

.route-search-dropdown-fixed .route-search-item {
  border-bottom-color: #333;
}

.route-search-dropdown-fixed .route-search-item:hover {
  background: #2a2a4a;
}

.route-search-dropdown-fixed .route-search-id {
  color: #fff;
}

.route-search-dropdown-fixed .route-search-name {
  color: #aaa;
}

.route-search-dropdown-fixed .route-search-type {
  color: #777;
}

/* Route input container needs relative positioning for dropdown */
.route-pill-input {
  position: relative;
}

/* Generic modal (used by drag-waypoint modals) */
.airway-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1000;
}

.airway-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  width: 320px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
  display: flex;
  pointer-events: auto;
  border: 1px solid var(--color-border);
  flex-direction: column;
}

.airway-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.airway-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.airway-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  line-height: 1;
}

.airway-modal-close:hover {
  color: var(--color-text-primary);
}

.airway-modal-body {
  padding: var(--spacing-md);
  overflow-y: auto;
  flex: 1;
}

.airway-modal-footer {
  display: flex;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border-top: 1px solid var(--color-border);
  justify-content: flex-end;
}

/* Airway inline dropdown (anchored to waypoint pill) */
.airway-dropdown {
  position: fixed;
  z-index: 1000;
  width: 260px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  padding: var(--spacing-sm);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.airway-dropdown-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  font-weight: 600;
  margin-bottom: 4px;
}

.airway-dropdown-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.airway-dropdown-pill {
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.airway-dropdown-pill:hover {
  border-color: var(--color-accent-primary);
}

.airway-dropdown-pill.selected {
  border-color: var(--color-accent-primary);
  background: rgba(59, 130, 246, 0.15);
}

.airway-pill-type {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.airway-dropdown-search {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-size: 0.8rem;
  outline: none;
  margin-bottom: 4px;
  box-sizing: border-box;
}

.airway-dropdown-search:focus {
  border-color: var(--color-accent-primary);
}

.airway-dropdown-exit-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.airway-dropdown-exit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  transition: background 0.1s;
}

.airway-dropdown-exit-item:hover {
  background: var(--color-bg-hover, var(--color-bg-tertiary));
}

.airway-dropdown-exit-item .exit-fix-id {
  font-weight: 600;
  font-family: monospace;
}

.airway-dropdown-exit-item .exit-fix-distance {
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.airway-dropdown-exit-item .exit-mea {
  color: var(--color-text-muted);
  font-size: 0.7rem;
}

/* Procedure picker popover (tabbed: Instrument / Visual / Standard) */
.procedure-picker {
  position: fixed;
  z-index: 1001;
  width: 320px;
  max-height: 70vh;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Inline variant — the picker mounts inside the route-builder panel
   (under the Dep/Arr/App buttons) instead of as a fixed-position
   popover. Shares the panel's width, drops the detached-popover
   chrome (shadow, border-radius), and slides in from the top so it
   feels like a section expanding, not a separate window. */
.route-procedure-picker-host { display: contents; }
.procedure-picker--inline {
  position: relative;
  z-index: auto;
  width: auto;
  max-height: 50vh;
  box-shadow: none;
  border-radius: var(--radius-sm);
  margin: var(--spacing-sm) 0;
  animation: procedure-picker-slide-in 160ms ease-out;
}
@keyframes procedure-picker-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Highlight the Dep/Arr/App button whose picker is currently open. */
.route-procedure-buttons .rb-btn.is-open {
  border-color: var(--color-accent-primary);
  background: var(--color-bg-tertiary, var(--color-bg-hover));
}

.procedure-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}

.procedure-picker-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.procedure-picker-icao {
  font-family: monospace;
  color: var(--color-accent-primary);
}

.procedure-picker-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.procedure-picker-close:hover { color: var(--color-text-primary); }

.procedure-picker-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
}

/* Tabs compose .rb-tab — make them equal-width inside the picker. */
.procedure-picker-tabs .rb-tab {
  flex: 1;
  text-align: center;
}

.procedure-picker-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-sm);
}

.procedure-picker-panel {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.procedure-picker-group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  font-weight: 600;
  padding: 4px 0;
}

.procedure-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Side toggle (towered fields): segmented control under the runway-end
   label, lets the pilot pick the pattern direction tower assigned. The
   "published" badge marks the FAA-default direction so the alternate is
   visibly the alternate. */
.procedure-picker-side-toggle {
  display: flex;
  gap: 4px;
  margin: 2px 0 6px 0;
}
.procedure-picker-side-tab {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 4px 6px;
}
.procedure-picker-published-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-left: 4px;
  opacity: 0.85;
}

.procedure-picker-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}

.procedure-picker-item:hover {
  background: var(--color-bg-hover, var(--color-bg-tertiary));
  border-color: var(--color-accent-primary);
}

.procedure-picker-item.loading {
  opacity: 0.5;
  pointer-events: none;
}

.procedure-picker-transition-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  margin-bottom: 2px;
  transition: background 0.1s;
}

.procedure-picker-transition-item:hover {
  background: var(--color-bg-hover, var(--color-bg-tertiary));
  border-color: var(--color-accent-primary);
}

/* Back link within the transition sub-picker. Composes .rb-btn--subtle,
   this class just adds a top margin to offset it from the list above. */
.procedure-picker-back {
  margin-top: var(--spacing-sm);
}

.procedure-picker-item-name {
  font-family: monospace;
  font-weight: 600;
}

.procedure-picker-item-rwy {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Chart-only picker entries (d-TPP approaches not coded in CIFP). Dashed
   border hints at the map rendering convention — solid = defined geometry,
   dashed = vectored / uncertain. The badge communicates that the route-
   builder won't draw map geometry for these; briefing is from the plate. */
.procedure-picker-item--chart-only {
  border-style: dashed;
  opacity: 0.88;
}
.procedure-picker-item--chart-only:hover {
  opacity: 1;
}
.procedure-picker-item-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  white-space: nowrap;
}

.procedure-picker-empty,
.procedure-picker-loading {
  padding: 16px 12px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.procedure-picker-footer {
  padding: 8px 12px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}

/* .procedure-picker-clear composes .rb-btn--subtle — no bespoke styles. */

/* Container for the two Dep/App .rb-btn buttons above the pill input.
   Always visible — buttons compose .rb-btn primitives directly. */
.route-procedure-buttons {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
}

/* Inline "ft" label after a monospace altitude input. Small, muted, sized
   to sit between the input and any trailing chip. */
.rb-field-suffix {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  flex: 0 0 auto;
}

/* Airport typeahead inside the procedure picker popover */
.procedure-picker-airport-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
}

/* .procedure-picker-airport-input now composes .rb-input — no bespoke
   dimensions. This class remains only as a hook for positioning relative
   to its dropdown. */
.procedure-picker-airport-input {
  text-transform: uppercase;
}

.procedure-picker-airport-dropdown {
  position: absolute;
  top: 100%;
  left: 12px;
  right: 12px;
  z-index: 1;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.procedure-picker-airport-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  padding: 6px 10px;
  background: none;
  border: none;
  text-align: left;
  color: var(--color-text-primary);
  cursor: pointer;
  font-size: 0.85rem;
}

.procedure-picker-airport-item:hover {
  background: var(--color-bg-hover, var(--color-bg-tertiary));
}

.procedure-picker-airport-id {
  font-family: monospace;
  font-weight: 600;
}

.procedure-picker-airport-name {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Procedure pills in the route strip (parallels .airway-pill) */
.waypoint-pill.procedure-pill {
  background: rgba(236, 72, 153, 0.15);         /* default (iap = magenta) */
  border: 1px solid rgba(236, 72, 153, 0.5);
}

.waypoint-pill.procedure-sid,
.waypoint-pill.procedure-star {
  background: rgba(6, 182, 212, 0.15);          /* cyan */
  border-color: rgba(6, 182, 212, 0.5);
}

.waypoint-pill.procedure-visual,
.waypoint-pill.procedure-vfr_entry {
  background: rgba(34, 197, 94, 0.15);          /* green / visual */
  border-color: rgba(34, 197, 94, 0.5);
}

.waypoint-pill.procedure-vfr_entry {
  background: rgba(234, 179, 8, 0.15);          /* yellow override */
  border-color: rgba(234, 179, 8, 0.5);
}

.procedure-pill-kind {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  /* Translucent white reads on both the colored-tint default background
     (cyan / magenta / green) and the solid blue coupled background. The
     previous `--color-text-muted` gray lost contrast on dark backgrounds. */
  color: rgba(255, 255, 255, 0.65);
  margin-right: 4px;
  letter-spacing: 0.05em;
}

.procedure-pill-name {
  font-family: monospace;
  font-weight: 600;
}

/* Chart-only procedure pill — the approach exists in d-TPP but not in
   CIFP, so there are no coded legs to expand and no map geometry. Dashed
   border mirrors the map's dashed-segment convention for uncertain /
   vectored paths. The CHART badge sits where the expand chevron would
   normally live. */
.waypoint-pill.procedure-pill.chart-only {
  border-style: dashed;
}
.procedure-pill-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.25);
  border: none;
  border-radius: var(--radius-sm);
  padding: 1px 4px;
  margin-left: 2px;
  cursor: pointer;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-underline-offset: 2px;
  transition: background 0.1s, color 0.1s;
}
.procedure-pill-badge:hover {
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  text-decoration-color: rgba(255, 255, 255, 0.7);
}

.procedure-expand-btn {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
}

.procedure-expand-btn:hover {
  color: var(--color-text-primary);
}

/* Procedure interior fix pills are read-only: no drag grip, no ×. Their
   colors match the parent procedure pill's kind so the expansion reads as
   a coherent visual group. */
.waypoint-pill.procedure-fix-pill {
  background: rgba(236, 72, 153, 0.15);        /* iap default (magenta) */
  border: 1px solid rgba(236, 72, 153, 0.4);
  color: white;
  font-family: monospace;
  font-size: 0.8rem;
  cursor: default;
}

.waypoint-pill.procedure-fix-sid,
.waypoint-pill.procedure-fix-star {
  background: rgba(6, 182, 212, 0.18);         /* cyan */
  border-color: rgba(6, 182, 212, 0.45);
}

.waypoint-pill.procedure-fix-iap {
  background: rgba(236, 72, 153, 0.18);        /* magenta */
  border-color: rgba(236, 72, 153, 0.45);
}

.waypoint-pill.procedure-fix-visual {
  background: rgba(34, 197, 94, 0.18);         /* green */
  border-color: rgba(34, 197, 94, 0.45);
}

.waypoint-pill.procedure-fix-vfr_entry {
  background: rgba(234, 179, 8, 0.18);         /* yellow */
  border-color: rgba(234, 179, 8, 0.45);
}

/* Missed-approach portion of an IAP (legs at or after the first CA/VA/FA)
   renders in grey, matching the dashed grey missed-approach line on the
   map. Beats the kind color via rule order. */
.waypoint-pill.procedure-fix-pill.procedure-fix-missed {
  background: rgba(156, 163, 175, 0.2);        /* grey */
  border-color: rgba(156, 163, 175, 0.5);
  border-style: dashed;
  color: #d1d5db;
}

/* Tight coupling: when a collapsed procedure pill sits adjacent to the
   airport it belongs to, render the pair as one visual pill.

   The previous two approaches had problems:
     - Different backgrounds (solid blue airport vs. semi-transparent
       procedure) meant any padding between them looked like a gap, even
       when the flex gap was already cancelled.
     - Overlapping the pills via a large negative margin put procedure
       content visually inside the airport's blue area, producing an ugly
       "ghost" artifact where the semi-transparent procedure bg blended
       with the airport bg underneath.

   This version: match the procedure pill's background to the airport
   pill's when coupled, drop its border on the shared edge, and separate
   the two halves with a thin translucent divider line. The result reads
   as one continuous blue pill with an internal divider rather than two
   separate pills with a gap between them. */

/* Group wrapper for coupled airport↔procedure pills. inline-flex keeps
   the coupled pair (or STAR+dest+IAP triple) on the same row — without
   this, the flex-wrap on the pill container can split the pair apart
   when the route gets wide, breaking the "one continuous pill" illusion
   that the coupled-left/right border flattening creates. */
.pill-group {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 0;
  align-items: center;
}

/* Row break inside the pill flex container — used to force arrival-side
   procedure pills (STAR/IAP/arrival-visual/arrival-VFR) onto a new visual
   row below the main enroute + airport row. Relies on the parent's
   flex-wrap: wrap; a 100%-wide zero-height element makes the flex layout
   wrap at that point. */
.pill-row-break {
  flex-basis: 100%;
  height: 0;
  margin: 0;
  padding: 0;
}

.waypoint-pill.coupled-right {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 6px;
}

.waypoint-pill.coupled-left {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-left: 6px;
  margin-left: calc(-1 * var(--spacing-xs));  /* cancel the container's flex gap */
}

/* Procedure pill coupled to an airport: adopt the airport's solid blue
   background so the two halves look continuous, and drop the 1px colored
   border entirely — the border was making the procedure pill 2px taller
   than the neighbouring airport pill. Divider between the two halves is
   an inset box-shadow instead, which doesn't affect box sizing. */
.waypoint-pill.procedure-pill.coupled-left,
.waypoint-pill.procedure-pill.coupled-right {
  background: #2563eb;
  color: white;
  border: 0;
}

/* No divider at the shared edge — the pair reads as one pill. */

/* Kind label ('SID' / 'APP') is redundant when coupled — the airport
   already pinpoints departure vs. approach context, and the procedure
   name itself (e.g. SNS3.RW31) is unambiguous. Hide it. */
.waypoint-pill.procedure-pill.coupled-left .procedure-pill-kind,
.waypoint-pill.procedure-pill.coupled-right .procedure-pill-kind {
  display: none;
}

/* Chevron + × inherit white on the blue bg. */
.waypoint-pill.procedure-pill.coupled-left .procedure-expand-btn,
.waypoint-pill.procedure-pill.coupled-right .procedure-expand-btn {
  color: rgba(255, 255, 255, 0.8);
}
.waypoint-pill.procedure-pill.coupled-left .procedure-expand-btn:hover,
.waypoint-pill.procedure-pill.coupled-right .procedure-expand-btn:hover {
  color: white;
}

/* Route drag marker */
.route-drag-marker {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.route-drag-marker-inner {
  width: 24px;
  height: 24px;
  background: #ff00ff;
  border: 2px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Drag waypoint modal styles */
.drag-waypoint-id {
  font-family: monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent-primary);
  margin-bottom: 4px;
}

.drag-waypoint-name {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.drag-waypoint-type {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.drag-waypoint-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drag-waypoint-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.drag-waypoint-option:hover {
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4), 0 0 12px rgba(59, 130, 246, 0.3);
}

.drag-waypoint-option.selected {
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.5);
}

.drag-waypoint-option-id {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.drag-waypoint-option-type {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

/* Leg info between pills */
.waypoint-pill-leg {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  padding: 0 4px;
}

/* Inline input field */
.route-inline-input {
  flex: 1;
  min-width: 120px;
  border: none;
  background: transparent;
  outline: none;
  font-family: monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--color-text-primary);
  caret-color: var(--color-text-primary);
  padding: 4px 0;
}

.route-inline-input::placeholder {
  color: var(--color-text-secondary);
  text-transform: none;
  font-size: 0.8rem;
}

.route-inline-input.not-found {
  animation: shake 0.3s ease-in-out;
  color: #ef4444;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.route-builder-summary {
  padding: 0;
  background: transparent;
}
.route-builder-summary .rb-section-body {
  padding: var(--spacing-sm) var(--spacing-md);
}

/* Summary section: one row per metric, label on left (muted) + value on
   right (bold mono). Uses the same typography vocabulary as .rb-field-row
   but with a divider between rows to feel like a readout list. */
.route-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--spacing-sm);
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.85rem;
}

.route-summary-row:last-child {
  border-bottom: none;
}

.route-summary-label {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.route-summary-value {
  color: var(--color-text-primary);
  font-family: monospace;
  font-weight: 600;
  font-size: 0.9rem;
  text-align: right;
  flex: 1;
  min-width: 0;
}

/* Terrain Profile */
.terrain-profile-section {
  padding: 0;
}
.terrain-profile-section .rb-section-body {
  padding: var(--spacing-sm) var(--spacing-sm) var(--spacing-xs);
}
.terrain-profile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-xs);
  margin-bottom: var(--spacing-xs);
  flex-wrap: wrap;
}
.terrain-profile-stats {
  display: flex;
  gap: var(--spacing-sm);
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  flex-wrap: wrap;
}
.terrain-profile-stats strong {
  font-weight: 600;
  color: var(--color-text-primary);
}
.terrain-profile-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}
.terrain-profile-controls select {
  font-size: 0.75rem;
  padding: 1px 4px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  cursor: pointer;
}
.terrain-profile-chart {
  display: flex;
  align-items: stretch;
  gap: 0;
}
#terrain-profile-canvas {
  flex: 1;
  min-width: 0;
  cursor: crosshair;
  border-radius: 4px;
}
.tp-altitude-slider {
  position: relative;
  width: 30px;
  flex-shrink: 0;
  cursor: ns-resize;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.tp-slider-track {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  top: 10px;
  bottom: 30px;
  background: var(--color-border, #ccc);
  border-radius: 2px;
}
.tp-slider-thumb {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 12px;
  border-radius: 3px;
  background: var(--color-text-secondary, #666);
  cursor: ns-resize;
  touch-action: none;
}
.tp-map-marker {
  width: 14px;
  height: 14px;
  background: rgba(139, 92, 42, 0.9);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
/* Procedure altitude constraint label with FAA-chart over/underlines.
   Combining marks (U+0305/U+0332) strip out of MapLibre's SDF glyph
   pipeline, so we overlay real DOM. Styled to match SDF fix labels:
   white bold with black halo. CSS text-decoration gives a continuous
   underline/overline (combining chars render as per-digit segments). */
.procedure-alt-marker {
  color: #fff;
  font: 700 11px/1.1 "Open Sans", sans-serif;
  text-align: center;
  text-shadow:
    -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000,
    -1.5px 1.5px 0 #000,  1.5px 1.5px 0 #000,
    0 -1.5px 0 #000, 0 1.5px 0 #000,
    -1.5px 0 0 #000, 1.5px 0 0 #000;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}
.procedure-alt-marker .alt-under {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}
.procedure-alt-marker .alt-over {
  text-decoration: overline;
  text-decoration-thickness: 1.5px;
}
.procedure-alt-marker .alt-both {
  text-decoration: underline overline;
  text-decoration-thickness: 1.5px;
}
.terrain-stat-danger {
  color: var(--color-danger) !important;
}
.terrain-stat-clear {
  color: var(--color-success) !important;
}
#btn-terrain-profile.active {
  background: #3b82f6;
  color: #fff;
}

.route-summary-value.route-string {
  font-family: monospace;
  font-size: 0.75rem;
  word-break: break-all;
  max-width: 160px;
}

.route-summary-footnote {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  text-align: right;
  padding-top: 2px;
}

/* Route Suggestions */
.route-suggestions {
}

.route-suggestions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-xs) var(--spacing-md);
  cursor: pointer;
  user-select: none;
}

.route-suggestions-header:hover {
  background: rgba(var(--color-border-rgb, 128, 128, 128), 0.08);
}

.route-suggestions-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.route-suggestions-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-secondary);
  transition: transform 0.15s;
}

.route-suggestions.collapsed .route-suggestions-chevron {
  transform: rotate(-90deg);
}

.route-suggestions.collapsed .route-suggestions-body {
  display: none;
}

/* Route Suggestions toolbar: tabs on the left, Max-altitude filter on
   the right. Tabs compose .rb-tab; the filter uses .rb-field-row. */
.route-suggestions-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--spacing-sm);
}

.route-suggestions-filter {
  min-height: 0;              /* override .rb-field-row default */
  padding: var(--spacing-xs) 0;
}

.route-suggestions-tabs {
  display: flex;
  gap: var(--spacing-xs);
}

.route-suggestions-list {
  max-height: 240px;
  overflow-y: auto;
  padding: var(--spacing-xs) 0;
}

.route-suggestion-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.12s ease;
}

.route-suggestion-item:last-child {
  border-bottom: none;
}

.route-suggestion-item:hover {
  background: var(--color-bg-secondary);
}

.route-suggestion-route {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--color-text-primary);
  word-break: break-all;
  line-height: 1.3;
}

.route-suggestion-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.route-suggestion-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
}

.route-suggestion-badge.count {
  background: rgba(var(--color-primary-rgb, 59, 130, 246), 0.15);
  color: var(--color-primary);
}

.route-suggestion-badge.altitude {
  background: rgba(128, 128, 128, 0.15);
  color: var(--color-text-secondary);
}

.route-suggestion-badge.type-tec {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.route-suggestion-badge.type-l,
.route-suggestion-badge.type-lsd,
.route-suggestion-badge.type-sld {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.route-suggestion-badge.type-h,
.route-suggestion-badge.type-hsd,
.route-suggestion-badge.type-shd {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.route-suggestions-loading,
.route-suggestions-empty {
  padding: var(--spacing-md);
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.route-suggestions-error {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.78rem;
  color: var(--color-danger);
}

/* Route suggestions in flight plan modal */
.fp-route-suggestions {
  margin-bottom: var(--spacing-md);
}

.fp-route-suggestions .route-suggestions {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}

.fp-route-suggestions .route-suggestions-list {
  max-height: 200px;
}

.route-suggestion-search-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  background: #6b7280;
  border: 1px solid #6b7280;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.route-suggestion-search-btn:hover {
  background: #4b5563;
  border-color: #4b5563;
}
.route-suggestion-search-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.route-suggestions-empty {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding: var(--spacing-sm) 0;
}


/* Filter tabs — horizontal tab bar for section switching */
.filter-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pills--equal .filter-pill {
  flex: 1;
  text-align: center;
}

.filter-pill {
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 0;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  font-family: inherit;
  white-space: nowrap;
  margin-bottom: -1px;
}

.filter-pill:hover {
  background: none;
  color: var(--color-text-primary);
}

.filter-pill.active {
  background: none;
  color: var(--color-accent-primary);
  border-bottom-color: var(--color-accent-primary);
  font-weight: 600;
}

/* Route aircraft select */
.route-aircraft-typeahead {
  margin-top: var(--spacing-xs);
}
.route-aircraft-select {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 0.8125rem;
  padding: 4px 8px;
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.route-aircraft-select:focus {
  outline: none;
  border-color: var(--color-accent-primary);
}
.route-aircraft-typeahead-dropdown {
  position: fixed;
  z-index: 10001;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 250px;
  overflow-y: auto;
  margin-top: 4px;
}

/* NavLog toggle in route builder */
.route-navlog-toggle {
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.route-navlog-toggle:hover {
  color: var(--color-text-primary);
}

/* NavLog type-defaults warning */
.navlog-type-defaults-warning {
  font-size: 0.875rem;
  color: #92690a;
  background: #fef3cd;
  border: 1px solid #eed079;
  border-radius: 4px;
  padding: 4px 8px;
  margin-bottom: 4px;
}

/* NavLog performance inputs */
.navlog-perf {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  font-size: 0.875rem;
  color: var(--color-text-tertiary);
  padding: 4px 0 2px;
}
.navlog-perf-item strong {
  color: var(--color-text-secondary);
  font-weight: 600;
}

/* NavLog summary */
.navlog-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.9375rem;
  padding: 6px 0;
}
.navlog-summary-item {
  color: var(--color-text-secondary);
}
.navlog-summary-item strong {
  color: var(--color-text-primary);
  font-weight: 600;
}
.navlog-summary .text-muted {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
}
.navlog-cruise-config {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  padding: 0 0 4px;
}

/* NavLog table */
.navlog-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.navlog-table {
  width: auto;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
}
.navlog-table th {
  text-align: center;
  padding: 5px 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--color-bg-card, var(--color-bg-secondary));
}
.navlog-table th:first-child,
.navlog-table th:nth-child(2) {
  text-align: left;
}
.navlog-table td {
  text-align: center;
  padding: 4px 12px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.navlog-table td:first-child,
.navlog-table td:nth-child(2) {
  text-align: left;
}
.navlog-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.03);
}
.navlog-totals td {
  font-weight: 700;
  border-top: 2px solid var(--color-border);
}
.navlog-highlight-box {
  display: inline-block;
  background: var(--color-bg-secondary, #f5f5f5);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 1px 6px;
}
.navlog-reserve td {
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Fuel bar */
.fuel-bar {
  display: flex;
  height: 12px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg-secondary);
  margin: 6px 0 2px;
}
.fuel-bar-burn {
  background: var(--color-accent-primary, #3b82f6);
  transition: width 0.3s;
}
.fuel-bar-burn.fuel-bar-danger {
  background: var(--color-danger, #ef4444);
}
.fuel-bar-reserve {
  background: #f59e0b;
  transition: width 0.3s;
}
.fuel-bar-remaining {
  background: var(--color-success, #22c55e);
  transition: width 0.3s;
}
.fuel-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  padding: 0 2px;
}
.fuel-bar-label-danger {
  color: var(--color-danger, #ef4444);
  font-weight: 600;
}

/* Flight plan FOB inline layout */
.fp-fob-inline {
  padding: 6px 0 0;
}
.fp-fob-inline .form-label {
  margin-bottom: 4px;
}
.fp-fob-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fp-fob-row .form-input {
  flex: 0 0 auto;
}

/* Fuel on board selector */
.fuel-ob-row-wrap {
  margin-top: 4px;
}
.fp-fob-row .fuel-ob-row-wrap {
  margin-top: 0;
  display: contents;
}
.fp-fob-row .fuel-ob-row {
  display: contents;
}
.fuel-ob-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 0;
  flex-wrap: wrap;
}
.fuel-ob-label {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
}
.fuel-ob-selector {
  display: inline-flex;
  background: rgba(var(--color-bg-secondary-rgb, 128, 128, 128), 0.3);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.fuel-ob-btn {
  padding: 3px 10px;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.fuel-ob-btn.active {
  background: var(--color-accent-primary);
  color: white;
}
.fuel-ob-btn:hover:not(.active) {
  color: var(--color-text-primary);
}
.fuel-ob-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family);
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  outline: none;
  -moz-appearance: textfield;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.fuel-ob-input::-webkit-outer-spin-button,
.fuel-ob-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.fuel-ob-input:focus {
  border-color: var(--color-accent-primary);
  box-shadow: 0 0 0 3px #3b82f633;
}
.fuel-ob-input:hover:not(:focus) {
  border-color: var(--color-text-muted);
}
.fuel-ob-value {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  white-space: nowrap;
}

/* Mobile responsive route builder */
@media (max-width: 768px) {
  .route-builder-wrapper {
    top: 8px;
    left: 8px;
    right: 8px;
  }

  .route-builder-panel {
    width: 100%;
    max-height: 50vh;
  }

  /* Prevent iOS Safari auto-zoom on input focus (requires >= 16px) */
  .route-builder-panel input[type="text"],
  .route-builder-panel input[type="text"]::placeholder {
    font-size: 16px;
  }
}

/* ── Weight & Balance ── */
.wb-graph-container { position: relative; max-width: 360px; }
.wb-graph-canvas { width: 100%; height: auto; border-radius: var(--radius-md); }

.wb-result-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 3px 0;
  font-size: 0.85rem;
}
.wb-result-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wb-result-dot.in-limits { background: var(--color-success); }
.wb-result-dot.out-of-limits { background: var(--color-danger); }
.wb-warning { color: var(--color-danger); font-weight: 600; }

.wb-station-table { width: 100%; }
.wb-station-row {
  display: flex;
  gap: var(--spacing-xs);
  align-items: center;
  margin-bottom: 2px;
}
.wb-station-input { width: 70px; }

/* ── W&B Tab (Hangar) ── */
.wb-tab-container {
  max-width: 480px;
  padding: var(--spacing-lg) var(--spacing-xl);
  height: 100%;
  overflow-y: auto;
}

.wb-tab-warning {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.825rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-md);
}

.wb-fuel-range {
  width: 100%;
  height: 28px;
  cursor: pointer;
  accent-color: var(--color-accent-primary);
}

.wb-fuel-display {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: var(--spacing-xs) 0;
}

.wb-fuel-details {
  display: flex;
  gap: var(--spacing-md);
}
.wb-fuel-details .form-group {
  flex: 1;
}

.wb-payload-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

@media (max-width: 400px) {
  .wb-payload-grid {
    grid-template-columns: 1fr;
  }
}

.fp-dep-cal-btn {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.fp-dep-cal-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.fp-help-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 50%;
  background: var(--color-text-muted, #aaa);
  color: #fff;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 2px;
  text-decoration: none;
}

.fp-help-link:hover {
  background: var(--color-primary);
}

.fp-field18-help {
  margin: 0;
}

.fp-field18-help dt {
  font-weight: 700;
  font-family: monospace;
  font-size: 0.9em;
  color: var(--color-primary, #3b82f6);
  margin-top: 8px;
}

.fp-field18-help dd {
  margin: 2px 0 0 0;
  padding-left: 0;
}

.fp-required::after {
  content: ' *';
  color: var(--color-danger, #ef4444);
  font-weight: normal;
}

/* Express mode — hide optional fields */
#flight-plan-form.fp-express-mode [data-fp-express="hide"] {
  display: none !important;
}

.fp-express-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  user-select: none;
}

.fp-express-label {
  line-height: 1.3;
}

.fp-express-track {
  position: relative;
  width: 32px;
  height: 18px;
  background: var(--color-border);
  border-radius: 9px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.fp-express-toggle input:checked + .fp-express-track {
  background: var(--color-primary, #3b82f6);
}

.fp-express-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.fp-express-toggle input:checked + .fp-express-track::after {
  transform: translateX(14px);
}

.fp-express-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.fp-calc-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--color-success-bg, #dcfce7);
  color: var(--color-success, #16a34a);
  vertical-align: middle;
  margin-left: 4px;
}

.fp-calc-badge:empty {
  display: none;
}

.fp-calc-badge.manual {
  background: var(--color-info-bg, #eff6ff);
  color: var(--color-info, #3b82f6);
}

.fp-calc-reset {
  font-size: 0.65rem;
  color: var(--color-info, #3b82f6);
  cursor: pointer;
  margin-left: 4px;
  text-decoration: underline;
}

.fp-quick-time-group {
  display: flex;
  gap: 0;
  background: var(--color-bg-secondary, #e5e5e5);
  border-radius: 9999px;
  padding: 2px;
  flex: none;
}

.fp-quick-time-btn {
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  border: none;
  border-radius: 9999px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.fp-quick-time-btn:hover {
  color: var(--color-text-primary);
  background: rgba(var(--color-bg-secondary-rgb, 128, 128, 128), 0.3);
}

/* ── Download Status Bar (global, native-only) ── */
.dl-status-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: #0f1d36;
  color: #fff;
  cursor: pointer;
  /* Hide state: opacity+pointer-events rather than transform. A
     transform-based slide-down doesn't work when the bar has a non-zero
     `bottom` offset (e.g. phone dock at bottom:83px) — translateY(100%)
     only moves the bar by its own height, leaving it stuck on top of
     the tab bar. Opacity + pointer-events is unconditional. */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* Immediate tap response — no 300ms delay, no scroll misinterpretation */
  touch-action: manipulation;
}

/* On native phone, dock above the bottom tab bar so nav buttons stay
   reachable. Tabbar already handles the safe-area inset, so the status
   bar no longer needs its own. !important defends against stray rules
   in phone.css that set bottom with !important for other components. */
html.native-phone .dl-status-bar {
  bottom: calc(var(--phone-tabbar-height) + env(safe-area-inset-bottom, 0px)) !important;
  padding-bottom: 0 !important;
}

.dl-status-bar--visible {
  opacity: 1;
  pointer-events: auto;
}

.dl-status-bar__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: env(safe-area-inset-bottom);
  width: 0;
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.35), rgba(22, 163, 74, 0.55));
  transition: width 0.6s ease;
  pointer-events: none;
}

.dl-status-bar__inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 500;
}

.dl-status-bar__icon {
  flex-shrink: 0;
  color: #60a5fa;
  animation: dl-bar-pulse 1.6s ease-in-out infinite;
}

@keyframes dl-bar-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.dl-status-bar__text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-status-bar__percent {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: #93c5fd;
  font-weight: 600;
}

.dl-status-bar__cancel {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: 2px;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* Visible 30px; effective hit box ~50px so the bar stays thin without
   sacrificing tap forgiveness. */
.dl-status-bar__cancel::before {
  content: "";
  position: absolute;
  top: -10px; right: -10px; bottom: -10px; left: -10px;
}
.dl-status-bar__cancel:hover { background: rgba(239, 68, 68, 0.4); }
.dl-status-bar__cancel:active { background: rgba(239, 68, 68, 0.7); }

@media (hover: hover) {
  .dl-status-bar:hover { background: #1b2a4a; }
}
.dl-status-bar:active { background: #1b2a4a; }

/* Map page: offline-no-tiles overlay */
.map-offline-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 28px;
  background: rgba(15, 29, 54, 0.92);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  text-align: center;
  max-width: 360px;
  z-index: 50;
  pointer-events: auto;
}
.map-offline-empty > svg {
  width: 40px;
  height: 40px;
  color: #f59e0b;
}
.map-offline-empty__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.map-offline-empty__close:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.map-offline-empty__close:active { background: rgba(255, 255, 255, 0.14); }
.map-offline-empty__close svg { color: inherit; }
.map-offline-empty__title {
  font-size: 1.05rem;
  font-weight: 600;
}
.map-offline-empty__desc {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #cbd5e1;
}
.map-offline-empty__actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
.map-offline-empty__actions a,
.map-offline-empty__actions button {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.map-offline-empty__actions a {
  background: #3b82f6;
  color: #fff;
}
.map-offline-empty__actions a:active { background: #2563eb; }
.map-offline-empty__ok {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.map-offline-empty__ok:hover { background: rgba(255, 255, 255, 0.18); }
.map-offline-empty__ok:active { background: rgba(255, 255, 255, 0.24); }
