/*
 * fm-operator.css
 *
 * Layered on top of fm-public.css for the /control/ page. Reuses the
 * same design tokens (--fm-*) so the schedule reads identically to the
 * public page — only the chrome (header, banner, drag handles, toggle
 * buttons, now line) is operator-specific.
 */

html, body { background: #ffffff; }

.fm-control-body {
	margin: 0;
	padding: 0;
	color: var(--fm-text, #111);
	font-family: "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	-webkit-font-smoothing: antialiased;
	background: #ffffff;
}

.fm-control {
	--fm-bg: #ffffff;
	--fm-bg-elev: #ffffff;
	--fm-line: #ececec;
	--fm-text: #111111;
	--fm-text-soft: #555555;
	--fm-text-mute: #8a8a8a;
	--fm-hover: #f6f6f6;
	--fm-status-done: #16a34a;
	--fm-status-done-bg: #ecfdf5;
	--fm-status-prog: #2563eb;
	--fm-status-prog-bg: #eff6ff;
	--fm-status-wait: #b45309;
	--fm-status-wait-bg: #fef3c7;
	--fm-status-cancel: #dc2626;
	--fm-status-cancel-bg: #fef2f2;
	--fm-duration: 180ms;
	--fm-ease: cubic-bezier(.2,.7,.2,1);

	position: relative;
	max-width: 1180px;
	margin: 0 auto;
	/* Respect the iPhone PWA safe area so the leftmost / rightmost
	   header icons aren't clipped by the rounded screen corners.
	   max() so the desktop padding stays at 24px when the inset is 0. */
	padding: max(32px, env(safe-area-inset-top, 0px) + 12px)
	         max(24px, env(safe-area-inset-right, 0px) + 8px)
	         max(80px, env(safe-area-inset-bottom, 0px) + 32px)
	         max(24px, env(safe-area-inset-left, 0px) + 8px);
	min-height: 100vh;
	box-sizing: border-box;
}

/* ---- Operator header bar ---- */

.fm-control__head {
	display: flex;
	align-items: center;
	/* Same tight gap the right-side cluster (theme + settings) uses so
	   the Add cluster on the left reads as a matching group. */
	gap: 6px;
	margin-bottom: 24px;
}
.fm-control__head-actions {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-left: auto; /* pushes Add flight / Add pilot / Gear to the right */
}

.fm-control__settings-btn,
.fm-control__iconbtn {
	appearance: none;
	background: transparent;
	border: 1px solid #d4d4d6;
	color: var(--fm-text-soft);
	width: 36px;
	height: 36px;
	border-radius: 6px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: color 120ms var(--fm-ease), border-color 120ms var(--fm-ease), background-color 120ms var(--fm-ease);
}
.fm-control__iconbtn:hover {
	color: var(--fm-text);
	border-color: var(--fm-text-mute);
	background: var(--fm-hover);
}
.fm-control__iconbtn:focus-visible {
	outline: 2px solid var(--fm-status-prog);
	outline-offset: 2px;
}
.fm-control__iconbtn-icon { display: none; }
/* Sun by default, moon when the (control-body OR pilot-body) is in
   dark mode. Selector is unscoped on purpose so the icon-button
   renders correctly on both /control/ and /pilot/. */
.fm-control__iconbtn-icon--sun { display: block; }
.fm-theme-dark .fm-control__iconbtn-icon--sun  { display: none; }
.fm-theme-dark .fm-control__iconbtn-icon--moon { display: block; }
.fm-theme-dark .fm-control__iconbtn { border-color: #2a2a2e; }

/* Notification bell state badges — small dot in the top-right corner
   of the bell button so the pilot can tell at a glance whether
   permission is granted, denied, or still to grant. */
.fm-pilot__notify-btn { position: relative; }
.fm-pilot__notify-btn::after {
	content: "";
	position: absolute;
	top: 6px;
	right: 6px;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: transparent;
	box-shadow: 0 0 0 2px var(--fm-bg, #ffffff);
}
.fm-pilot__notify-btn[data-notify-state="granted"]::after { background: #22c55e; }
.fm-pilot__notify-btn[data-notify-state="denied"]::after  { background: #dc2626; }
.fm-pilot__notify-btn[data-notify-state="default"]::after { background: #f59e0b; }
.fm-pilot__notify-btn[data-notify-state="denied"]  { opacity: 0.55; }
.fm-control__settings-btn:hover {
	color: var(--fm-text);
	border-color: var(--fm-text-mute);
	background: var(--fm-hover);
}
.fm-control__settings-btn:focus-visible {
	outline: 2px solid var(--fm-status-prog);
	outline-offset: 2px;
}
.fm-control-body.fm-theme-dark .fm-control__settings-btn {
	border-color: #2a2a2e;
}

/* The embedded shortcode's outer section keeps its own padding,
   collapse it inside the control container so the chrome doesn't
   nest. */
.fm-control .fm-schedule {
	margin: 0;
	padding: 0;
	max-width: none;
}

/* Keep the embedded schedule's own header (date, count, Ends, Hide
   past flights) — it's the table header the operator expects. The
   public schedule's chrome bar (theme + density pills) is hidden so
   it doesn't duplicate the operator header's own theme pill. */
.fm-control .fm-tweaks,
.fm-control .fm-schedule__chrome { display: none; }

/* ---- Header ---- */

/* (Layout for .fm-control__head lives near the top of this file —
   gap + flex direction. Keep the brand/title styles only here.) */
.fm-control__brand {
	display: flex;
	align-items: baseline;
	gap: 20px;
	flex-wrap: wrap;
}
.fm-control__title {
	margin: 0;
	font-size: 36px;
	font-weight: 600;
	letter-spacing: -0.02em;
	line-height: 1;
}
.fm-control__back {
	font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	color: var(--fm-text-mute);
	text-decoration: none;
}
.fm-control__back:hover { color: var(--fm-text-soft); }

/* ---- Overrun banner ---- */

.fm-control__overrun {
	margin-bottom: 24px;
	padding: 12px 16px;
	background: var(--fm-status-cancel-bg);
	color: var(--fm-status-cancel);
	border-left: 3px solid var(--fm-status-cancel);
	border-radius: 6px;
	font-size: 14px;
	font-weight: 500;
}
.fm-control__overrun[hidden] { display: none; }

/* ---- Schedule grid: prepend a 20px column for the drag handle on
       every row that already uses the shortcode's grid. ---- */

.fm-control .fm-schedule__grid {
	grid-template-columns:
		20px           /* drag handle */
		32px           /* # */
		90px           /* time */
		1fr            /* pilot */
		1.4fr          /* model */
		130px          /* status */
		20px           /* chev */
		160px;         /* buttons — fixed so 1 vs 2 buttons doesn't shift other columns */
	gap: var(--fm-cell-gap, 32px);
}

/* The header row gets a blank cell at the start for the drag column. */
.fm-control .fm-schedule__headrow {
	grid-template-columns:
		20px
		32px
		90px
		1fr
		1.4fr
		130px
		20px
		160px;
}
.fm-control .fm-schedule__headrow::before {
	content: "";
}

/* Simplified tables on /operator/: the Model + chev columns disappear,
   so the row grid drops to 6 tracks (drag / # / time / pilot / status
   / buttons). The .fm-schedule--simple class wins on specificity at
   the section level, but the operator-scoped grid above re-declares
   grid-template-columns at the same specificity and ships later, so
   we need an explicit operator override for the simple variant. */
.fm-control .fm-schedule--simple .fm-schedule__grid,
.fm-control .fm-schedule--simple .fm-schedule__headrow {
	grid-template-columns:
		20px           /* drag handle */
		32px           /* # */
		90px           /* time */
		1fr            /* pilot */
		130px          /* status */
		160px;         /* buttons */
}

/* ---- Drag handle ---- */

.fm-control__drag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--fm-text-mute);
	opacity: 0.45;
	cursor: grab;
	width: 20px;
	height: 28px;
	border-radius: 6px;
	background: transparent;
	transition: opacity 120ms var(--fm-ease),
				background-color 120ms var(--fm-ease),
				color 120ms var(--fm-ease),
				transform 80ms var(--fm-ease);
	user-select: none;
	/* Prevent the browser from interpreting a vertical drag as a
	   touchscreen scroll while the operator is reordering rows. */
	touch-action: none;
}
.fm-control__drag svg { display: block; fill: currentColor; }
.fm-schedule__main:hover .fm-control__drag { opacity: 0.75; }
.fm-control__drag:hover {
	background: var(--fm-hover);
	color: var(--fm-text);
	opacity: 1;
}
/* Instant feedback on press — the handle visually "grabs" before the
   row even starts to move, so the operator knows the input was
   received. Re-applied while the drag is in progress via the row's
   is-dragging marker so the handle stays lit while the row floats. */
.fm-control__drag:active,
.fm-schedule__row.is-dragging .fm-control__drag {
	background: var(--fm-status-prog-bg);
	color: var(--fm-status-prog);
	opacity: 1;
	transform: scale(1.15);
	cursor: grabbing;
}

/* While dragging, lift the row dramatically so it reads as a tile
   floating above the list — easier to track on a small touchscreen. */
.fm-schedule__row.is-dragging {
	background: var(--fm-bg-elev);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
	transform: scale(1.01);
	z-index: 5;
	position: relative;
	border-radius: 8px;
	border-color: transparent;
}
.fm-schedule__list.is-reordering .fm-schedule__row:not(.is-dragging) {
	transition: transform 160ms var(--fm-ease);
}
/* Subtle dim on the sibling rows so the dragged tile pops out. */
.fm-schedule__list.is-reordering .fm-schedule__row:not(.is-dragging) {
	opacity: 0.72;
}

/* Rows that aren't reorderable (completed history, in-flight, or any
   pending sitting before the in-flight) get a non-grab cursor and a
   ghosted handle so the operator sees at a glance what can move. */
.fm-schedule__row[data-fm-status="done"] .fm-control__drag,
.fm-schedule__row[data-fm-status="prog"] .fm-control__drag {
	opacity: 0.12;
	cursor: not-allowed;
	pointer-events: none;
}
.fm-schedule__list:has(.fm-schedule__row[data-fm-status="prog"]) .fm-schedule__row[data-fm-status="wait"]:has(~ .fm-schedule__row[data-fm-status="prog"]) .fm-control__drag {
	opacity: 0.12;
	cursor: not-allowed;
	pointer-events: none;
}

/* ---- Per-row buttons ---- */

.fm-control__buttons {
	display: inline-flex;
	gap: 6px;
	justify-self: end;
	justify-content: flex-end;
	width: 100%;
}
.fm-control__btn {
	appearance: none;
	border: 1px solid var(--fm-line);
	background: transparent;
	color: var(--fm-text);
	font: inherit;
	font-size: 12px;
	padding: 5px 12px;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 120ms var(--fm-ease), color 120ms var(--fm-ease), border-color 120ms var(--fm-ease);
	white-space: nowrap;
}
.fm-control__btn:hover { background: var(--fm-hover); }
.fm-control__btn:focus-visible {
	outline: 2px solid var(--fm-status-prog);
	outline-offset: 2px;
}
.fm-control__btn.is-busy { opacity: 0.5; cursor: wait; }

/* Icon-only lifecycle buttons. All four (Start / Complete / Stop /
   Reset) share the same neutral-at-rest, tinted-on-hover pattern
   the trash + link buttons already use, so the row's action strip
   reads as a row of glyphs rather than a wall of mixed labels.
   Disabled icons stay rendered (constant gutter width across rows)
   but go muted with no hover affordance so they read clearly as
   "not available right now". */
.fm-control__btn--icon {
	border-color: transparent;
	background: transparent;
	padding: 5px 6px;
}
.fm-control__btn--icon svg { display: block; }
.fm-control__btn--icon[disabled],
.fm-control__btn--icon[aria-disabled="true"] {
	color: var(--fm-text-mute);
	border-color: transparent;
	background: transparent;
	opacity: 0.35;
	cursor: not-allowed;
}
.fm-control__btn--icon[disabled]:hover,
.fm-control__btn--icon[aria-disabled="true"]:hover {
	background: transparent;
	border-color: transparent;
	color: var(--fm-text-mute);
}

.fm-control__btn--start    { color: var(--fm-status-prog); }
.fm-control__btn--start:hover {
	color: var(--fm-status-prog);
	border-color: var(--fm-status-prog);
	background: var(--fm-status-prog-bg);
}
/* Disabled treatment is shared with the rest of the icon strip via
   the .fm-control__btn--icon[disabled] block above. */

.fm-control__btn--complete { color: var(--fm-status-done); }
.fm-control__btn--complete:hover {
	color: var(--fm-status-done);
	border-color: var(--fm-status-done);
	background: var(--fm-status-done-bg);
}

.fm-control__btn--stop     { color: var(--fm-status-cancel); }
.fm-control__btn--stop:hover {
	color: var(--fm-status-cancel);
	border-color: var(--fm-status-cancel);
	background: var(--fm-status-cancel-bg);
}

.fm-control__btn--reset    { color: var(--fm-text-mute); }
.fm-control__btn--reset:hover {
	color: var(--fm-text);
	background: var(--fm-hover);
}

/* Icon-only trash button — neutral by default, turns red on hover so
   the destructive intent is unmistakable but not loud at rest. */
.fm-control__btn--delete {
	color: var(--fm-text-mute);
	border-color: transparent;
	padding: 5px 6px;
}
.fm-control__btn--delete svg { display: block; }
.fm-control__btn--delete:hover {
	color: var(--fm-status-cancel);
	border-color: var(--fm-status-cancel);
	background: var(--fm-status-cancel-bg);
}

/* "+ link" icon button on a parent row — same neutral-at-rest as
   delete, but tints the accent blue (matches the parent/child
   continuity border) on hover so it reads as a grouping action.
   Only rendered on pending, independent flights — JS gates that. */
.fm-control__btn--link {
	color: var(--fm-text-mute);
	border-color: transparent;
	padding: 5px 6px;
}
.fm-control__btn--link svg { display: block; }
.fm-control__btn--link:hover {
	color: var(--fm-status-prog);
	border-color: var(--fm-status-prog);
	background: var(--fm-status-prog-bg);
}

/* Edit (pencil) icon button — neutral at rest, subtle highlight on hover. */
.fm-control__btn--edit {
	color: var(--fm-text-mute);
	border-color: transparent;
	padding: 5px 6px;
}
.fm-control__btn--edit svg { display: block; }
.fm-control__btn--edit:hover {
	color: var(--fm-text);
	border-color: var(--fm-line);
	background: var(--fm-hover);
}

/* Helper badge above the Add-flight form fields, surfaced only when
   the dialog was opened from a "+ link" click. Mono so it visually
   stitches with the schedule rows behind. */
.fm-control__parent-context {
	margin: 0 0 12px 0;
	padding: 8px 10px;
	font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 12px;
	color: var(--fm-status-prog);
	background: var(--fm-status-prog-bg);
	border-left: 3px solid var(--fm-status-prog);
	border-radius: 4px;
}

/* Coordinated-pilot rows inside the Add-flight dialog. Each row
   contains a pilot+model pair and an optional ✕ remove button. The
   blue left border + faint background make additional rows read as
   "linked to the first one" without screaming for attention. */
.fm-control__crew-row {
	position: relative;
	padding-left: 0;
	margin-bottom: 8px;
}
.fm-control__crew-row[data-fm-crew-index]:not([data-fm-crew-index="0"]) {
	padding-left: 12px;
	border-left: 3px solid var(--fm-status-prog);
	background: var(--fm-status-prog-bg);
	border-radius: 0 4px 4px 0;
	padding-top: 6px;
	padding-bottom: 2px;
}
.fm-control__crew-remove {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--fm-text-mute);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	border-radius: 4px;
}
.fm-control__crew-remove:hover {
	color: var(--fm-status-cancel);
	background: var(--fm-status-cancel-bg);
}
.fm-control__crew-add {
	display: inline-block;
	padding: 6px 10px;
	margin-bottom: 8px;
	background: transparent;
	border: 1px dashed var(--fm-status-prog);
	color: var(--fm-status-prog);
	font-size: 12px;
	font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	border-radius: 4px;
	cursor: pointer;
}
.fm-control__crew-add:hover {
	background: var(--fm-status-prog-bg);
}

/* Hide the public chevron in the control page — the drawer is still
   accessible via row click but we don't need to flag it twice. */
.fm-control .fm-schedule__chev { opacity: 0; pointer-events: none; }

/* NOW line styles live in fm-public.css under .fm-schedule__now-line
   so the public schedule shares the same separator. */

/* ---- Add Flight form ---- */

.fm-control__add-btn {
	appearance: none;
	border: 1px solid var(--fm-text, #111111);
	background: var(--fm-text, #111111);
	color: var(--fm-bg, #ffffff);
	padding: 0;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	border-radius: 6px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0;
	width: 40px;
	min-height: 40px;
	transition: opacity 120ms var(--fm-ease);
}
.fm-control__add-btn:hover { opacity: 0.88; }
.fm-control__add-btn[disabled],
.fm-control__add-btn--blocked {
	opacity: 0.45;
	cursor: not-allowed;
	pointer-events: none;
}
/* Icon-only buttons everywhere — labels live in aria-label so the
   header bar stays compact on both desktop and mobile. */
.fm-control__add-label { display: none; }
.fm-control__event-note {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: fit-content;
	margin: 20px auto 16px;
	padding: 10px 14px;
	background: var(--fm-status-cancel-bg, #fef2f2);
	color: var(--fm-status-cancel, #dc2626);
	border-left: 3px solid var(--fm-status-cancel, #dc2626);
	border-radius: 6px;
	font-size: 13px;
	line-height: 1.3;
}
.fm-control-body.fm-theme-dark .fm-control__event-note {
	background: rgba(248, 113, 113, 0.10);
	color: #f87171;
	border-left-color: #f87171;
}
.fm-control__add-btn:focus-visible {
	outline: 2px solid var(--fm-status-prog, #2563eb);
	outline-offset: 2px;
}
.fm-control__add-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	font-weight: 700;
	font-size: 14px;
	line-height: 1;
}
/* Secondary variant — same pill shape but outlined, so Add pilot
   stays visually distinct from the primary Add flight. */
.fm-control__add-btn--secondary {
	background: transparent;
	color: var(--fm-text, #111);
	border: 1px solid #d4d4d6;
}
.fm-control__add-btn--secondary:hover {
	opacity: 1;
	background: var(--fm-hover, #f6f6f6);
	border-color: var(--fm-text-mute, #8a8a8a);
}
.fm-control-body.fm-theme-dark .fm-control__add-btn--secondary {
	color: #f5f5f7;
	border-color: #2a2a2e;
}
.fm-control-body.fm-theme-dark .fm-control__add-btn--secondary:hover {
	background: #161618;
}
/* Live (publish) button — solid green once the schedule is published to
   the public, so the broadcast state reads at a glance. */
.fm-control__add-btn--live.is-active,
.fm-control-body.fm-theme-dark .fm-control__add-btn--live.is-active {
	background: var(--fm-status-done, #16a34a);
	border-color: var(--fm-status-done, #16a34a);
	color: #fff;
}
.fm-control__add-btn--live.is-active:hover,
.fm-control-body.fm-theme-dark .fm-control__add-btn--live.is-active:hover {
	background: #15803d;
	border-color: #15803d;
}

/* The schedule's head is already a horizontal row in fm-public.css,
   just tighten the bottom margin inside /control/. */
.fm-control .fm-schedule__head { margin-bottom: 24px; }
.fm-control .fm-schedule__past-toggle { padding-top: 0; }
.fm-control__add-form {
	margin-top: 8px;
	padding: 16px;
	background: var(--fm-hover);
	border-radius: 8px;
}
.fm-control__add-grid {
	display: grid;
	grid-template-columns: 1fr 1fr 120px auto;
	gap: 12px 16px;
	align-items: end;
}
/* Span the two 1fr columns so a field sits across both name/club/
   registration positions — used for the email row on the pilot
   self-edit form (and the matching operator pilot dialog). */
.fm-control__add-grid .fm-control__field--span-2 {
	grid-column: 1 / 3;
}

/* Two-column grid used by the pilot fields partial (Add pilot dialog
   in /operator/ and "Your details" on /pilot/). Mirrors the Add model
   dialog's spacing language so the two forms read the same. Email
   uses --span-2 to claim the whole row. */
.fm-control__pilot-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 16px 18px;
	width: 100%;
}
.fm-control__pilot-grid .fm-control__field--span-2 {
	grid-column: 1 / -1;
}
.fm-control__pilot-grid .fm-control__field input,
.fm-control__pilot-grid .fm-control__field select,
.fm-control__pilot-grid .fm-control__field textarea {
	width: 100%;
	box-sizing: border-box;
}
.fm-control__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.fm-control__field-label {
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--fm-text-mute);
}

/* Inline radio group used for "Slot (min)" in the Add-flight dialog
   and "Default slot (min)" in the Settings dialog. Wraps to two
   rows if the dialog is squeezed (mobile portrait) but stays one
   line on every realistic operator viewport. */
.fm-control__radio-group {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	align-items: center;
}
.fm-control__radio {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	cursor: pointer;
	user-select: none;
}
.fm-control__radio input[type="radio"] {
	margin: 0;
}
/* The HTML5 [hidden] attribute defaults to display:none, but every
   conditional field wrapper here also carries .fm-control__field
   (display:flex) or .fm-control__add-grid (display:grid) — those win.
   Force a real hide so propulsion-driven fields actually disappear. */
[hidden] { display: none !important; }

.fm-control__field--checkbox {
	flex-direction: row;
	align-items: center;
	gap: 8px;
}
.fm-control__field--checkbox input[type="checkbox"] {
	width: 16px;
	height: 16px;
	padding: 0;
	margin: 0;
}
.fm-control__field--checkbox span {
	font-size: 13px;
	color: var(--fm-text-soft);
}
/* Toggle-style settings row: the .fm-toggle component is inline-flex,
   but inside the settings form we want each row to span the dialog
   width so the label wraps cleanly to the right of the switch. */
.fm-control__field--toggle {
	flex-direction: row;
	align-items: center;
	gap: 12px;
}
.fm-control__field--toggle .fm-toggle__label {
	flex: 1 1 auto;
	min-width: 0;
}

.fm-control__field input,
.fm-control__field select,
.fm-control__field textarea {
	font: inherit;
	font-size: 14px;
	padding: 9px 12px;
	border: 1px solid #d4d4d6;
	border-radius: 6px;
	background: var(--fm-bg);
	color: var(--fm-text);
	transition: border-color 120ms var(--fm-ease), box-shadow 120ms var(--fm-ease);
}
/* Drop the native select chrome on every browser so Safari stops
   rendering a gradient + double-arrow control next to Chrome's clean
   chevron. Single SVG caret aligned at the right edge of the box. */
.fm-control__field select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%236b6b70' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4.5 6 7.5 9 4.5'/></svg>");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 12px 12px;
	padding-right: 30px;
}
.fm-control__field select::-ms-expand { display: none; }
.fm-control__field input:focus,
.fm-control__field select:focus,
.fm-control__field textarea:focus {
	outline: none;
	border-color: var(--fm-status-prog);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
/* Read-only inputs (pilot self-edit email) should look obviously
   non-editable: a muted fill, dimmer text, dashed border, and a
   not-allowed cursor so the affordance reads before the user clicks.
   Focus styling is suppressed so a stray Tab doesn't tease the user
   into thinking the field is editable. */
.fm-control__field input[readonly] {
	background: var(--fm-hover);
	color: var(--fm-text-soft);
	cursor: not-allowed;
	border-style: dashed;
}
.fm-control__field input[readonly]:focus {
	border-color: #d4d4d6;
	box-shadow: none;
}
.fm-control-body.fm-theme-dark .fm-control__field input[readonly],
.fm-pilot-body.fm-theme-dark   .fm-control__field input[readonly] {
	background: #1f1f1d;
	color: #b8b8bd;
	border-color: #2a2a2e;
}
.fm-control-body.fm-theme-dark .fm-control__field input[readonly]:focus,
.fm-pilot-body.fm-theme-dark   .fm-control__field input[readonly]:focus {
	border-color: #2a2a2e;
}
.fm-control-body.fm-theme-dark .fm-control__field input,
.fm-control-body.fm-theme-dark .fm-control__field select,
.fm-control-body.fm-theme-dark .fm-control__field textarea {
	background-color: #252523;
	color: #f5f5f7;
	border-color: #2a2a2e;
	color-scheme: dark;
}
.fm-control-body.fm-theme-dark .fm-control__field select,
.fm-pilot-body.fm-theme-dark   .fm-control__field select {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23b8b8bd' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4.5 6 7.5 9 4.5'/></svg>");
}
.fm-control-body.fm-theme-dark .fm-control__field input:focus,
.fm-control-body.fm-theme-dark .fm-control__field select:focus,
.fm-control-body.fm-theme-dark .fm-control__field textarea:focus {
	border-color: #60a5fa;
	box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

/* Dark mode for the dialogs — they live as siblings of .fm-control
   so the variables set on .fm-control don't reach them. Re-declare
   the token bundle on the dialog/form when the body is in dark
   theme. */
.fm-control-body.fm-theme-dark .fm-control__settings,
.fm-control-body.fm-theme-dark .fm-control__settings-form {
	--fm-bg: #1b1b1a;
	--fm-bg-elev: #252523;
	--fm-line: #1f1f22;
	--fm-text: #f5f5f7;
	--fm-text-soft: #b8b8bd;
	--fm-text-mute: #6e6e75;
	--fm-hover: #161618;
	--fm-status-prog: #60a5fa;
	--fm-status-prog-bg: rgba(96,165,250,0.12);
	--fm-status-cancel: #f87171;
	--fm-status-cancel-bg: rgba(248,113,113,0.10);
}
.fm-control-body.fm-theme-dark .fm-control__settings-form {
	background: #252523;
	color: #f5f5f7;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}
.fm-control-body.fm-theme-dark .fm-control__settings::backdrop {
	background: rgba(0, 0, 0, 0.75);
}
.fm-control-body.fm-theme-dark .fm-control__settings-close { color: #6e6e75; }
.fm-control-body.fm-theme-dark .fm-control__settings-close:hover { background: #161618; color: #f5f5f7; }

/* Pilots dialog — wider, with a list above the add/edit form. The
   calc() keeps a 16px gutter to each screen edge on phones narrower
   than the cap, with no effect on wider screens. */
.fm-control__pilots-dialog { max-width: min(560px, calc(100% - 32px)); }
.fm-control__pilot-search {
	margin: 0 0 12px;
}
.fm-control__pilot-search-input {
	width: 100%;
	box-sizing: border-box;
	font: inherit;
	font-size: 14px;
	padding: 9px 12px;
	border: 1px solid #d4d4d6;
	border-radius: 6px;
	background: var(--fm-bg);
	color: var(--fm-text);
	transition: border-color 120ms var(--fm-ease), box-shadow 120ms var(--fm-ease);
}
.fm-control__pilot-search-input:focus {
	outline: none;
	border-color: var(--fm-status-prog);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.fm-control-body.fm-theme-dark .fm-control__pilot-search-input {
	border-color: #2a2a2e;
}
/* In-header search: keep it between the title and the close button
   and noticeably narrower than a full-width input so the dialog
   doesn't grow vertically. */
.fm-control__settings-head--with-search {
	gap: 12px;
}
.fm-control__settings-head--with-search .fm-control__pilot-search-input {
	flex: 1 1 0;
	min-width: 0;
	max-width: 260px;
	margin-left: auto;
	padding: 7px 10px;
	/* iOS Safari auto-zooms any input whose computed font-size is
	   under 16px on focus — keep this at 16px so opening the
	   keyboard from the dialog doesn't yank the whole layout up. */
	font-size: 16px;
}
.fm-control__pilot-list {
	list-style: none;
	margin: 0 0 20px;
	padding: 0;
	border-top: 1px solid #d4d4d6;
	/* About 3 rows visible: keeps the dialog short on phones where
	   the form below is what the operator wants to reach. The fixed
	   height (min == max) keeps the dialog from collapsing when the
	   search narrows the list to 1–2 rows, so the scrollable area
	   stays stable and the form below doesn't jump up. */
	min-height: calc(3 * 60px);
	max-height: calc(3 * 60px);
	overflow-y: auto;
	scrollbar-gutter: stable;
}
.fm-control-body.fm-theme-dark .fm-control__pilot-list { border-top-color: #2a2a2e; }
.fm-control__pilot-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid #ececec;
}
.fm-control-body.fm-theme-dark .fm-control__pilot-row { border-bottom-color: #1f1f22; }
.fm-control__pilot-row-main {
	flex: 1;
	min-width: 0;
}
.fm-control__pilot-name {
	font-size: 14px;
	font-weight: 500;
	color: var(--fm-text, #111);
}
.fm-control__pilot-meta {
	font-size: 12px;
	color: var(--fm-text-mute, #8a8a8a);
	margin-top: 2px;
}
.fm-control__pilot-actions {
	display: inline-flex;
	gap: 6px;
	flex-shrink: 0;
}
/* Pending-approval badge next to a self-signed-up pilot name + the
   green Approve button that clears the meta. */
.fm-control__pilot-pending {
	display: inline-block;
	margin-left: 8px;
	padding: 2px 8px;
	font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 10.5px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--fm-status-wait);
	background: var(--fm-status-wait-bg);
	border-radius: 4px;
	vertical-align: middle;
}
.fm-control__pilot-row.is-pending { background: rgba(180, 83, 9, 0.04); }
.fm-control__btn--approve {
	color: var(--fm-status-done);
	border-color: var(--fm-status-done);
}
.fm-control__btn--approve:hover { background: var(--fm-status-done-bg); }
.fm-control__pilot-empty {
	padding: 16px 0;
	color: var(--fm-text-mute, #8a8a8a);
	font-size: 13px;
	text-align: center;
	border-bottom: 1px solid #ececec;
}
.fm-control-body.fm-theme-dark .fm-control__pilot-empty { border-bottom-color: #1f1f22; }

/* Add/Edit pilot inline form — mirrors the rhythm of the Add model
   dialog: comfortable gap between rows, distinct header, Save +
   Cancel pair at the bottom. The form lives inside the Pilots
   dialog right below the list, so we just need to make it FEEL
   like the standalone settings-form. */
.fm-control__pilot-form {
	display: flex;
	flex-direction: column;
	gap: 18px;
	padding-top: 8px;
	border-top: 1px solid var(--fm-line, #ececec);
}
.fm-control__pilot-form-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: var(--fm-text, #111);
	letter-spacing: 0;
}
.fm-control__field--narrow input { width: 100%; box-sizing: border-box; }
.fm-control__add-actions {
	display: inline-flex;
	gap: 8px;
}
.fm-control__submit {
	appearance: none;
	background: var(--fm-text, #111111);
	color: var(--fm-bg, #ffffff);
	border: 1px solid var(--fm-text, #111111);
	padding: 9px 18px;
	border-radius: 6px;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	min-height: 36px;
	transition: opacity 120ms var(--fm-ease);
}
.fm-control__submit:hover { opacity: 0.88; }
.fm-control__submit:focus-visible {
	outline: 2px solid var(--fm-status-prog, #2563eb);
	outline-offset: 2px;
}
.fm-control__submit:disabled { opacity: 0.55; cursor: wait; }

.fm-control__submit-check {
	display: inline-block;
	margin-left: 6px;
	color: #22c55e;
	font-weight: 700;
	transform-origin: center;
	animation: fm-pilot-saved-pop 620ms cubic-bezier(0.34, 1.56, 0.64, 1) 1 both;
}
@keyframes fm-pilot-saved-pop {
	0%   { opacity: 0; transform: scale(0.4); }
	60%  { opacity: 1; transform: scale(1.25); }
	100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
	.fm-control__submit-check { animation: none; }
}

.fm-control__cancel {
	appearance: none;
	background: transparent;
	color: var(--fm-text-soft, #555);
	border: 1px solid #d4d4d6;
	padding: 8px 16px;
	border-radius: 6px;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	min-height: 36px;
	transition: background-color 120ms var(--fm-ease), border-color 120ms var(--fm-ease);
}
.fm-control__cancel:hover {
	background: var(--fm-hover, #f6f6f6);
	border-color: var(--fm-text-mute, #8a8a8a);
}
.fm-control-body.fm-theme-dark .fm-control__cancel { border-color: #2a2a2e; }

/* Pill toggle (Theme switch in settings) — same vibe as the public
   page's Tweaks panel but scoped to the dialog. */
.fm-control__pill {
	display: inline-flex;
	background: var(--fm-hover, #f3f4f6);
	border-radius: 8px;
	padding: 3px;
	gap: 2px;
	width: max-content;
}
.fm-control__pill-opt {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--fm-text-soft, #555);
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	padding: 7px 18px;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 120ms var(--fm-ease), color 120ms var(--fm-ease);
}
.fm-control__pill-opt:hover { color: var(--fm-text, #111); }
.fm-control__pill-opt.is-active {
	background: var(--fm-bg, #ffffff);
	color: var(--fm-text, #111);
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 0 0 1px #d4d4d6;
}
.fm-control-body.fm-theme-dark .fm-control__pill { background: #1f1f22; }
.fm-control-body.fm-theme-dark .fm-control__pill-opt.is-active {
	background: #1b1b1a;
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 1px #2a2a2e;
}
.fm-control__add-error {
	margin-top: 8px;
	color: var(--fm-status-cancel);
	font-size: 13px;
}

/* Field-label inline link, e.g. "+ new" next to Model. */
.fm-control__field-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.fm-control__field-link {
	appearance: none;
	background: transparent;
	border: 0;
	color: var(--fm-status-prog);
	font: inherit;
	font-size: 11px;
	font-weight: 500;
	text-transform: none;
	letter-spacing: 0;
	padding: 0;
	cursor: pointer;
}
.fm-control__field-link:hover { text-decoration: underline; }
.fm-control__field-link[hidden] { display: none; }

.fm-control__new-model {
	margin-top: 10px;
	padding-top: 12px;
	border-top: 1px dashed var(--fm-line);
}

/* ---- Settings dialog ---- */

.fm-control__settings {
	border: 0;
	padding: 0;
	background: transparent;
	/* min() keeps a 16px gutter to each screen edge on phones narrower
	   than the 460px cap; on wider screens the 460px cap wins. */
	max-width: min(460px, calc(100% - 32px));
	width: 100%;
}
/* When a dialog opens we park focus on the dialog element itself (it gets
   tabindex=-1 from JS) so no control — in particular the × close button —
   shows a focus ring on open. The dialog is a non-interactive container,
   so suppressing its own outline is safe. */
.fm-control__settings:focus,
.fm-control__settings:focus-visible {
	outline: none;
}
.fm-control__settings::backdrop {
	background: rgba(0, 0, 0, 0.6);
}
.fm-control__settings-form {
	background: var(--fm-bg, #fff);
	color: var(--fm-text, #111);
	border-radius: 12px;
	padding: 20px 22px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}
.fm-control__settings-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.fm-control__settings-title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
}
.fm-control__settings-close {
	appearance: none;
	background: transparent;
	border: 0;
	color: var(--fm-text-mute);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
}
.fm-control__settings-close:hover { color: var(--fm-text); background: var(--fm-hover); }
.fm-control__settings-actions {
	display: inline-flex;
	gap: 8px;
	margin-top: 4px;
}
.fm-control__settings-error {
	color: var(--fm-status-cancel);
	font-size: 13px;
}

/* When the dialog inherits the schedule's CSS variables we need to
   make sure tokens resolve for dark mode too. The :root scope on
   <dialog> doesn't inherit from .fm-control, so we duplicate the
   minimum here. */
.fm-control__settings-form {
	--fm-bg: var(--fm-bg, #ffffff);
	--fm-text: var(--fm-text, #111111);
	--fm-text-soft: var(--fm-text-soft, #555);
	--fm-text-mute: var(--fm-text-mute, #8a8a8a);
	--fm-line: var(--fm-line, #ececec);
	--fm-hover: var(--fm-hover, #f6f6f6);
	--fm-status-prog: var(--fm-status-prog, #2563eb);
	--fm-status-cancel: var(--fm-status-cancel, #dc2626);
	--fm-ease: var(--fm-ease, cubic-bezier(.2,.7,.2,1));
}

/* Dark mode on /control/ is manual (opt-in via the settings dialog),
   never inferred from prefers-color-scheme. The body picks up the
   `fm-theme-dark` class from localStorage on boot. */

.fm-control-body.fm-theme-dark { background: #1b1b1a; }
.fm-control-body.fm-theme-dark .fm-control {
	--fm-bg: #1b1b1a;
	--fm-bg-elev: #252523;
	--fm-line: #1f1f22;
	--fm-text: #f5f5f7;
	--fm-text-soft: #b8b8bd;
	--fm-text-mute: #6e6e75;
	--fm-hover: #161618;
	--fm-status-done: #4ade80;
	--fm-status-done-bg: rgba(74,222,128,0.10);
	--fm-status-prog: #60a5fa;
	--fm-status-prog-bg: rgba(96,165,250,0.12);
	--fm-status-wait: #fbbf24;
	--fm-status-wait-bg: rgba(251,191,36,0.10);
	--fm-status-cancel: #f87171;
	--fm-status-cancel-bg: rgba(248,113,113,0.10);
}

/* ---- Responsive — touch-friendly stack on narrow viewports ---- */

@media (max-width: 820px) {
	/* Bottom-anchored action bar on mobile so the operator can reach
	   Theme / Add flight / Add pilot / Add model / Settings with the
	   thumb. The bar is sticky to the viewport bottom; the schedule
	   content reserves padding-bottom to clear it. */
	.fm-control {
		padding: 14px
		         max(16px, env(safe-area-inset-right, 0px) + 8px)
		         calc(env(safe-area-inset-bottom, 0px) + 84px)
		         max(16px, env(safe-area-inset-left, 0px) + 8px);
	}
	/* Clear the fixed cross-portal top bar (rendered when authenticated). */
	.fm-control:has( > .fm-schedule__foot--bar ) {
		padding-top: calc(env(safe-area-inset-top, 0px) + 56px);
	}

	.fm-control__head {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		margin: 0;
		padding: 10px
		         max(12px, env(safe-area-inset-right, 0px) + 8px)
		         calc(env(safe-area-inset-bottom, 0px) + 10px)
		         max(12px, env(safe-area-inset-left, 0px) + 8px);
		background: var(--fm-bg, #fff);
		border-top: 1px solid var(--fm-line, #ececec);
		z-index: 40;
		gap: 8px;
		flex-wrap: nowrap;
		justify-content: space-between;
		align-items: center;
		box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.05);
	}
	.fm-control-body.fm-theme-dark .fm-control__head {
		background: #1b1b1a;
		border-top-color: #2a2a2e;
		box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.35);
	}
	.fm-control__head-actions {
		gap: 6px;
		margin-left: auto;
		flex-wrap: nowrap;
	}
	/* Language dropdown opens upward out of the bottom action bar. */
	.fm-control__head .fm-langs__menu {
		top: auto;
		bottom: calc(100% + 8px);
	}
	.fm-control__add-icon { width: 18px; height: 18px; }
	.fm-control__settings-btn,
	.fm-control__iconbtn { width: 40px; height: 40px; }

	.fm-control .fm-schedule__title { font-size: 26px; }
	.fm-control .fm-schedule__head { margin-bottom: 16px; }

	/* Schedule rows: 2-row layout — # on the far left, drag handle on
	   the far right (thumb-friendly + clear of the row tap target for
	   the drawer), pilot + model on row 1, time + status + actions on
	   row 2. The column headers are hidden since they no longer align
	   with the wrapped cell positions.
	   Six tracks:
	     1) 22px (#)
	     2) auto (time / pilot start)
	     3) auto (status)
	     4) 1fr  (spacer — absorbs leftover width on row 2 so the
	              action buttons + trash drift all the way to the
	              right edge instead of clinging to the status)
	     5) auto (buttons / model-name end)
	     6) 32px (drag handle) */
	.fm-control .fm-schedule__grid {
		grid-template-columns: 22px auto auto minmax(0, 1fr) auto 32px;
		grid-template-rows: auto auto;
		column-gap: 8px;
		row-gap: 4px;
		align-items: center;
		gap: 8px 8px;
	}
	.fm-control .fm-schedule__headrow { display: none; }
	.fm-control .fm-schedule__main {
		display: grid;
		padding: 12px;
	}
	.fm-control .fm-schedule__chev { display: none; }

	.fm-control .fm-schedule__cell--num {
		grid-column: 1; grid-row: 1 / span 2;
		align-self: start;
		padding-top: 2px;
	}
	.fm-control .fm-schedule__cell--pilot {
		grid-column: 2 / 5; grid-row: 1;
		min-width: 0;
		font-size: 15px;
		font-weight: 600;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		justify-self: stretch;
	}
	/* Model cell is display:contents from fm-public.css mobile rules,
	   we re-place its children inside the 6-column /control/ grid. */
	.fm-control .fm-schedule__cell--model { display: contents; }
	.fm-control .fm-schedule__model-name {
		grid-column: 5; grid-row: 1;
		justify-self: end;
		font-size: 13px;
		font-weight: 500;
		color: var(--fm-text);
		max-width: 45vw;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.fm-control .fm-schedule__model-specs { display: none; }

	.fm-control .fm-schedule__cell--time {
		grid-column: 2; grid-row: 2;
		font-size: 13px;
		justify-self: start;
		padding-left: 0;
	}
	.fm-control .fm-schedule__cell--status {
		grid-column: 3; grid-row: 2;
		justify-self: start;
		/* Pulls the status pill away from the time digit so the
		   coloured dot doesn't kiss the last numeral. */
		padding-left: 8px;
	}
	.fm-control__buttons {
		grid-column: 5; grid-row: 2;
		justify-self: end;
		gap: 4px;
		width: auto;
	}
	/* Drag handle parked on the right edge, full row height, sized for
	   a thumb. */
	.fm-control__drag {
		grid-column: 6; grid-row: 1 / span 2;
		align-self: stretch;
		width: 32px;
		height: auto;
		min-height: 48px;
		opacity: 0.55;
		border-radius: 6px;
	}
	.fm-control__drag svg { width: 12px; height: 20px; }
	.fm-control__btn {
		padding: 5px 10px;
		font-size: 12px;
		min-height: 28px;
	}

	.fm-schedule__now-line { padding-top: 4px; padding-bottom: 4px; font-size: 10.5px; }

	/* Simplified-tables variant on /operator/ mobile: model cell stays
	   out of the flow, so let the pilot name expand to cover the
	   space it used to share. The drag handle keeps column 6 in the
	   six-track layout. */
	.fm-control .fm-schedule--simple .fm-schedule__cell--model { display: none; }
	.fm-control .fm-schedule--simple .fm-schedule__cell--pilot {
		grid-column: 2 / 6;
	}

	.fm-control__add-grid {
		grid-template-columns: 1fr;
		gap: 10px;
	}
	.fm-control__field--narrow { max-width: 100%; }
	.fm-control__add-actions { width: 100%; }
	.fm-control__submit,
	.fm-control__cancel { min-height: 44px; flex: 1; }

	/* Dialogs on mobile: keep the browser's native modal centring (solid
	   on real mobile Safari + Chrome — do NOT re-position the dialog) and
	   only cap the size so a 16px gutter is left on every screen edge,
	   with all corners rounded. The dialog itself scrolls when it is
	   taller than the viewport. */
	.fm-control__settings {
		width: calc(100% - 32px);
		max-width: none;
		max-height: calc(100% - 32px);
		margin: auto;
		padding: 0;
		border-radius: 16px;
		overflow-y: auto;
		overscroll-behavior: contain;
	}
	.fm-control__settings-form {
		border-radius: 16px;
		padding: 18px 16px;
	}
	.fm-control__settings-form input[type="datetime-local"],
	.fm-control__settings-form input[type="number"],
	.fm-control__add-form input,
	.fm-control__add-form select {
		font-size: 16px; /* prevents iOS zoom-on-focus */
		padding: 10px 12px;
	}
	.fm-control__add-form select,
	.fm-control__settings-form select {
		padding-right: 32px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fm-schedule__list.is-reordering .fm-schedule__row:not(.is-dragging) { transition: none; }
}

/* Slot lanes on /operator/: the operator schedule grid prepends a
   drag handle column, so the Time cell sits in track 3 instead of
   track 2. Re-anchor the slot label so it lines up under TIME. */
.fm-control .fm-schedule__slot-label {
	grid-column: 3 / span 1;
}

/* Quick toggles in the operator header — Preview and Slots live here
   now (moved out of the Settings dialog) so the operator can flip
   between modes without opening a modal. Visually compact: a pill
   border around a tiny .fm-toggle plus its text label. */
.fm-control__head-quick {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-left: auto; /* sits to the left of .fm-control__head-actions */
}
.fm-control__head-quick + .fm-control__head-actions {
	margin-left: 6px; /* override the auto that pushes head-actions */
}
.fm-control__quick-toggle {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 8px 4px 6px;
	border: 0;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 500;
	color: var(--fm-text-soft);
	background: transparent;
	transition: color 120ms var(--fm-ease), background-color 120ms var(--fm-ease);
	min-height: 36px;
	cursor: pointer;
}
.fm-control__quick-toggle:hover {
	color: var(--fm-text);
	background: var(--fm-hover);
}
.fm-control__quick-toggle .fm-toggle__track {
	width: 30px;
	height: 18px;
}
.fm-control__quick-toggle .fm-toggle__thumb {
	width: 14px;
	height: 14px;
	top: 2px;
	left: 2px;
}
.fm-control__quick-toggle .fm-toggle__input:checked ~ .fm-toggle__track .fm-toggle__thumb {
	transform: translateX(12px);
}
.fm-control__quick-toggle-label {
	font-size: 12px;
	color: inherit;
}

/* Small helper text under the simplified-tables toggle in the Settings
   dialog, pointing operators at the new header location for the Preview
   and Slots toggles. */
.fm-control__field-note {
	margin: 4px 0 0;
	font-size: 12px;
	color: var(--fm-text-mute);
}

@media (max-width: 820px) {
	/* The two quick toggles (Preview / Slots) leave the crowded bottom
	   action bar and pin to the top-right of the page, lined up with the
	   "Flights" title — that frees room in the bottom bar for the icon
	   buttons. Fixed (not in the bottom bar's flow) and offset to where
	   the title sits at scroll-top so the row reads as centred on it. */
	.fm-control__head-quick {
		position: fixed;
		top: 12px;
		right: max(16px, env(safe-area-inset-right, 0px) + 8px);
		margin: 0;
		gap: 4px;
		z-index: 41;
		align-items: center;
		padding: 2px 4px;
		border-radius: 999px;
		background: var(--fm-bg, #fff);
	}
	/* When the cross-portal top bar is present the content (and the
	   title) start below it — drop the toggles flush under the bar. */
	.fm-control:has( > .fm-schedule__foot--bar ) .fm-control__head-quick {
		top: calc(env(safe-area-inset-top, 0px) + 56px);
	}
	.fm-control-body.fm-theme-dark .fm-control__head-quick {
		background: #1b1b1a;
	}
	.fm-control__quick-toggle-label { display: none; }
	.fm-control__quick-toggle {
		padding: 4px 6px;
		min-height: 36px;
	}
}
