/* ============================================================================
   frms-flights.css — the Flights list (frms-system/flights.html, 2026-09-15)
   ----------------------------------------------------------------------------
   The first page of the shared flight store. One card per flight: where it
   goes, when, who is on it, what it scored and what this user may do with it.
   Every colour is a css/tokens.css token.
   ============================================================================ */

:root {
    --text-secondary: #586576;
    --text-muted: #586576;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    min-height: 100vh;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--line);
}
.page-header-text { min-width: 0; }
.page-header-title {
    font-size: 22px;
    font-weight: var(--weight-title);
    line-height: 1.25;
    color: var(--text-heading);
}
.page-header-subtitle {
    margin-top: var(--spacing-xs);
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 72ch;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

/* ── Controls ───────────────────────────────────────────────────────── */
.flights-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}
.flight-filters,
.flight-scope {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.flight-scope[hidden] { display: none; }
.flight-filter {
    appearance: none;
    min-height: 40px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: var(--text-support);
    font-weight: 600;
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-full);
    cursor: pointer;
}
.flight-filter:hover { background: var(--wash); }
.flight-filter.is-on {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--accent);
}
.flights-count {
    margin-left: auto;
    font-size: var(--text-support);
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
}

/* ── One flight ─────────────────────────────────────────────────────── */
.flights-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}
.flight-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.flight-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--spacing-sm);
}
.flight-card-route {
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink);
}
.flight-card-when {
    margin-top: 2px;
    font-size: var(--text-support);
    color: var(--ink-muted);
}
.flight-state {
    flex: 0 0 auto;
    padding: 3px 10px;
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    border-radius: var(--radius-full);
    color: var(--ink-2);
    background: var(--wash);
    border: 1px solid var(--line);
    white-space: nowrap;
}
.flight-state-planned   { color: var(--ink-2);     background: var(--wash); }
.flight-state-active    { color: var(--accent);    background: var(--accent-soft); border-color: var(--accent-light); }
.flight-state-post_flight { color: var(--ok-ink);  background: var(--ok-bg);  border-color: var(--ok-ink); }
.flight-state-cancelled { color: var(--ink-muted); background: var(--wash); text-decoration: line-through; }

.flight-card-facts {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 4px var(--spacing-sm);
    font-size: var(--text-support);
}
.flight-card-facts > div { display: contents; }
.flight-card-facts dt {
    font-size: var(--text-label);
    font-weight: var(--weight-label);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-muted);
    padding-top: 2px;
}
.flight-card-facts dd { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }

.flight-score {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 1px 8px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.flight-score-ok   { color: var(--ok-ink);   background: var(--ok-bg); }
.flight-score-warn { color: var(--warn-ink); background: var(--warn-bg); }
.flight-score-bad  { color: var(--bad-ink);  background: var(--bad-bg); }
.flight-score-band { font-size: var(--text-label); font-weight: 600; text-transform: uppercase; letter-spacing: var(--tracking-label); }
.flight-score-note { font-size: var(--text-support); color: var(--ink-muted); }

.flight-card-note {
    font-size: var(--text-support);
    color: var(--ink-muted);
}
.flight-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-top: auto;
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--line);
}

/* ── Reviews (owner review 2026-09-26, F-4) ─────────────────────────────
   An oversight role's note on a flight and what was done; the crew read it
   here. Labels are the kit's .jf-label-caps. */
.flight-reviews {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--line);
}
.flight-reviews-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    min-height: 32px;
}
.flight-reviews-status {
    font-size: var(--text-support);
    color: var(--ink-muted);
}
.flight-review-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.flight-review {
    padding: 8px 10px;
    background: var(--wash);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}
.flight-review-meta {
    font-size: var(--text-support);
    font-weight: 600;
    color: var(--ink-2);
    overflow-wrap: anywhere;
}
.flight-review-note {
    margin-top: 2px;
    font-size: var(--text-support);
    color: var(--ink);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.flight-review-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.flight-review-label { margin-top: 4px; }
.flight-review-input {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    font-size: var(--text-support);
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
}
textarea.flight-review-input {
    min-height: 5.5rem;
    resize: vertical;
}
.flight-review-hint {
    font-size: var(--text-support);
    color: var(--ink-muted);
}
.flight-review-error {
    font-size: var(--text-support);
    font-weight: 600;
    color: var(--bad-ink);
}
.flight-review-error:empty { display: none; }
.flight-review-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

@media (max-width: 560px) {
    .container { padding: var(--spacing-md); }
    .flights-count { margin-left: 0; width: 100%; }
    .flight-card-facts { grid-template-columns: 1fr; }
    .flight-card-facts > div { display: block; margin-bottom: 6px; }
    .flight-card-actions .jf-btn,
    .flight-review-buttons .jf-btn { flex: 1 1 auto; justify-content: center; }
}
