/* ================================================================
   ORION Observatory — Flight Plan
   Day-strip top bar for navigation + a collapsible week-timeline
   (week > day > task row) as the sole body. Status (not track) owns
   color, via a left rail on each row — track is a text column, not a
   color, so 6 tracks don't compete with the single-accent (`pr`)
   theme's one accent.
   ================================================================ */

/* ── Orbit selector ── */
#view-flight-plan .fp-plan-select {
  position: relative;
  margin-bottom: var(--sp-4);
  padding: var(--sp-4);
  border: 1px solid var(--hair);
  border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 92% 0%, rgba(var(--glow), 0.11), transparent 38%),
    var(--glass-bg);
  overflow: hidden;
}

#view-flight-plan .fp-plan-select::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: radial-gradient(circle, currentColor 0 0.6px, transparent 0.8px);
  background-size: 24px 24px;
  color: var(--faint);
  mask-image: linear-gradient(to left, black, transparent 70%);
}

#view-flight-plan .fp-plan-select__copy,
#view-flight-plan .fp-plan-select__options,
#view-flight-plan .fp-start-date,
#view-flight-plan .fp-plan-select__note,
#view-flight-plan .fp-plan-select__error {
  position: relative;
  z-index: 1;
}

#view-flight-plan .fp-start-date {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, auto);
  gap: var(--sp-2) var(--sp-4);
  align-items: end;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--hair);
}

#view-flight-plan .fp-start-date__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#view-flight-plan .fp-start-date__hint,
#view-flight-plan .fp-start-date__help {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
}

#view-flight-plan .fp-start-date__controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

#view-flight-plan .fp-start-date__input {
  width: auto;
  min-width: 148px;
}

#view-flight-plan .fp-start-date__help,
#view-flight-plan .fp-start-date__error {
  grid-column: 1 / -1;
}

#view-flight-plan .fp-start-date__error {
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}

#view-flight-plan .fp-plan-select__copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
}

#view-flight-plan .fp-plan-select__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

#view-flight-plan .fp-plan-card {
  appearance: none;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
  padding: var(--sp-3);
  border: 1px solid var(--hair2);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.08);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

#view-flight-plan .fp-plan-card:hover:not(:disabled),
#view-flight-plan .fp-plan-card:focus-visible {
  border-color: var(--accent);
  background: var(--glass-bg-hover);
}

#view-flight-plan .fp-plan-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#view-flight-plan .fp-plan-card:disabled {
  cursor: wait;
  opacity: 0.72;
}

#view-flight-plan .fp-plan-card--active {
  border-color: rgba(var(--glow), 0.62);
  background: rgba(var(--glow), 0.08);
}

#view-flight-plan .fp-plan-card__signal {
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--glass-bg);
}

#view-flight-plan .fp-plan-card--active .fp-plan-card__signal {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--glow), 0.58);
}

#view-flight-plan .fp-plan-card__body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

#view-flight-plan .fp-plan-card__name {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-flight-plan .fp-plan-card__meta,
#view-flight-plan .fp-plan-card__status,
#view-flight-plan .fp-plan-select__note {
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  color: var(--faint);
}

#view-flight-plan .fp-plan-card__status {
  flex: 0 0 auto;
  color: var(--accent);
}

#view-flight-plan .fp-plan-select__note {
  margin-top: var(--sp-2);
}

#view-flight-plan .fp-plan-select__error {
  margin-top: var(--sp-2);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}

/* Durable task-mutation state. Kept outside the task rows so a queued change
   remains visible even after its week is collapsed or the user switches days. */
#view-flight-plan .fp-sync-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  margin: 0 0 var(--sp-3);
  padding: 4px 10px;
  border: 1px solid var(--hair2);
  border-radius: var(--r-full);
  color: var(--muted);
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
}

#view-flight-plan .fp-sync-state__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

#view-flight-plan .fp-sync-state--saved {
  color: var(--accent);
}

#view-flight-plan .fp-sync-state--saving .fp-sync-state__dot {
  color: var(--accent);
  animation: fp-sync-pulse 1.1s ease-in-out infinite;
}

#view-flight-plan .fp-sync-state--offline .fp-sync-state__dot {
  background: transparent;
  border: 1px solid currentColor;
}

#view-flight-plan .fp-sync-state--error {
  color: var(--text);
  border-style: dashed;
}

