/* ==========================================================================
   Your Crew: the crew roster (crew-roster.js), shown in Settings > Intercom.
   One card per intercom seat, and a sheet that plays and picks a voice.
   Built on the hig-theme.css tokens, so Light, Dark and Auto follow the
   appearance menu. Loaded after hig-theme.css with data-hig-skip.
   ========================================================================== */

.crew-roster { max-width: 1180px; color: var(--hig-label); font-size: 15px; line-height: 1.35; }
.crew-roster button { font: inherit; }

/* ---- Header: title and the aircraft pop-up -------------------------------- */
.cr-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 16px; }
.cr-title { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; color: var(--hig-label); }
.cr-sub { margin: 4px 0 0; font-size: 15px; color: var(--hig-label2); }
.cr-aircraft { display: flex; align-items: center; gap: 10px; }
.cr-aircraft-label { font-size: 13px; color: var(--hig-label2); }
.cr-aircraft-btn { min-height: 36px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cr-aircraft .dropdown-menu { min-width: 250px; max-height: 60vh; overflow-y: auto; }
.cr-aircraft .dropdown-item { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.cr-aircraft .dropdown-item .cr-check { width: 14px; flex: none; font-size: 12px; }
.cr-aircraft .dropdown-item .cr-own { margin-left: auto; font-size: 12px; opacity: 0.75; }

/* ---- Notes: which aircraft has its own crew -------------------------------- */
.cr-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; padding: 10px 14px; border-radius: var(--hig-radius-lg); background: var(--hig-tint-soft); font-size: 14px; color: var(--hig-label); }
.cr-note[hidden] { display: none; }
.cr-note-text { flex: 1 1 320px; min-width: 0; }
.cr-note .btn { flex: none; }

/* ---- Seats -------------------------------------------------------------------- */
/* Columns follow the room the settings layout leaves, not the window: a card is never under 270px. */
.cr-seats { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; align-items: stretch; }
.cr-seat { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--hig-bg2); border-radius: var(--hig-radius-lg); box-shadow: var(--hig-card-shadow); }
.cr-seat-head { display: flex; align-items: center; gap: 8px; padding: 8px 6px 0 16px; min-height: 48px; }
.cr-seat-title { margin: 0 auto 0 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; color: var(--hig-label); }
.cr-chip { flex: none; font-size: 12px; font-weight: 600; color: var(--hig-label2); background: var(--hig-fill4); border-radius: 6px; padding: 3px 8px; white-space: nowrap; }
.cr-chip--own { color: var(--hig-tint-text); background: var(--hig-tint-soft); }
.cr-saved { display: none; align-items: center; gap: 4px; flex: none; font-size: 12px; font-weight: 600; color: var(--hig-green-text); }
.cr-seat.is-saved .cr-saved { display: inline-flex; }
.cr-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--hig-label2); }
.cr-icon-btn:hover, .cr-icon-btn[aria-expanded="true"] { background: var(--hig-fill4); color: var(--hig-label); }
.cr-seat .dropdown-item { min-height: 34px; }
.cr-seat .dropdown-item.cr-danger, .cr-seat .dropdown-item.cr-danger:hover, .cr-seat .dropdown-item.cr-danger:focus { color: var(--hig-red-text); }
.cr-seat .dropdown-item.cr-danger:hover, .cr-seat .dropdown-item.cr-danger:focus { background: color-mix(in srgb, var(--hig-red) 16%, transparent); }
.cr-seat-badge { padding: 0 16px; min-height: 2px; }