#view-flight-plan .fp-sync-state--storage_error {
  color: var(--danger, #c2413b);
  border-style: dashed;
}

@keyframes fp-sync-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.72); }
}

@media (prefers-reduced-motion: reduce) {
  #view-flight-plan .fp-sync-state--saving .fp-sync-state__dot {
    animation: none;
  }
}

#view-flight-plan .fp-topbar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

#view-flight-plan .fp-topbar .fp-daystrip-wrap {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

#view-flight-plan .fp-today-btn {
  flex: 0 0 auto;
}

/* ── Search and filters ── */
#view-flight-plan .fp-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(150px, 0.75fr) minmax(140px, 0.65fr) auto auto auto;
  align-items: end;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  padding: var(--sp-3);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  background: var(--glass-bg);
}

#view-flight-plan .fp-filter-search,
#view-flight-plan .fp-filter-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

#view-flight-plan .fp-filter-search label,
#view-flight-plan .fp-filter-field label {
  color: var(--faint);
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  text-transform: uppercase;
}

#view-flight-plan .fp-filter-revisit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

#view-flight-plan .fp-filter-revisit:has(input:checked) {
  color: var(--accent);
}

#view-flight-plan .fp-filter-result {
  align-self: center;
  color: var(--faint);
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  white-space: nowrap;
}

#view-flight-plan .fp-filter-empty {
  padding: 36px 22px;
  text-align: center;
}

#view-flight-plan .fp-filter-empty p {
  margin: 8px 0 var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ── Day strip ── */
#view-flight-plan .fp-daystrip-wrap {
  position: relative;
  margin-bottom: var(--sp-4);
}

#view-flight-plan .fp-daystrip {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding: var(--sp-2) var(--sp-1) var(--sp-3);
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

#view-flight-plan .fp-daystrip::-webkit-scrollbar {
  height: 5px;
}
#view-flight-plan .fp-daystrip::-webkit-scrollbar-thumb {
  background: var(--hair2);
  border-radius: var(--r-full);
}

#view-flight-plan .fp-daycell {
  flex: 0 0 auto;
  width: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 0 4px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
}

#view-flight-plan .fp-daycell:hover {
  background: var(--glass-bg-hover);
}

#view-flight-plan .fp-daycell__num {
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  color: var(--faint);
}

#view-flight-plan .fp-daycell--warmup .fp-daycell__num {
  color: var(--muted);
  font-style: italic;
}

#view-flight-plan .fp-daycell__fill {
  width: 18px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--hair2);
  overflow: hidden;
}
#view-flight-plan .fp-daycell__fill span {
  display: block;
  height: 100%;
  background: var(--accent);
  opacity: 0.7;
}

#view-flight-plan .fp-daycell--today {
  border-color: var(--accent);
  background: rgba(var(--glow), 0.08);
}
#view-flight-plan .fp-daycell--today .fp-daycell__num {
  color: var(--accent);
  font-weight: 700;
}

#view-flight-plan .fp-daycell--current {
  background: var(--glass-bg-hover);
}

#view-flight-plan .fp-daycell--phase-start {
  border-left: 2px solid var(--hair2);
  margin-left: 4px;
  padding-left: 4px;
}

/* ── Task rows ── */
#view-flight-plan .fp-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-2);
  border-radius: var(--r-sm);
  border-bottom: 1px solid var(--hair);
  position: relative;
}

#view-flight-plan .fp-row:last-child {
  border-bottom: none;
}

#view-flight-plan .fp-row__rail {
  flex: 0 0 3px;
  width: 3px;
  align-self: stretch;
  border-radius: var(--r-full);
  background: transparent;
  margin-top: 2px;
}
#view-flight-plan .fp-row--in_progress .fp-row__rail { background: var(--accent); }
#view-flight-plan .fp-row--blocked .fp-row__rail { background: rgba(255,255,255,0.35); }
#view-flight-plan .fp-row--done .fp-row__rail { background: var(--hair2); }

#view-flight-plan .fp-row__track {
  flex: 0 0 34px;
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  color: var(--faint);
  padding-top: 6px;
  text-align: left;
}

#view-flight-plan .fp-row__main {
  flex: 1;
  min-width: 0;
}

#view-flight-plan .fp-row__top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

#view-flight-plan .fp-row__expand {
  appearance: none;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#view-flight-plan .fp-row__expand:focus-visible,
#view-flight-plan .fp-revisit-flag:focus-visible,
#view-flight-plan .fp-week__head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#view-flight-plan .fp-revisit-flag {
  appearance: none;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--hair2);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  text-transform: uppercase;
}

#view-flight-plan .fp-revisit-flag:hover,
#view-flight-plan .fp-revisit-flag--active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(var(--glow), 0.08);
}

#view-flight-plan .fp-row__title {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-flight-plan .fp-row--done .fp-row__title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--hair2);
  font-weight: 500;
}

#view-flight-plan .fp-row--deferred .fp-row__title {
  color: var(--faint);
  font-style: italic;
}

#view-flight-plan .fp-row__minutes {
  flex: 0 0 auto;
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  color: var(--faint);
}

#view-flight-plan .fp-row__now {
  flex: 0 0 auto;
}

#view-flight-plan .fp-row__chevron {
  flex: 0 0 auto;
  color: var(--faint);
  display: flex;
  transition: transform var(--t-fast) var(--ease-out);
}
#view-flight-plan .fp-row--expanded .fp-row__chevron {
  transform: rotate(90deg);
  color: var(--text);
}

#view-flight-plan .fp-row__detail {
  margin-top: var(--sp-2);
  padding-left: 2px;
}

#view-flight-plan .fp-row__desc {
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
  margin-bottom: var(--sp-2);
}

#view-flight-plan .fp-row__done-means {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: var(--glass-bg);
  border: 1px solid var(--hair);
  margin-bottom: var(--sp-2);
}

#view-flight-plan .fp-row__blocked-note {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: var(--sp-2);
}

#view-flight-plan .task-block-reason {
  display: flex;
  align-items: end;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}

#view-flight-plan .task-block-reason__label {
  flex: 1 0 100%;
  color: var(--muted);
  font-size: var(--fs-sm);
}

#view-flight-plan .task-block-reason__input {
  flex: 1 1 260px;
}

#view-flight-plan .task-block-reason-error {
  display: none;
  margin-top: 6px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}

#view-flight-plan .fp-row__actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ── Content refs (Task 4 — Flight Plan content links) ── */
#view-flight-plan .fp-row__content-tag {
  flex: 0 0 auto;
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  color: var(--faint);
  white-space: nowrap;
}

#view-flight-plan .fp-row__content-refs {
  margin-bottom: var(--sp-2);
}

#view-flight-plan .fp-resource-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: 6px;
  color: var(--faint);
  font-size: var(--fs-xs, 12px);
}

#view-flight-plan .fp-resource-details {
  margin: var(--sp-2) 0;
  padding: 0 var(--sp-2);
  border-left: 1px solid var(--hair2);
}

#view-flight-plan .fp-resource-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 7px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-sm);
  list-style: none;
}

#view-flight-plan .fp-resource-details > summary::-webkit-details-marker { display: none; }
#view-flight-plan .fp-resource-details > summary::before { content: '＋'; color: var(--accent); }
#view-flight-plan .fp-resource-details[open] > summary::before { content: '−'; }
#view-flight-plan .fp-resource-details > summary span {
  margin-left: auto;
  color: var(--faint);
  font: var(--font-telemetry);
}

#view-flight-plan .fp-resource-details .fp-resource-group {
  padding: var(--sp-2) 0;
}

#view-flight-plan .fp-content-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--sp-2);
}

#view-flight-plan .fp-content-chip {
  background: none;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
#view-flight-plan .fp-content-chip:hover,
#view-flight-plan .fp-content-chip:focus-visible {
  border-color: var(--accent);
  color: var(--text);
}

#view-flight-plan .fp-content-checklist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: var(--sp-2);
}

#view-flight-plan .fp-content-check {
  align-items: center;
  display: flex;
  gap: var(--sp-2);
}
#view-flight-plan .fp-content-check__toggle {
  flex: 1 1 auto;
  min-width: 0;
}
#view-flight-plan .fp-content-check__toggle:hover .check-row__label {
  color: var(--text);
}
#view-flight-plan .fp-content-check__toggle[aria-busy="true"] {
  opacity: 0.65;
}
#view-flight-plan .fp-content-check__open {
  flex: 0 0 auto;
}