.cr-person { display: flex; align-items: center; gap: 14px; padding: 8px 16px 12px; }
.cr-avatar { position: relative; flex: none; width: 72px; height: 72px; border-radius: 50%; overflow: hidden; background: var(--hig-fill3); display: flex; align-items: center; justify-content: center; color: var(--hig-label2); font-size: 26px; }
.cr-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cr-person-text { flex: 1; min-width: 0; }
/* A name is never cut to "Ethan Kel...": it wraps to a second line before it truncates. */
.cr-name { font-size: 17px; line-height: 1.2; font-weight: 600; color: var(--hig-label); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cr-meta { margin-top: 2px; font-size: 13px; color: var(--hig-label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* On a seat card the line under the name may be a sentence ("A different Community co-pilot on every flight"). */
.cr-person-text .cr-meta { white-space: normal; }
.cr-rating { display: flex; align-items: center; gap: 4px; margin-top: 3px; font-size: 13px; color: var(--hig-label2); white-space: nowrap; }
.cr-rating i, .cr-pick-rating i { font-size: 11px; color: var(--hig-orange); }
.cr-line { margin: 0; padding: 0 16px 12px; font-size: 13px; color: var(--hig-label2); }

/* The play button: the one control that matters most on this page. */
.cr-play { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--hig-tint-soft); color: var(--hig-tint-text); font-size: 14px; transition: transform 0.12s ease, background-color 0.12s ease; }
.cr-play:hover { transform: scale(1.06); }
.cr-play--lg { width: 52px; height: 52px; font-size: 17px; background: var(--hig-tint); color: var(--hig-on-tint); }
.cr-play .fa-play { margin-left: 2px; }
.cr-play:disabled { opacity: 0.4; transform: none; }
.cr-play .cr-eq, .cr-play .spinner-border { display: none; }
.cr-play.is-playing, .cr-pick-row.is-playing .cr-play { background: var(--hig-tint); color: var(--hig-on-tint); }
.cr-play.is-playing .fa-play, .cr-pick-row.is-playing .cr-play .fa-play,
.cr-play.is-loading .fa-play, .cr-pick-row.is-loading .cr-play .fa-play { display: none; }
.cr-play.is-playing .cr-eq, .cr-pick-row.is-playing .cr-play .cr-eq { display: inline-flex; }
.cr-play.is-loading .spinner-border, .cr-pick-row.is-loading .cr-play .spinner-border { display: inline-block; width: 16px; height: 16px; border-width: 2px; }
.cr-eq { align-items: center; gap: 2px; height: 14px; }
.cr-eq i { display: block; width: 3px; height: 14px; border-radius: 2px; background: currentColor; animation: cr-eq 0.9s ease-in-out infinite; }
.cr-eq i:nth-child(2) { animation-delay: -0.3s; }
.cr-eq i:nth-child(3) { animation-delay: -0.6s; }
.cr-eq i:nth-child(4) { animation-delay: -0.15s; }
@keyframes cr-eq { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }

/* Settings rows on a seat: an inset grouped list. */
.cr-rows { border-top: var(--hig-hairline) solid var(--hig-separator); }
.cr-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin: 0; padding: 0 12px 0 16px; font-size: 15px; color: var(--hig-label); }
.cr-row + .cr-row { box-shadow: inset 0 var(--hig-hairline) 0 var(--hig-separator); }
.cr-row > span:first-child { flex: none; }
.cr-row-value { min-width: 0; padding-right: 6px; text-align: right; color: var(--hig-label2); overflow-wrap: anywhere; }
/* hig-theme.css styles every field with :root[data-theme]; these rows want bare, right-aligned values. */
:root[data-theme] .crew-roster .cr-row :is(.form-select, .form-control) { width: auto; max-width: 62%; min-width: 0; min-height: 32px; border: 0; background-color: transparent; box-shadow: none; text-align: right; color: var(--hig-label2); font-size: 15px; }
:root[data-theme] .crew-roster .cr-row .form-select { padding: 4px 28px 4px 8px; background-position: right 6px center; text-align-last: right; cursor: pointer; }
:root[data-theme] .crew-roster .cr-row .form-control { width: 170px; padding: 4px 6px; }
:root[data-theme] .crew-roster .cr-row :is(.form-select, .form-control):focus-visible { box-shadow: 0 0 0 3px var(--hig-focus); color: var(--hig-label); }
:root[data-theme] .crew-roster .cr-row .form-control::placeholder { color: var(--hig-label3); }
.cr-stars { display: inline-flex; }
.cr-star { width: 30px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--hig-orange); font-size: 16px; }
.cr-star:hover { transform: scale(1.12); }
.cr-seat-foot { margin-top: auto; padding: 12px 16px 16px; border-top: var(--hig-hairline) solid var(--hig-separator); }
.cr-seat-foot .btn { min-height: 40px; font-weight: 600; }