/* Checklist row body: title+dot on one line, muted keyTopics below — the
   checklist is meant to carry different info than the chip label above it,
   not repeat it (Fable review, 2026-08-18). */
#view-flight-plan .fp-content-check__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}
#view-flight-plan .fp-content-check .check-row__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
#view-flight-plan .fp-content-check__title {
  min-width: 0;
  overflow-wrap: anywhere;
}
#view-flight-plan .fp-content-check__purpose {
  border: 1px solid var(--hair2);
  border-radius: var(--r-sm);
  color: var(--muted);
  flex: 0 0 auto;
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  padding: 1px 5px;
  text-transform: uppercase;
}
#view-flight-plan .fp-content-check__topics {
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#view-flight-plan .fp-content-check__error {
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-top: var(--sp-1);
}

/* Recall stays intentionally distinct from ordinary task prose: the current
   day's retrieval target is primary, while older material is one small spaced
   sample. References remain behind a disclosure until the attempt is made. */
#view-flight-plan .fp-recall {
  margin-bottom: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid rgba(var(--glow), 0.4);
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(var(--glow), 0.1), transparent 72%);
}

#view-flight-plan .fp-recall__eyebrow {
  color: var(--accent);
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
}

#view-flight-plan .fp-recall__focus {
  margin-top: 5px;
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 700;
}

#view-flight-plan .fp-recall p {
  margin: 7px 0;
  color: var(--muted);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

#view-flight-plan .fp-recall__spaced,
#view-flight-plan .fp-recall__rule {
  color: var(--muted);
  font-size: var(--fs-sm);
}

#view-flight-plan .fp-recall__rule {
  margin-top: var(--sp-2);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--hair);
  color: var(--faint);
}

/* Profile-backed annotations. Text and durable URLs are supported by the
   annotation contract; binary attachment upload is intentionally not implied. */
#view-flight-plan .fp-notes {
  margin: var(--sp-3) 0;
  padding: var(--sp-3);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.08);
}

#view-flight-plan .fp-notes__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: 32px;
  color: var(--text);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 650;
  list-style: none;
}

#view-flight-plan .fp-notes__summary::-webkit-details-marker { display: none; }
#view-flight-plan .fp-notes__summary::after {
  content: '+';
  color: var(--muted);
  font: var(--font-telemetry);
}
#view-flight-plan .fp-notes[open] > .fp-notes__summary::after { content: '\2212'; }
#view-flight-plan .fp-notes__summary > span:last-of-type {
  margin-left: auto;
  color: var(--faint);
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
}
#view-flight-plan .fp-notes__summary:focus-visible {
  border-radius: var(--r-sm);
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
#view-flight-plan .fp-notes__body { padding-top: var(--sp-2); }

#view-flight-plan .fp-notes__head,
#view-flight-plan .fp-notes__foot {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  align-items: center;
}

#view-flight-plan .fp-notes__head {
  margin-bottom: 7px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 650;
}

#view-flight-plan .fp-notes__head span,
#view-flight-plan .fp-notes__foot {
  color: var(--faint);
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
}

#view-flight-plan .fp-notes__input {
  box-sizing: border-box;
  width: 100%;
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}

#view-flight-plan .fp-notes__foot {
  align-items: flex-start;
  margin-top: 7px;
}

#view-flight-plan .fp-notes__foot > span {
  max-width: 68ch;
  line-height: 1.45;
}

#view-flight-plan .fp-notes__error {
  margin-top: 6px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}

#view-flight-plan .fp-note-preview {
  width: min(760px, calc(100vw - 32px));
  max-height: min(82vh, 760px);
  padding: 0;
  border: 1px solid var(--hair);
  border-radius: var(--r-lg);
  color: var(--text);
  background: var(--bg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}
#view-flight-plan .fp-note-preview::backdrop { background: rgba(0, 0, 0, 0.6); }
#view-flight-plan .fp-note-preview__surface { display: flex; flex-direction: column; max-height: min(82vh, 760px); padding: clamp(18px, 4vw, 30px); }
#view-flight-plan .fp-note-preview__head,
#view-flight-plan .fp-note-preview__actions { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
#view-flight-plan .fp-note-preview__head { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--hair); }
#view-flight-plan .fp-note-preview__head h2 { margin: 3px 0 0; font-size: var(--fs-lg); }
#view-flight-plan .fp-note-preview__eyebrow { margin: 0; color: var(--faint); font: var(--font-telemetry); letter-spacing: var(--ls-telemetry); }
#view-flight-plan .fp-note-preview__content { overflow: auto; padding: var(--sp-4) 2px; color: var(--muted); font-size: var(--fs-base); line-height: 1.65; }
#view-flight-plan .fp-note-preview__content > :first-child { margin-top: 0; }
#view-flight-plan .fp-note-preview__content pre { overflow-x: auto; padding: 12px; border: 1px solid var(--hair); border-radius: var(--r-sm); }
#view-flight-plan .fp-note-preview__content a { color: var(--text); text-underline-offset: 3px; }
#view-flight-plan .fp-note-preview__content :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#view-flight-plan .fp-note-preview__actions { justify-content: flex-end; padding-top: var(--sp-3); border-top: 1px solid var(--hair); }

#view-flight-plan .fp-attachments { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--hair); }
#view-flight-plan .fp-attachments__head,
#view-flight-plan .fp-attachments__file,
#view-flight-plan .fp-attachments__actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
#view-flight-plan .fp-attachments__head { justify-content: space-between; font-size: var(--fs-sm); }
#view-flight-plan .fp-attachments__help,
#view-flight-plan .fp-attachments__empty { color: var(--faint); font-size: var(--fs-sm); line-height: 1.5; margin: 8px 0; }
#view-flight-plan .fp-attachments__list { list-style: none; padding: 0; margin: 0 0 8px; }
#view-flight-plan .fp-attachments__file { padding: 10px 0; border-bottom: 1px solid var(--hair); }
#view-flight-plan .fp-attachments__info { flex: 1 1 180px; min-width: 0; }
#view-flight-plan .fp-attachments__name { display: block; overflow-wrap: anywhere; font-size: var(--fs-sm); }
#view-flight-plan .fp-attachments__info small { color: var(--faint); }
#view-flight-plan .fp-attachments button { min-height: 36px; }
@media (max-width: 600px) {
  #view-flight-plan .fp-attachments__actions { width: 100%; }
  #view-flight-plan .fp-attachments button { min-height: 44px; }
  #view-flight-plan .fp-note-preview { width: calc(100vw - 20px); }
  #view-flight-plan .fp-note-preview__surface { max-height: 88vh; padding: 18px; }
  #view-flight-plan .fp-note-preview__head { align-items: flex-start; }
}

/* Difficulty dot: opacity-tiered fill of the single accent, same convention
   as .orion-chip--high/medium/low — the `pr` theme has exactly one accent,
   so this never introduces a second hue for "difficulty". */
#view-flight-plan .fp-diff-dot {
  display: inline-block;
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: transparent;
}
#view-flight-plan .fp-diff-dot--2 {
  background: rgba(255,255,255,0.35);
  border-color: rgba(255,255,255,0.35);
}
#view-flight-plan .fp-diff-dot--3 {
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Full-plan (week-grouped drill-down) ── */
#view-flight-plan .fp-week {
  margin-bottom: var(--sp-2);
}

#view-flight-plan .fp-week__head {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  cursor: pointer;
  padding: var(--sp-3);
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

#view-flight-plan .fp-week__stat {
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  color: var(--muted);
  flex-shrink: 0;
}

#view-flight-plan .fp-week__progress {
  padding: 0 var(--sp-3) var(--sp-2);
}

#view-flight-plan .fp-week__collapse {
  display: grid;
  grid-template-rows: 0fr;
  pointer-events: none;
  transition: grid-template-rows var(--t-fast) var(--ease-out);
  visibility: hidden;
}

#view-flight-plan .fp-week__collapse--open {
  grid-template-rows: 1fr;
  pointer-events: auto;
  visibility: visible;
}

#view-flight-plan .fp-week__collapse-inner {
  overflow: hidden;
  min-height: 0;
}

#view-flight-plan .fp-week__days {
  padding: 0 var(--sp-3) var(--sp-3);
}

#view-flight-plan .fp-daygroup {
  margin-bottom: var(--sp-2);
}

#view-flight-plan .fp-daygroup__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#view-flight-plan .fp-daygroup__head .t-eyebrow {
  flex: 1;
  min-width: 0;
}