/* Open seat */
.cr-seat--open { background: transparent; box-shadow: none; border: 1.5px dashed var(--hig-separator); padding-bottom: 16px; }
.cr-seat--open .cr-seat-head { padding-right: 16px; }
.cr-open-text { margin: 4px 16px 14px; font-size: 15px; color: var(--hig-label2); }
.cr-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px; }
.cr-pos-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 20px; background: var(--hig-fill3); color: var(--hig-label); font-size: 15px; font-weight: 600; }
.cr-pos-chip:hover { background: var(--hig-fill2); }
.cr-pos-chip span { font-weight: 400; color: var(--hig-label2); font-variant-numeric: tabular-nums; }
.cr-ptt { margin: 14px 2px 0; font-size: 13px; color: var(--hig-label2); }

.cr-seat--loading { min-height: 300px; align-items: center; justify-content: center; color: var(--hig-label2); }
.cr-error { padding: 28px 16px; text-align: center; color: var(--hig-label2); }
.cr-error strong { display: block; margin-bottom: 4px; color: var(--hig-label); }

/* ---- Crew memory ------------------------------------------------------------------ */
.cr-memory { margin-top: 24px; background: var(--hig-bg2); border-radius: var(--hig-radius-lg); box-shadow: var(--hig-card-shadow); }
.cr-memory-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; }
.cr-memory-text { flex: 1 1 300px; min-width: 0; }
.cr-memory-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--hig-label); }
.cr-memory-title i { margin-right: 6px; color: var(--hig-purple); }
.cr-memory-lead { margin: 2px 0 0; font-size: 13px; color: var(--hig-label2); }
.cr-memory .form-check { margin: 0; padding: 0; min-height: 0; display: flex; align-items: center; gap: 8px; }
.cr-memory .form-check-input { float: none; margin: 0; flex: none; }
.cr-memory .form-check-label { font-size: 13px; color: var(--hig-label2); }
.cr-memory-status { flex-basis: 100%; font-size: 13px; }
.cr-memory-status:empty { display: none; }
.cr-memory-pitch:not(:empty) { padding: 0 16px 14px; }
.cr-memory-pitch .expansion-pitch-card, .cr-memory-pitch .expansion-pitch-card[style] { color: var(--hig-label); background: color-mix(in srgb, var(--hig-green) 12%, transparent) !important; border: 0 !important; border-radius: var(--hig-radius) !important; }
.cr-memory-pitch .expansion-pitch-card :is(strong, div, span:not(.badge), p) { color: var(--hig-label) !important; }
.cr-memory-pitch .expansion-pitch-card .badge { color: var(--hig-green-text) !important; background: color-mix(in srgb, var(--hig-green) 18%, transparent) !important; border: 0 !important; }

/* ---- Crew card on the other settings tabs (Co-Pilot, Cabin Crew, Ground Services, SkyOps) ---- */
.cr-poscard { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.cr-poscard .cr-avatar { width: 64px; height: 64px; }
.cr-poscard--empty .cr-avatar { font-size: 22px; }
.cr-poscard-text { flex: 1 1 240px; min-width: 0; }
.cr-poscard-text .cr-meta i.fa-star { font-size: 11px; color: var(--hig-orange); }
.cr-poscard-text .cr-chip { margin-left: 4px; }
.cr-poscard-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cr-poscard-actions .btn-primary, .cr-poscard-actions .btn-secondary { min-height: 40px; padding-left: 16px; padding-right: 16px; font-size: 15px; font-weight: 600; }
.cr-poscard-link { padding-left: 4px; padding-right: 4px; font-size: 13px; text-decoration: none; }
.cr-poscard-link:hover { text-decoration: underline; }
.cr-poscard.is-saved .cr-saved { display: inline-flex; margin-left: 6px; }

/* ---- The picker sheet ----------------------------------------------------------------- */
.cr-picker .modal-dialog { max-width: 660px; }
.cr-picker .modal-content { overflow: hidden; }
.cr-picker-head { display: block; padding: 18px 20px 12px; border-bottom: var(--hig-hairline) solid var(--hig-separator); }
.cr-picker-titlebar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.cr-picker-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: var(--hig-label); }
.cr-picker-count { font-size: 13px; color: var(--hig-label2); white-space: nowrap; }
.cr-picker-hint { margin: 3px 0 0; font-size: 13px; color: var(--hig-label2); }
.cr-picker-tools { margin-top: 12px; }
.cr-picker-tools[hidden] { display: none; }
.cr-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: var(--hig-radius); background: var(--hig-fill3); color: var(--hig-label2); }
.cr-search:focus-within { box-shadow: 0 0 0 3px var(--hig-focus); }
/* The wrapper draws the focus ring, so the field inside it stays bare (hig-theme.css rings every input). */
:root[data-theme] .cr-search input, :root[data-theme] .cr-search input:focus { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; box-shadow: none; background: transparent; color: var(--hig-label); font-size: 15px; }
.cr-search input::placeholder { color: var(--hig-label2); }
.cr-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.cr-segments { display: flex; flex: 1 1 320px; min-width: 0; padding: 2px; border-radius: 9px; background: var(--hig-fill3); overflow-x: auto; }
.cr-segment { flex: 1; min-height: 30px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--hig-label); font-size: 13px; font-weight: 500; white-space: nowrap; }
.cr-segment[aria-pressed="true"] { background: var(--hig-seg-selected); box-shadow: var(--hig-control-shadow); font-weight: 600; }
.cr-segment span { margin-left: 3px; font-weight: 400; color: var(--hig-label2); font-variant-numeric: tabular-nums; }
.cr-segment i { margin-right: 4px; font-size: 10px; color: var(--hig-label2); }
:root[data-theme] .cr-filters .form-select { width: auto; max-width: 180px; min-height: 34px; padding-right: 30px; font-size: 13px; }
.cr-filters .form-select[hidden] { display: none; }