#view-flight-plan .fp-daygroup__head .fp-row__chevron {
  transition: transform var(--t-fast) var(--ease-out);
}

#view-flight-plan .fp-daygroup__head[aria-expanded="true"] .fp-row__chevron {
  transform: rotate(90deg);
  color: var(--text);
}

#view-flight-plan .fp-daygroup__head:focus-visible {
  border-radius: var(--r-sm);
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

#view-flight-plan .fp-daygroup__stat {
  font: var(--font-telemetry);
  letter-spacing: var(--ls-telemetry);
  color: var(--muted);
  flex-shrink: 0;
}

#view-flight-plan .fp-daygroup__progress {
  margin-bottom: var(--sp-2);
}

#view-flight-plan .fp-daygroup__collapse {
  display: grid;
  grid-template-rows: 0fr;
  pointer-events: none;
  transition: grid-template-rows var(--t-fast) var(--ease-out);
  visibility: hidden;
}

#view-flight-plan .fp-daygroup__collapse--open {
  grid-template-rows: 1fr;
  pointer-events: auto;
  visibility: visible;
}

#view-flight-plan .fp-daygroup__collapse-inner {
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 640px) {
  #view-flight-plan .fp-plan-select { padding: var(--sp-3); }
  #view-flight-plan .fp-plan-select__copy { align-items: flex-start; flex-direction: column; gap: var(--sp-1); }
  #view-flight-plan .fp-plan-select__options { grid-template-columns: 1fr; }
  #view-flight-plan .fp-plan-card__name { white-space: normal; }
  #view-flight-plan .fp-start-date { grid-template-columns: 1fr; }
  #view-flight-plan .fp-start-date__controls { justify-content: flex-start; }
  #view-flight-plan .fp-start-date__help,
  #view-flight-plan .fp-start-date__error { grid-column: 1; }
  #view-flight-plan .fp-filters { grid-template-columns: 1fr 1fr; }
  #view-flight-plan .fp-filter-search { grid-column: 1 / -1; }
  #view-flight-plan .fp-row__track { flex-basis: 26px; font-size: 9px; }
  #view-flight-plan .fp-row--expanded {
    display: grid;
    grid-template-columns: 3px 26px 20px minmax(0, 1fr);
    column-gap: var(--sp-2);
  }
  #view-flight-plan .fp-row--expanded > .fp-row__rail { grid-column: 1; grid-row: 1; }
  #view-flight-plan .fp-row--expanded > .fp-row__track { grid-column: 2; grid-row: 1; }
  #view-flight-plan .fp-row--expanded > .check-row { grid-column: 3; grid-row: 1; }
  #view-flight-plan .fp-row--expanded > .fp-row__main { display: contents; }
  #view-flight-plan .fp-row--expanded .fp-row__top {
    grid-column: 4;
    grid-row: 1;
    min-width: 0;
  }
  #view-flight-plan .fp-row__top { align-items: flex-start; }
  #view-flight-plan .fp-row__expand { flex-wrap: wrap; }
  #view-flight-plan .fp-row__content-tag { display: none; }
  #view-flight-plan .fp-revisit-flag span:last-child { display: none; }
  #view-flight-plan .fp-row--expanded .fp-row__detail {
    box-sizing: border-box;
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
  }
  #view-flight-plan .fp-content-chip {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: left;
    white-space: normal;
  }
  #view-flight-plan .fp-content-check .check-row__label { flex-wrap: wrap; }
  #view-flight-plan .fp-notes__foot { flex-direction: column; }
  #view-flight-plan .fp-notes__foot button { align-self: stretch; }
}

@media (min-width: 641px) and (max-width: 980px) {
  #view-flight-plan .fp-filters { grid-template-columns: minmax(220px, 1fr) 1fr 1fr; }
  #view-flight-plan .fp-filter-revisit,
  #view-flight-plan .fp-filter-result { align-self: center; }
}

/* ── Persistent timer bar (Task 3 — time tracking) ──
   Owned by timer.js, not this view — it's pinned above the sidebar/nav and
   visible across every view while a timer runs, so it lives at the top of
   the cascade (no #view-flight-plan scope) rather than inside this file's
   view-scoped rules above. flight-plan.css is still the right file since the
   bar only exists because of this feature. `body.has-orion-timer-bar` is the
   single toggle that both shows the bar and shifts the sidebar/app-shell
   down by its height — see layout.css's own two rules for the other half of
   this contract (sidebar `top` + `.app-shell` height/margin). */
:root {
  --timer-bar-h: 40px;
}

.orion-timer-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--timer-bar-h);
  z-index: calc(var(--z-sidebar) + 5);
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  background: var(--accent);
  color: var(--bg);
  font: var(--font-action);
  letter-spacing: var(--ls-action);
}

body.has-orion-timer-bar .orion-timer-bar {
  display: flex;
}

.orion-timer-bar__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bg);
  flex: 0 0 auto;
  animation: orion-timer-bar-pulse 1.6s ease-in-out infinite;
}

@keyframes orion-timer-bar-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.orion-timer-bar__label {
  flex: 0 0 auto;
  opacity: 0.8;
}

.orion-timer-bar__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
}

.orion-timer-bar__elapsed {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.orion-timer-bar__pause {
  flex: 0 0 auto;
  border: 1px solid var(--bg);
  border-radius: 8px;
  background: transparent;
  color: var(--bg);
  cursor: pointer;
  font: var(--font-action);
  letter-spacing: var(--ls-action);
  padding: 5px 12px;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .orion-timer-bar {
    padding: 0 var(--sp-2);
    gap: var(--sp-1);
  }
  .orion-timer-bar__label {
    display: none;
  }
}

/* Day-one editing is secondary to the saved schedule summary. */
#view-flight-plan .fp-date-options { position: relative; margin-top: var(--sp-3); padding-top: var(--sp-2); border-top: 1px solid var(--hair); min-width: 0; }
#view-flight-plan .fp-date-options > summary { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); min-height: 44px; cursor: pointer; list-style: none; font: var(--font-body); overflow-wrap: anywhere; }
#view-flight-plan .fp-date-options > summary::-webkit-details-marker { display: none; }
#view-flight-plan .fp-date-end { display: block; color: var(--muted); font-size: var(--fs-sm); margin-top: 4px; }
#view-flight-plan .fp-date-options .fp-start-date { border: 0; padding-top: 0; }
#view-flight-plan .fp-start-date__input { box-sizing: border-box; height: 44px; padding: 8px 12px; min-width: 0; max-width: 100%; }
#view-flight-plan .fp-start-date__controls .orion-action { min-height: 44px; }
#view-flight-plan .fp-filters { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
#view-flight-plan .fp-filters .orion-input { box-sizing: border-box; height: 44px; min-width: 0; max-width: 100%; padding: 8px 12px; }
#view-flight-plan .fp-filters .cert-field { gap: 5px; }
#view-flight-plan .fp-filters .cert-field label { color: var(--faint); font: var(--font-telemetry); letter-spacing: var(--ls-telemetry); text-transform: uppercase; }
@media (max-width: 640px) {
  #view-flight-plan .fp-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view-flight-plan .fp-start-date__controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  #view-flight-plan .fp-start-date__input { grid-column: 1 / -1; width: 100%; }
  #view-flight-plan .fp-plan-card__body { min-width: 0; }
  #view-flight-plan .fp-plan-card__name, #view-flight-plan .fp-row__title { overflow-wrap: anywhere; }
}
@media (max-width: 380px) { #view-flight-plan .fp-filters { grid-template-columns: minmax(0, 1fr); } }

/* Optional practice stays outside task progress and starts collapsed. */
#view-flight-plan .fp-practice { margin: 12px; }
#view-flight-plan .fp-practice > summary { flex-wrap: wrap; }
#view-flight-plan .fp-practice__body { padding: 0 12px 12px; font-size: var(--fs-sm); line-height: 1.6; overflow-wrap: anywhere; }
#view-flight-plan .fp-practice__body p { margin: 10px 0; }
#view-flight-plan .fp-practice__access { color: var(--muted); }
#view-flight-plan .fp-practice__body a { color: var(--accent); }

#view-flight-plan .fp-supplements {
  display: grid;
  gap: 8px;
  margin: 12px;
}
#view-flight-plan .fp-supplement {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--border) 78%, var(--accent));
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, var(--accent));
}
#view-flight-plan .fp-supplement--done { opacity: .78; }
#view-flight-plan .fp-supplement__check { padding-top: 3px; }
#view-flight-plan .fp-supplement__input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
#view-flight-plan .fp-supplement__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
#view-flight-plan .fp-supplement__input:disabled { cursor: wait; }
#view-flight-plan .fp-supplement__content { min-width: 0; }
#view-flight-plan .fp-supplement__label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; cursor: pointer; }
#view-flight-plan .fp-supplement__kind {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
#view-flight-plan .fp-supplement__title { color: var(--text); font-weight: 650; }
#view-flight-plan .fp-supplement__criterion { margin: 7px 0 9px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; }
#view-flight-plan .fp-supplement__footer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
#view-flight-plan .fp-supplement__minutes { color: var(--muted); font-family: var(--font-mono); font-size: var(--fs-xs); }
#view-flight-plan .fp-supplement__links { display: flex; flex-wrap: wrap; gap: 5px 12px; flex: 1 1 280px; }
#view-flight-plan .fp-supplement__links a { color: var(--accent); font-size: var(--fs-sm); overflow-wrap: anywhere; }
#view-flight-plan .fp-supplement__save { color: var(--muted); font-size: var(--fs-xs); }
#view-flight-plan .fp-supplement__save--failed { color: var(--danger); font-weight: 700; }