.cr-picker-body { padding: 0; min-height: 180px; }
.cr-pick-row { display: block; width: 100%; padding: 6px 20px; border: 0; background: transparent; color: var(--hig-label); text-align: left; }
.cr-pick-row + .cr-pick-row { box-shadow: inset 0 var(--hig-hairline) 0 var(--hig-separator); }
.cr-pick-row:hover { background: var(--hig-fill4); }
.cr-pick-row.is-selected { background: var(--hig-tint-soft); }
.cr-pick-row:focus-visible { outline: 0; box-shadow: inset 0 0 0 3px var(--hig-focus); }
.cr-pick-main { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.cr-pick-row .cr-play { width: 40px; height: 40px; }
.cr-pick-avatar { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: var(--hig-fill3); display: flex; align-items: center; justify-content: center; color: var(--hig-label2); font-size: 16px; }
.cr-pick-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cr-pick-text { flex: 1; min-width: 0; }
.cr-pick-name { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-pick-sub { display: block; font-size: 13px; color: var(--hig-label2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-pick-rating { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 13px; color: var(--hig-label2); font-variant-numeric: tabular-nums; }
.cr-pick-check { flex: none; width: 18px; color: var(--hig-tint-text); visibility: hidden; }
.cr-pick-row.is-selected .cr-pick-check { visibility: visible; }
.cr-pick-more { display: none; padding: 2px 30px 8px 108px; font-size: 13px; color: var(--hig-label2); white-space: normal; }
.cr-pick-row.is-selected .cr-pick-more { display: block; }
.cr-pick-more q { display: block; margin-bottom: 4px; color: var(--hig-label); quotes: "\201C" "\201D"; }
.cr-pick-row.is-locked { opacity: 0.5; }
.cr-pick-empty, .cr-pick-lock { margin: 0; padding: 22px 20px; font-size: 15px; color: var(--hig-label2); }
.cr-pick-lock { padding: 12px 20px; background: var(--hig-fill4); }

.cr-picker-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 20px; }
.cr-picker-note { flex: 1 1 200px; min-width: 0; margin: 0; font-size: 13px; color: var(--hig-label2); }
.cr-picker-foot .btn { min-height: 38px; min-width: 88px; font-weight: 600; }

/* ---- Narrow layouts ----------------------------------------------------------------------- */
@media (max-width: 720px) {
    .cr-title { font-size: 24px; }
    .cr-aircraft { width: 100%; }
    .cr-aircraft-btn { flex: 1; max-width: none; text-align: left; }
    .cr-pick-row { padding-left: 14px; padding-right: 14px; }
    .cr-pick-more { padding-left: 52px; padding-right: 8px; }
    .cr-picker-head, .cr-picker-foot { padding-left: 14px; padding-right: 14px; }
    .cr-picker-note { flex-basis: 100%; }
    .cr-picker-foot .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .cr-eq i { animation: none; }
    .cr-play, .cr-star { transition: none; }
    .cr-play:hover, .cr-star:hover { transform: none; }
}