#view-flight-plan .fp-supplement-deck {
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 96%, var(--accent));
}
#view-flight-plan .fp-supplement-deck > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  cursor: pointer;
  list-style-position: inside;
}
#view-flight-plan .fp-supplement-deck > summary > span:first-child {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}
#view-flight-plan .fp-supplement-deck__meta,
#view-flight-plan .fp-supplement-deck__result {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
}
#view-flight-plan .fp-supplement-deck__body { padding: 0 14px 14px; }
#view-flight-plan .fp-supplement-deck__filters {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
#view-flight-plan .fp-supplement-deck__filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: var(--fs-xs);
}
#view-flight-plan .fp-supplement-deck__filters .orion-input { min-width: 170px; }
#view-flight-plan .fp-supplement-deck__result { margin: 0 0 10px auto; }
#view-flight-plan .fp-supplement-deck__list { display: grid; gap: 7px; }
#view-flight-plan .fp-supplement-deck__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, var(--accent));
  border-radius: 9px;
  background: var(--surface);
}
#view-flight-plan .fp-supplement-deck__item--done { opacity: .72; }
#view-flight-plan .fp-supplement-deck__item-main { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
#view-flight-plan .fp-supplement-deck__item-main strong { display: block; color: var(--text); font-size: var(--fs-sm); }
#view-flight-plan .fp-supplement-deck__item-main small { display: block; margin-top: 3px; color: var(--muted); }
#view-flight-plan .fp-supplement-deck__status { color: var(--accent); font-weight: 800; }
#view-flight-plan .fp-supplement-deck__actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 10px; }
#view-flight-plan .fp-supplement-deck__actions a { color: var(--accent); font-size: var(--fs-xs); overflow-wrap: anywhere; }
#view-flight-plan .fp-supplement-deck__empty { margin: 8px 0; color: var(--muted); }

@media (max-width: 560px) {
  #view-flight-plan .fp-supplements { margin: 8px; }
  #view-flight-plan .fp-supplement { grid-template-columns: 24px minmax(0, 1fr); padding: 10px; }
  #view-flight-plan .fp-supplement__label { display: grid; gap: 3px; }
  #view-flight-plan .fp-supplement__links { flex-basis: 100%; }
  #view-flight-plan .fp-supplement-deck > summary { align-items: flex-start; flex-direction: column; gap: 6px; padding: 12px; }
  #view-flight-plan .fp-supplement-deck > summary > span:first-child { align-items: flex-start; flex-direction: column; gap: 3px; }
  #view-flight-plan .fp-supplement-deck__body { padding: 0 9px 9px; }
  #view-flight-plan .fp-supplement-deck__filters { display: grid; grid-template-columns: 1fr 1fr; }
  #view-flight-plan .fp-supplement-deck__filters .orion-input { min-width: 0; width: 100%; }
  #view-flight-plan .fp-supplement-deck__result { grid-column: 1 / -1; margin: 0; }
  #view-flight-plan .fp-supplement-deck__item { align-items: stretch; flex-direction: column; gap: 8px; padding: 9px; }
  #view-flight-plan .fp-supplement-deck__actions { justify-content: flex-start; }
}
