/* App-wide layering on top of Fluent's design tokens: the page itself sits on a muted
   "canvas" background so elevated surfaces (FluentCard, the nav rail, dialogs) stand out
   against it instead of blending into a single flat colour. Theme (light/dark) itself is
   managed by Fluent's own IThemeService/Blazor.theme JS, which defaults to the system
   preference and persists any explicit choice — this file only layers on top of it.

   Every colour here is a Fluent token, so both themes follow automatically. */

body {
    margin: 0;
}

/* Routes.razor sets the brand colour exactly (#0B6374), and Fluent derives every other brand shade
   from it. Pinning it exactly flattens some of that ramp, so a few shades are set here instead, all
   from the STNA design system:
   - Light: the hover shades equal the brand itself, so primary buttons, checkboxes and the like
     showed no hover; they take the darker brand-hover.
   - Dark: brand text (links, the active nav item, selected tabs) would be the exact brand, too dark
     to read on dark grounds, and Fluent's lighter shade of it is a greyish #6D98A3. Text, icons and
     the "compound" controls (checkbox and radio fills, the selected-tab and focused-input lines)
     take the design system's dark brand-foreground, and brand outlines (the Open status) its dark
     brand-stroke, so they hold 3:1 or better on every dark ground. Brand backgrounds (primary
     buttons) keep the exact colour. */
body:not([data-theme=dark]) {
    --colorBrandBackgroundHover: #095665;
    --colorCompoundBrandBackgroundHover: #095665;
    --colorCompoundBrandStrokeHover: #095665;
}

body[data-theme=dark] {
    --stna-brand-text: #4fb3c4;
    --stna-brand-text-hover: #82cbd7;
    --colorBrandForeground1: var(--stna-brand-text);
    --colorBrandForegroundLink: var(--stna-brand-text);
    --colorBrandForegroundLinkHover: var(--stna-brand-text-hover);
    --colorBrandForegroundLinkPressed: var(--stna-brand-text);
    --colorBrandForegroundLinkSelected: var(--stna-brand-text);
    --colorCompoundBrandForeground1: var(--stna-brand-text);
    --colorNeutralForeground2BrandSelected: var(--stna-brand-text);
    --colorCompoundBrandStroke: var(--stna-brand-text);
    --colorCompoundBrandStrokeHover: var(--stna-brand-text-hover);
    --colorCompoundBrandBackground: var(--stna-brand-text);
    --colorCompoundBrandBackgroundHover: var(--stna-brand-text-hover);
    --colorBrandStroke1: #3c96a6;
}

/* The STNA mark's two inks (StnaMark.razor): its lit block and the rest. They are the logo's fixed colours from the
   STNA design system rather than Fluent tokens, so the mark is right before Fluent's theme script has run. On a
   brand-coloured ground (OnBrand) it is white and the light brand shade in both themes. */
body {
    --stna-mark-lit: #0b6374;
    --stna-mark-rest: #3d8f9e;
}

body[data-theme=dark] {
    --stna-mark-lit: #4fb3c4;
    --stna-mark-rest: #0b6374;
}

/* The voice in an area's load (AreaLoadRow, and its key in AllocationTimeline's legend): the voice nets platforms share in blue,
   the voice channels network managers add in aqua. Categorical slots 1 and 3 of the data-visualisation palette, each
   theme's own steps, checked for colour-vision separation against both surfaces; slot 2 (orange) would read as the chart's
   over-limit warning, and violet is too close to blue. */
body {
    --stna-load-voice: #2a78d6;
    --stna-load-added-voice: #1baf7a;
}

body[data-theme=dark] {
    --stna-load-voice: #3987e5;
    --stna-load-added-voice: #199e70;
}

.stna-mark {
    flex: none;
    width: auto;
    aspect-ratio: 56 / 48;
    fill: var(--stna-mark-rest);
}

.stna-mark .stna-mark-lit {
    fill: var(--stna-mark-lit);
}

.stna-mark.stna-mark-on-brand {
    --stna-mark-lit: #ffffff;
    --stna-mark-rest: #4fb3c4;
}

/* Fallback series colours, for operating areas and squadrons with no colour of their own (the area load chart, the
   allocation timeline): the categorical slots in order, validated together against each theme's surface (dataviz
   validate_palette: light on #ffffff, dark on #292929). */
body {
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --series-5: #e87ba4;
    --series-6: #008300;
    --series-7: #6250d6;
    --series-8: #e34948;
}

body[data-theme=dark] {
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
}

/* FocusOnNavigate (Routes.razor) moves focus to each page's <h1> for screen readers; that
   programmatic focus shouldn't draw a focus ring around the title. */
h1:focus {
    outline: none;
}

/* ---------------------------------------------------------------------------------------
   App shell (MainLayout). The canvas is set on the content area rather than <body>:
   Fluent's own default-fuib.css is injected after this file and resets the body background.
   --------------------------------------------------------------------------------------- */

/* Qualified with .fluent-layout-item to outrank Fluent's own [area=…] rules (which give the
   header a brand-coloured background, for one). */
.fluent-layout-item.app-header {
    padding-inline: 20px;
    color: var(--colorNeutralForeground1);
    background-color: var(--colorNeutralBackground4);
    box-shadow: var(--shadow4);
}

/* The hamburger button colours itself for a brand-coloured header (inline style). */
.app-header-row .fluent-layout-hamburger fluent-button {
    color: var(--colorNeutralForeground1) !important;
}

/* No `gap` on this row: the hamburger's drawer is a zero-size element that still takes a gap
   slot, which pushed the brand out of line with the nav icons below it. */
.app-header-row {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
}

.app-header-row .fluent-layout-hamburger {
    margin-inline-end: 8px;
}

/* The STNA mark beside the app's name; the name gives way (ellipsis) on a narrow screen, the mark never. */
.app-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    color: var(--colorNeutralForeground1);
    font-size: var(--fontSizeBase400);
    font-weight: var(--fontWeightBold);
    line-height: var(--lineHeightBase400);
    text-decoration: none;
    white-space: nowrap;
}

.app-brand-mark {
    height: 20px;
}

.app-brand-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header-end {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-inline-start: auto;
}

.fluent-layout-item.app-nav {
    background-color: var(--colorNeutralBackground4);
    border-inline-end: var(--strokeWidthThin) solid var(--colorNeutralStroke2);
    transition: width 0.15s ease;
    overflow-x: hidden;
}

.fluent-layout-item.app-content {
    --app-gutter: 32px;
    background-color: var(--colorNeutralBackground3);
    padding: 24px var(--app-gutter) 40px;
}

/* In its mobile layout Fluent unsets the content area's right padding (`!important`), which ran
   every card and table into the right edge of the screen. */
.fluent-layout[mobile] .fluent-layout-item.app-content {
    padding-right: var(--app-gutter) !important;
}

.app-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 1440px;
}

/* A page whose root is .page-fill (the allocation calendar) fills the content area instead: as wide as the area, not the
   1440px reading width, and as tall as it when its content is shorter. The area becomes a flex column for the page to
   take what is left of; the page never shrinks below its content, so in a window too short for it the area scrolls, as
   it does for every other page. The area's bottom padding is the side gutter, so the page has the same margin on three
   sides. */
.fluent-layout-item.app-content:has(.page-fill) {
    display: flex;
    flex-direction: column;
    padding-bottom: var(--app-gutter);
}

.app-page:has(.page-fill) {
    flex: 1 0 auto;
    max-width: none;
}

.page-fill {
    flex: 1 0 auto;
}

@media (max-width: 600px) {
    .fluent-layout-item.app-content {
        --app-gutter: 16px;
        padding-block: 16px;
    }

    /* Beside the mark, "JCSys STNA" was cut to "JCSys …" on a phone: the mark and "STNA" carry the brand. */
    .app-brand-org {
        display: none;
    }

    /* The name, bell, avatar and sign-out didn't fit beside the brand on a phone, pushing "Sign out"
       off the screen; the avatar (which links to the profile) stands in for the name. */
    .fluent-layout-item.app-header {
        padding-inline: 12px;
    }

    .app-user-name {
        display: none;
    }
}

/* ---------------------------------------------------------------------------------------
   Text
   --------------------------------------------------------------------------------------- */

/* Supporting copy: page and section descriptions, explanations in dialogs. */
.text-secondary {
    color: var(--colorNeutralForeground2);
}

/* De-emphasised detail: secondary lines in table cells, footnotes, counts. */
.text-muted {
    color: var(--colorNeutralForeground3);
}

/* ---------------------------------------------------------------------------------------
   Page structure: PageHeader, the filter toolbar under it, and section headings in cards.
   --------------------------------------------------------------------------------------- */

/* Stretches itself: the vertical FluentStacks pages are built from don't stretch their children. */
.page-header {
    display: flex;
    align-self: stretch;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 24px;
}

.page-header-text {
    display: flex;
    flex: 1 1 24rem;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.page-header-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.page-header-description {
    max-width: 75ch;
}

/* Buttons are 32px tall and the title line 36px: the top margin centres them on the title. On a narrow screen they
   take a line of their own and wrap within the page's width. */
.page-header-actions {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    margin-top: 2px;
}

.page-header-actions fluent-button,
.page-header-actions fluent-anchor-button {
    white-space: nowrap;
}

/* A compact header: one row, the title and its description side by side (the description drops under the title when
   they don't fit), and the actions centred on it. */
.page-header-compact {
    align-items: center;
    gap: 8px 24px;
}

.page-header-compact .page-header-text {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 16px;
}

.page-header-compact .page-header-description {
    flex: 1 1 18rem;
    max-width: none;
}

.page-header-compact .page-header-actions {
    margin-top: 0;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px 16px;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

/* A card's heading with the explanation under it. */
.section-intro {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Forms and settings read better in a column than stretched across a wide screen. */
.page-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 52rem;
}

/* ---------------------------------------------------------------------------------------
   Surfaces
   --------------------------------------------------------------------------------------- */

/* Fluent's default card padding (12px) is tight for the forms and detail grids the app puts
   in cards; list cards opt out entirely with .table-card. */
.fluent-card {
    padding: 20px 24px;
}

/* Fluent pads tab panels 8px all round, which set every card in a tab 8px in from the page's
   left edge. The panels' own content sets the space under the tab strip. */
.fluent-tab-panel {
    padding-inline: 0;
}

/* Each tab is padded 10px either side, so the strip's first label sat 12px in from the page's left
   edge, out of line with the title, breadcrumb and cards. Pulled back by that padding, the selected
   tab's underline starts on the page's edge. Tabs wider together than a phone screen wrap onto a
   second row, rather than push the page sideways. */
.fluent-tabs > fluent-tablist {
    margin-inline-start: -10px;
    flex-wrap: wrap;
}

/* Dialog actions sit side by side, right-aligned. Fluent stacks them in a column whenever the
   dialog is under 480px wide (an !important container query), which is every small dialog;
   this outranks it. They still wrap onto a second row if a phone screen can't fit them. */
fluent-dialog fluent-dialog-body[fuib] > div[slot=action] {
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* A card holding a FluentDataGrid edge to edge. Scrolls sideways rather than squeezing the
   columns below their minimum widths on narrow screens. */
.fluent-card.table-card {
    padding: 0;
    overflow-x: auto;
}

/* ---------------------------------------------------------------------------------------
   Data grids
   --------------------------------------------------------------------------------------- */

/* Header titles sit 20px in (2px cell + 6px wrapper + 12px title padding) while body cells
   used 18px, so every column's content started 2px left of its heading. */
.fluent-data-grid td:not([col-select=true]) {
    padding-inline: 20px;
}

.fluent-data-grid th[cell-type=columnheader] {
    color: var(--colorNeutralForeground2);
    background-color: var(--colorNeutralBackground2);
}

.table-card .fluent-data-grid tbody tr:last-child > td {
    border-bottom: none;
}

/* Multi-line rows (MultiLine="true") grow with their content; keep them at least the medium
   row height, with the content centred like single-line rows. */
.fluent-data-grid td[multiline=true] {
    min-height: 52px;
    padding-block: 8px;
    align-content: center;
    overflow: visible;
}

/* A cell holding a primary line with a secondary line under it (name over login name, …). */
.cell-stack {
    display: flex;
    flex-direction: column;
    line-height: var(--lineHeightBase300);
}

/* A squadron's remarks on its allocation request, in a column of their own: kept to the lines it
   wrote them on, and wrapped however long a word. */
.request-remarks {
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.cell-stack > .text-muted {
    font-size: var(--fontSizeBase200);
    line-height: var(--lineHeightBase200);
}

.cell-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* A badge is one line: wrapping its text ("4 / approved") in a narrow column clipped the second line. */
.cell-badges fluent-badge {
    white-space: nowrap;
}

/* A cell led by a colour swatch (a squadron's colour beside its name). */
.cell-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* A small square of an item's colour, given by an inline background-color. */
.color-swatch {
    flex: none;
    width: 16px;
    height: 16px;
    border-radius: var(--borderRadiusSmall);
    border: 1px solid var(--colorNeutralStroke1);
}

/* No colour chosen: an empty outline, struck through. */
.color-swatch-none {
    border-style: dashed;
    background: linear-gradient(to top right, transparent calc(50% - 0.5px), var(--colorNeutralStroke1) 50%, transparent calc(50% + 0.5px));
}

/* ---------------------------------------------------------------------------------------
   Forms. FluentField adds 12px above and below every field (.my-3-o); the stacks and grids
   that hold fields already set the gaps, so the extra margins only made spacing uneven.
   --------------------------------------------------------------------------------------- */

fluent-field.my-3-o {
    margin-block: 0;
}

/* FluentSelect always renders a message slot, even with no message; the empty slot made a
   select a few pixels taller than a text input beside it, so they never lined up. */
fluent-field > [slot=message]:empty {
    display: none;
}

/* A medium dropdown (FluentSelect, the time picker) pads its control 6px above and below, making it
   34px tall to a text input's 32px, so a select beside an input or date picker sat 2px out of line
   with it. 5px brings it to 32px; the list of options keeps the standard spacing. */
fluent-dropdown:not([size]) {
    --spacingVerticalSNudge: 5px;
}

fluent-dropdown > fluent-listbox {
    --spacingVerticalSNudge: 6px;
}

/* The chosen option's text is allowed to wrap, and the control hides anything past one line, so a
   long option showed only its first words ("IDS 1 ·"). One line, cut short with an ellipsis. */
fluent-dropdown > button {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* A field lays out its control in a grid track, which would otherwise widen to the whole chosen
   option and spill the select over whatever sits beside its field. */
fluent-field > fluent-dropdown {
    min-width: 0;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-grid {
    display: grid;
    gap: 16px 12px;
}

.form-grid > fluent-field {
    min-width: 0;
}

/* The name row and the contact row under it share columns, so their fields' edges line up: the
   email spans the rank and first name, the telephone sits under the last name. */
.form-grid-name,
.form-grid-contact {
    grid-template-columns: minmax(6rem, 8rem) 1fr 1fr;
}

.form-grid-contact > :first-child {
    grid-column: span 2;
}

/* Two fields side by side, the width of the form between them. */
.form-grid-pair {
    grid-template-columns: 1fr 1fr;
}

/* A collapsible group of optional fields (a FluentAccordionItem) inside a form: its heading and
   content line up with the fields around it rather than being inset by the accordion's padding,
   and it is as wide as the form, not just as wide as its widest line (the item's own
   `max-width: fit-content`, which left a full-width field the width of the longest note). */
.form-section {
    max-width: none;
}

.form-section::part(heading) {
    padding-inline-start: 0;
}

.form-section::part(content) {
    margin-inline: 0;
}

/* A labelled group inside a form (a user's squadrons), packed tighter than the form's fields. */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* One squadron membership: the squadron's name, the role in it and its remove button. */
.membership-row {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) auto auto;
    align-items: center;
    gap: 8px;
}

/* A row of controls that line up by their inputs: a select and the button that applies it. */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

@media (max-width: 600px) {
    .form-grid-name,
    .form-grid-contact,
    .form-grid-pair {
        grid-template-columns: 1fr;
    }

    .form-grid-contact > :first-child {
        grid-column: auto;
    }
}

/* ---------------------------------------------------------------------------------------
   Allocation plans.
   --------------------------------------------------------------------------------------- */

/* A tab's content sits a little below the tab strip, its cards and headings spaced like a page's. */
.tab-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
}

/* A date and a time of day side by side (ZonedDateTimeInput). */
.date-time-input {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
}

/* The plan page's request button and its menu: the menu opens as wide as the button, chevron and all, rather than at
   Fluent's 160px minimum. The popup is anchored to the chevron alone, so the whole split button is named as an anchor of
   its own to size the list by. Where anchor sizing isn't supported the width is dropped and the menu keeps its default. */
.request-split {
    anchor-name: --request-split;
}

.request-split > fluent-menu-list {
    width: anchor-size(--request-split width);
    min-width: 0;
}

/* One IDS of a request: the data set, how many units load it, and its remove button. */
.platform-row {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) auto auto;
    align-items: center;
    gap: 8px;
}

/* Held to its column: otherwise a long chosen IDS widened the select over the units beside it. */
.platform-row > fluent-field {
    min-width: 0;
}

/* Tabs whose active tab takes the height the page has left (see .page-fill), for a tab whose content fills it
   (.tab-fill). The tab strip keeps its own height; a hidden panel stays hidden. */
.fluent-tabs.tabs-fill {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
}

.tabs-fill > .fluent-tab-panel:not([hidden]) {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
}

/* The panel's own padding is dropped: the content sits the tab body's margin below the strip, and meets the page's
   bottom edge. */
.tabs-fill > .fluent-tab-panel {
    padding-block: 0;
}

/* Small tabs are padded 8px either side, not the 10px the strip is pulled back by for the others. */
.fluent-tabs.tabs-fill > fluent-tablist {
    margin-inline-start: -8px;
}

.tab-body.tab-fill {
    flex: 1 0 auto;
}

/* The card the allocation timeline is in lets it take the card's height. */
.fluent-card.timeline-card {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
}

/* The allocation timeline's filter popover (TimelineFilterMenu): how the rows are grouped, what is left out or shown,
   and, under a rule, the way back to the defaults. */
.filter-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-heading {
    margin-bottom: 2px;
    font-size: var(--fontSizeBase300);
    font-weight: var(--fontWeightSemibold);
}

/* Why a choice is unavailable, when it is. */
.filter-hint {
    margin-top: 4px;
    font-size: var(--fontSizeBase200);
    line-height: var(--lineHeightBase200);
}

.filter-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--colorNeutralStroke2);
}

/* A plan page's button for a step something may stop ("Open to squadrons", "Close plan") when it is disabled (ProblemButton): the wrapper that catches the pointer
   the disabled button won't, and the warning popover listing what the plan still needs. */
.open-plan-anchor {
    display: inline-flex;
}

.problems-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px;
}

.problems-heading {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fontSizeBase300);
    font-weight: var(--fontWeightSemibold);
}

.problems-list {
    margin: 0;
    padding-inline-start: 20px;
    font-size: var(--fontSizeBase200);
    line-height: var(--lineHeightBase200);
}

.problems-list li + li {
    margin-top: 4px;
}

/* A squadron's buttons in its heading on the allocation timeline. */
.timeline-squadron-actions {
    display: inline-flex;
    gap: 2px;
}

/* A published week's choice of layer (WeeklyPlanPage): the allocations as they actually are, or as planned. Two plain
   buttons in one outline, the pressed one filled: a toggle button flips its own pressed state when pressed again. */
.layer-switch {
    display: inline-flex;
    flex: none;
    border: 1px solid var(--colorNeutralStroke1);
    border-radius: var(--borderRadiusMedium);
    overflow: hidden;
}

.layer-switch-option {
    margin: 0;
    padding: 4px 10px;
    font: inherit;
    font-size: var(--fontSizeBase200);
    line-height: var(--lineHeightBase200);
    white-space: nowrap;
    color: var(--colorNeutralForeground2);
    cursor: pointer;
    background: var(--colorNeutralBackground1);
    border: 0;
}

.layer-switch-option + .layer-switch-option {
    border-left: 1px solid var(--colorNeutralStroke1);
}

.layer-switch-option:hover {
    background-color: var(--colorSubtleBackgroundHover);
}

.layer-switch-option[aria-pressed="true"] {
    color: var(--colorNeutralForegroundOnBrand);
    background-color: var(--colorBrandBackground);
}

/* The timeline's last layer shown, which can't be turned off. */
.layer-switch-option:disabled {
    cursor: default;
}

.layer-switch-option:focus-visible {
    outline: 2px solid var(--colorStrokeFocus2);
    outline-offset: -2px;
}

/* What sits above a tab's card, e.g. the Allocations tab's layer switch. */
.tab-tools {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

/* An allocation not as planned, in the Allocations table: a small mark in the warning colour the timeline's notch
   wears, then what changed it; the reason is in its tooltip. */
.allocation-changed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.allocation-changed-mark {
    width: 8px;
    height: 8px;
    flex: none;
    background-color: var(--colorStatusWarningBorderActive);
    clip-path: polygon(0 0, 100% 0, 100% 100%);
}

/* The Changes tab: each change a line of what it changed; a row that concerns an allocation opens it. */
.changes-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.changes-list li + li {
    margin-top: 2px;
}

.changes-reason {
    color: var(--colorNeutralForeground2);
    font-style: italic;
}

.changes-row-link {
    cursor: pointer;
}

/* A squadron's or area's heading on the allocation timeline (RequestGroupLabel): its swatch, name and count. */
.request-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    min-width: 0;
}

.request-group-name {
    font-weight: var(--fontWeightSemibold);
}

/* The flag's slot is 16px wide whether or not it holds an icon, so the figures stay aligned. */
.peak-flag {
    display: inline-flex;
    flex: none;
    width: 16px;
}

.peak-flag > span {
    display: inline-flex;
}

/* What the flag says, for screen readers only. */
.peak-flag-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------------------
   Notifications: the header bell's panel.
   --------------------------------------------------------------------------------------- */

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

.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.notification-panel-empty {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.notification-list {
    display: flex;
    flex-direction: column;
    max-height: 420px;
    overflow-y: auto;
}

/* A notification is a button the width of the panel: clicking it opens what it is about. */
.notification-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    border: none;
    border-radius: var(--borderRadiusMedium);
    background: transparent;
    color: var(--colorNeutralForeground1);
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.notification-item:hover {
    background: var(--colorNeutralBackground1Hover);
}

/* Unread: a bar at the start, so it doesn't rely on weight alone. */
.notification-item-unread {
    box-shadow: inset 3px 0 0 var(--colorBrandStroke1);
}

.notification-item-unread .notification-item-title {
    font-weight: var(--fontWeightSemibold);
}

.notification-item-body {
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase200);
    white-space: pre-line;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-item-time {
    color: var(--colorNeutralForeground3);
    font-size: var(--fontSizeBase100);
}

/* ---------------------------------------------------------------------------------------
   Home: the welcome page's cards (Components/Features/Home). A main column of what concerns the
   viewer, and the notifications in a narrower one beside it; one column on a narrow screen. A card
   is a light header (small icon, title, count, an action) over a list divided by hairlines. Keep it
   quiet: statuses are a word behind a small dot (StatusDot), never a filled badge, and a line says
   one thing; detail such as each platform's STNs folds away until it is asked for.
   --------------------------------------------------------------------------------------- */

.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    align-items: start;
    align-self: stretch;
    gap: 16px;
}

.home-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

@media (max-width: 1100px) {
    .home-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.home-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 4px;
}

/* A plain icon in the brand colour, level with the title; no tile behind it. */
.home-card-icon {
    display: inline-flex;
    flex: none;
    padding-top: 2px;
    color: var(--colorBrandForeground1);
}

/* What waits on the viewer. */
.home-card-icon[data-tone="attention"] {
    color: var(--colorStatusWarningForeground1);
}

.home-card-heading {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.home-card-count {
    margin-inline-start: 6px;
    color: var(--colorNeutralForeground3);
    font-weight: var(--fontWeightRegular);
    font-variant-numeric: tabular-nums;
}

.home-card-description {
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase200);
}

.home-card-action {
    flex: none;
    margin-inline-start: auto;
}

.home-empty {
    margin: 0;
    padding: 8px 0 0;
    color: var(--colorNeutralForeground2);
}

.home-loading {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

/* A sub-heading within a card: "Active now", "Latest decisions". */
.home-section {
    margin: 16px 0 0;
    padding-bottom: 6px;
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase200);
    font-weight: var(--fontWeightSemibold);
}

.home-section-count {
    margin-inline-start: 4px;
    color: var(--colorNeutralForeground3);
    font-weight: var(--fontWeightRegular);
}

.home-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-list > li {
    padding-block: 10px;
    border-top: 1px solid var(--colorNeutralStroke2);
}

.home-list > li:last-child {
    padding-bottom: 0;
}

/* A status: a word behind a small dot of its colour. */
.home-status {
    --tone: var(--colorNeutralForeground3);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.home-status-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tone);
}

.home-status[data-tone="brand"] {
    --tone: var(--colorBrandStroke1);
}

.home-status[data-tone="warning"] {
    --tone: var(--colorStatusWarningBorderActive);
}

.home-status[data-tone="success"] {
    --tone: var(--colorStatusSuccessBorderActive);
}

.home-status[data-tone="danger"] {
    --tone: var(--colorStatusDangerBorderActive);
}

/* ---- An item: what it is on the left, what to do about it on the right. ---- */

.home-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
}

.home-item-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.home-item-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    font-weight: var(--fontWeightSemibold);
}

.home-item-title > .text-secondary {
    font-weight: var(--fontWeightRegular);
}

.home-item-action {
    flex: none;
    justify-self: end;
}

.home-deadline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 6px;
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase200);
}

.home-deadline > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Closing within the day: in the warning colour, and bolder, so it is not only a colour. */
.home-deadline-soon {
    color: var(--colorStatusWarningForeground1);
    font-weight: var(--fontWeightSemibold);
}

/* ---- The review queue: how many to review, large, then the plan. ---- */

.home-queue {
    display: flex;
    align-items: center;
    gap: 16px;
}

.home-queue-figure {
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    width: 64px;
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase100);
    line-height: var(--lineHeightBase100);
}

.home-queue-number {
    color: var(--colorStatusWarningForeground1);
    font-size: var(--fontSizeBase600);
    font-weight: var(--fontWeightSemibold);
    line-height: var(--lineHeightBase600);
    font-variant-numeric: tabular-nums;
}

.home-queue-figure[data-none] .home-queue-number {
    color: var(--colorNeutralForeground3);
}

/* ---- Rows: one plan a line, its columns lined up down the card. ---- */

.home-rows > .home-row {
    display: grid;
    grid-template-columns: minmax(0, 11rem) 7.5rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 16px;
}

.home-row-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-weight: var(--fontWeightSemibold);
}

.home-row-name > .text-muted {
    font-size: var(--fontSizeBase200);
    font-weight: var(--fontWeightRegular);
}

.home-row-detail {
    min-width: 0;
    color: var(--colorNeutralForeground2);
}

.home-row-detail strong {
    color: var(--colorNeutralForeground1);
}

.home-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

@media (max-width: 760px) {
    .home-rows > .home-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .home-row-stage,
    .home-row-detail {
        grid-column: 1 / -1;
    }

    .home-rows > .home-row > .home-item-action {
        grid-row: 1;
        grid-column: 2;
    }
}

/* ---- Feed lines: decisions and suggestions, one line each and a comment under it. ---- */

.home-feed-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 12px;
}

.home-feed-where {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
    min-width: 0;
}

.home-feed-when {
    margin-inline-start: auto;
    color: var(--colorNeutralForeground3);
    font-size: var(--fontSizeBase200);
    white-space: nowrap;
}

.home-feed-comment {
    margin-top: 2px;
    color: var(--colorNeutralForeground3);
    font-size: var(--fontSizeBase200);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* A squadron: its name behind a dot of its colour. */
.home-squadron {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--colorNeutralForeground1);
    white-space: nowrap;
}

.home-squadron-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--key);
}

/* ---- Approved allocations: under their plan, one line each, opening to each platform's STNs. ---- */

.home-group + .home-group {
    margin-top: 8px;
}

.home-group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 10px;
    margin: 12px 0 0;
    padding-bottom: 6px;
    font-size: var(--fontSizeBase300);
    font-weight: var(--fontWeightSemibold);
}

/* A link in a heading underlines itself; the plan's name reads as a link as it does elsewhere on the page. */
.home-group-head > fluent-link {
    text-decoration: none;
}

.home-group-head > .text-muted,
.home-group-head > .home-status {
    font-size: var(--fontSizeBase200);
    font-weight: var(--fontWeightRegular);
}

.home-allocs {
    display: flex;
    flex-direction: column;
}

.home-alloc {
    border-top: 1px solid var(--colorNeutralStroke2);
}

.home-alloc > summary {
    display: grid;
    grid-template-columns: 7.5rem 9.25rem minmax(0, 8rem) minmax(0, 1fr) 16px;
    align-items: center;
    gap: 4px 12px;
    padding: 8px 4px;
    border-radius: var(--borderRadiusMedium);
    list-style: none;
    cursor: pointer;
}

.home-alloc > summary::-webkit-details-marker {
    display: none;
}

.home-alloc > summary:hover {
    background: var(--colorNeutralBackground1Hover);
}

.home-alloc > summary:focus-visible {
    outline: 2px solid var(--colorStrokeFocus2);
    outline-offset: -2px;
}

.home-alloc-window {
    font-weight: var(--fontWeightSemibold);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.home-alloc-where {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
    min-width: 0;
}

/* Two communities' ranges fit on a line beside the rest at a desktop width; more wrap. */
.home-alloc-stns {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    min-width: 0;
}

.home-alloc-chevron {
    color: var(--colorNeutralForeground3);
    transition: transform 0.15s ease;
}

.home-alloc[open] .home-alloc-chevron {
    transform: rotate(180deg);
}

.home-alloc-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 16px;
    padding: 0 4px 4px;
    font-size: var(--fontSizeBase200);
}

.home-alloc > .home-stns {
    margin: 0 0 8px 4px;
}

@media (max-width: 760px) {
    .home-alloc > summary {
        grid-template-columns: auto minmax(0, 1fr) 16px;
    }

    .home-alloc-where,
    .home-alloc-stns {
        grid-column: 1 / -2;
    }

    .home-alloc-chevron {
        grid-row: 1;
        grid-column: 3;
    }
}

.home-when {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: var(--borderRadiusCircular);
    background: var(--colorNeutralBackground3);
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase200);
    white-space: nowrap;
}

/* Under way: a dot as well as the colour, and the words say so. */
.home-when-now {
    background: var(--colorStatusSuccessBackground1);
    color: var(--colorStatusSuccessForeground1);
    font-weight: var(--fontWeightSemibold);
}

.home-when-now::before {
    content: "";
    width: 6px;
    height: 6px;
    margin-inline-end: 6px;
    border-radius: 50%;
    background: currentColor;
}

.home-stns {
    border-collapse: collapse;
    font-size: var(--fontSizeBase200);
}

.home-stns td {
    padding: 3px 16px 3px 0;
    vertical-align: middle;
}

.home-stns-ids,
.home-stns-group {
    white-space: nowrap;
}

.home-stns-ids {
    color: var(--colorNeutralForeground2);
    font-variant-numeric: tabular-nums;
}

.home-stns td.home-stns-values {
    padding-inline-end: 0;
}

.home-stn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.home-stns .home-stn {
    margin-inline-end: 16px;
}

.home-stn .color-swatch {
    width: 10px;
    height: 10px;
}

.home-stn code {
    font-weight: var(--fontWeightSemibold);
    font-variant-numeric: tabular-nums;
}

.home-more {
    margin: 12px 0 0;
    color: var(--colorNeutralForeground3);
    font-size: var(--fontSizeBase200);
}

/* The bell's items, the width of the card: their own padding lines their text up with the card's. */
.home-notifications {
    display: flex;
    flex-direction: column;
    margin-inline: -8px;
}

@media (max-width: 600px) {
    .home-item,
    .home-queue {
        flex-wrap: wrap;
    }
}

/* ---------------------------------------------------------------------------------------
   Allocation calendar (Components/Features/Allocations/Calendar): week, month, year and upcoming views of the plans,
   with a heat map of how many requests, or how much TSDF, each day or hour holds.

   A cell's tint mixes a share of the measure's hue (--cal-hue: blue for requests, orange for TSDF) into the page's own
   surface. The share is --heat, a percentage set inline on the cell and never more than 75%, so the text on the
   strongest tint is still legible. Mixing into the surface makes the scale follow the theme: a stronger tint is darker
   in the light theme and brighter in the dark one. Plans are chips of the surface with a status-coloured accent and
   neutral text, so the measure (the tint) and the plan (the chip) are never the same colour, and status is also an icon
   and a word. Tooltips only repeat what a cell's label already says.
   --------------------------------------------------------------------------------------- */

.cal {
    --cal-hue: var(--series-1);
    --cal-line: var(--colorNeutralStroke2);
    --cal-surface: var(--colorNeutralBackground1);
    --cal-neutral: var(--colorNeutralForeground3);
    --cal-open: var(--colorBrandStroke1);
    --cal-review: var(--colorStatusWarningBorderActive);
    --cal-published: var(--colorStatusSuccessBorderActive);
    --cal-closed: var(--colorNeutralStroke1);
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    padding: 12px 16px 16px;
}

/* The card the calendar is in lets it take the card's height: the toolbar and legend keep theirs and the view below
   them takes the rest (see .cal-body). */
.fluent-card.cal-card {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
}

.cal[data-metric="tsdf"] {
    --cal-hue: var(--series-2);
}

.cal .status-open { --accent: var(--cal-open); }
.cal .status-review { --accent: var(--cal-review); }
.cal .status-published { --accent: var(--cal-published); }
.cal .status-closed { --accent: var(--cal-closed); }

/* What a heat map tints: the surface, with --heat of the measure's hue mixed in. */
.cal-cell {
    background-color: color-mix(in oklab, var(--cal-hue) var(--heat, 0%), var(--cal-surface));
}

@supports not (background-color: color-mix(in oklab, red 50%, blue)) {
    .cal-cell[style*="--heat"] {
        background-color: var(--colorBrandBackground2);
    }
}

/* What a cell holds, for screen readers only. */
.cal-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---- The toolbar: the views, moving through them, and the heat map. ---- */

.cal-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
}

/* The views are links, as every other move in the calendar is, drawn as a strip of tabs: the one shown is underlined. */
.cal-modes {
    display: flex;
    flex: none;
    gap: 2px;
}

.cal-mode {
    padding: 6px 10px;
    border-bottom: 2px solid transparent;
    border-radius: var(--borderRadiusMedium) var(--borderRadiusMedium) 0 0;
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase300);
    line-height: var(--lineHeightBase300);
    text-decoration: none;
}

.cal-mode:hover {
    background-color: var(--colorNeutralBackground1Hover);
    color: var(--colorNeutralForeground1);
}

.cal-mode:focus-visible {
    outline: 2px solid var(--colorStrokeFocus2);
    outline-offset: -2px;
}

.cal-mode[aria-current="page"] {
    border-bottom-color: var(--colorBrandStroke1);
    color: var(--colorNeutralForeground1);
    font-weight: var(--fontWeightSemibold);
}

.cal-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.cal-title {
    margin: 0 0 0 8px;
    font-size: var(--fontSizeBase400);
    line-height: var(--lineHeightBase400);
    font-weight: var(--fontWeightSemibold);
    white-space: nowrap;
}

.cal-view-choice {
    margin-inline-start: auto;
}

/* ---- The legend: the scale, what a flag means, and the plan statuses. ---- */

.cal-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
    font-size: var(--fontSizeBase200);
    color: var(--colorNeutralForeground2);
}

.cal-scale {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cal-scale-bar {
    width: 120px;
    height: 10px;
    border: 1px solid var(--cal-line);
    border-radius: 2px;
    background: linear-gradient(to right, var(--cal-surface), color-mix(in oklab, var(--cal-hue) 75%, var(--cal-surface)));
}

.cal-key {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cal-key-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cal-key-swatch {
    width: 18px;
    height: 10px;
    border: 1px solid var(--cal-line);
    border-inline-start: 4px solid var(--accent);
    border-radius: 2px;
}

/* ---- A plan, as a bar across days. ---- */

.cal-bar {
    --accent: var(--cal-neutral);
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    box-sizing: border-box;
    min-width: 0;
    height: 22px;
    margin: 0 2px;
    padding: 0 6px;
    border: 1px solid var(--cal-line);
    border-inline-start: 4px solid var(--accent);
    border-radius: var(--borderRadiusSmall);
    background-color: var(--cal-surface);
    color: var(--colorNeutralForeground1);
    font-size: var(--fontSizeBase200);
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
}

.cal-bar:hover {
    background-color: var(--colorNeutralBackground1Hover);
}

.cal-bar:focus-visible,
.cal-day-number:focus-visible {
    outline: 2px solid var(--colorStrokeFocus2);
    outline-offset: 1px;
}

.cal-bar.continues-before {
    margin-inline-start: 0;
    border-start-start-radius: 0;
    border-end-start-radius: 0;
}

.cal-bar.continues-after {
    margin-inline-end: 0;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}

.cal-bar.continues-after::after {
    content: "\203A";
    margin-inline-start: auto;
    color: var(--colorNeutralForeground3);
}

.cal-bar-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Where requests close. */
.cal-flag {
    display: inline-flex;
    align-items: center;
    color: var(--colorNeutralForeground2);
}

/* ---- Month: weeks as rows of seven days. ---- */

/* The body is what is left of the calendar below the toolbar and legend, and its view takes all of it: a month's weeks
   and a year's rows grow to share the height, a week's hours too. A view never gets less than its content needs. */
.cal-body {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    min-width: 0;
    transition: opacity 150ms ease;
}

.cal-body > * {
    flex: 1 0 auto;
}

/* The frame drawn before is held, dimmed, while the next loads: the calendar neither blanks nor jumps. */
.cal-stale {
    opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
    .cal-body {
        transition: none;
    }
}

.cal-month {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--cal-line);
    border-radius: var(--borderRadiusMedium);
    background-color: var(--cal-line);
}

.cal-weekdays,
.cal-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background-color: var(--cal-line);
}

.cal-weekdays > span {
    padding: 6px 8px;
    background-color: var(--colorNeutralBackground2);
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase200);
    font-weight: var(--fontWeightSemibold);
}

.cal-weekday-short {
    display: none;
}

/* A week: a row for the day numbers, a lane for each line of bars, and the rest of the cell below them. The days span
   every row; the bars sit on the lanes above them. The weeks share the month's height equally, and the last row, which
   holds the rest of the cell, is what grows. It is never less than 49px, so a week is never less than 104px with a lane
   of bars, and a week with more lanes is as much taller. */
.cal-week {
    flex: 1 1 0;
    grid-template-rows: 28px repeat(var(--lanes, 1), 24px) minmax(49px, 1fr);
}

/* A day is positioned, beneath the bars, so the button that starts a request on it can cover it, and the link of its
   number lie above that. */
.cal-day {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    min-width: 0;
    padding: 4px 6px;
    color: var(--colorNeutralForeground1);
}

.cal-takes-requests:hover {
    box-shadow: inset 0 0 0 2px var(--colorBrandStroke1);
}

/* The button that starts a request on the day: the whole cell, labelled "+ Request" while it is pointed at or focused.
   A month's day carries the label in its top row, between its number and its value, and the clear button over it takes
   the clicks; a week's day carries it in the button. */
.cal-day-request {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6px 0 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.cal-day-request-label {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 0 6px 0 4px;
    border-radius: var(--borderRadiusMedium);
    background-color: var(--cal-surface);
    color: var(--colorBrandForeground1);
    font: inherit;
    font-size: var(--fontSizeBase200);
    font-weight: var(--fontWeightSemibold);
    line-height: 20px;
    white-space: nowrap;
    opacity: 0;
}

.cal-day-request:hover > .cal-day-request-label,
.cal-day-request:focus-visible > .cal-day-request-label,
.cal-day:has(> .cal-day-request:hover) .cal-day-request-label,
.cal-day:has(> .cal-day-request:focus-visible) .cal-day-request-label {
    opacity: 1;
}

/* No patch of surface on a day tinted by the heat map. */
.cal-day-top > .cal-day-request-label {
    min-width: 0;
    margin-inline: auto;
    overflow: hidden;
    background: none;
}

.cal-day-request-label > svg {
    flex: none;
}

/* A month's day too narrow for the word beside its number keeps only the plus. */
.cal-day {
    container-type: inline-size;
}

@container (max-width: 110px) {
    .cal-day-request-text {
        display: none;
    }
}

/* A day of the week view is a whole day of hours tall, so its label rides down the screen with it rather than sitting
   at midnight, out of sight. */
.cal-wk-day > .cal-day-request > .cal-day-request-label {
    position: sticky;
    top: 50vh;
}

.cal-wk-day:has(> .cal-day-request:hover) {
    box-shadow: inset 0 0 0 2px var(--colorBrandStroke1);
}

.cal-day-request:focus-visible {
    outline: 2px solid var(--colorStrokeFocus2);
    outline-offset: -2px;
}

.cal-day-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
}

.cal-day-number {
    position: relative;
    z-index: 1;
    min-width: 20px;
    padding: 0 4px;
    border-radius: var(--borderRadiusCircular);
    box-sizing: border-box;
    font-size: var(--fontSizeBase200);
    line-height: 20px;
    text-align: center;
    white-space: nowrap;
}

a.cal-day-number {
    color: inherit;
    text-decoration: none;
}

a.cal-day-number:hover {
    text-decoration: underline;
}

.cal-today .cal-day-number {
    background-color: var(--colorBrandBackground);
    color: var(--colorNeutralForegroundOnBrand);
}

.cal-out .cal-day-number {
    color: var(--colorNeutralForeground3);
}

.cal-day-value {
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase100);
    font-variant-numeric: tabular-nums;
    line-height: 20px;
}

.cal-day-marks {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 16px;
}

/* What the cell holds at its foot: the badges, and above the flags. */
.cal-day-foot {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

/* ---- Badges: a squadron's or an operating area's requests in a day or hour, in its colour. ----
   A squadron's is a pill and an area's has square corners, so the two can be told apart by more than their colours. A
   badge is the colour (--key) mixed into the surface behind a ring of the colour itself, with the text left neutral, so
   it reads on any colour and in both themes. */

.cal-badges {
    display: flex;
    align-items: center;
    gap: 2px 4px;
    min-width: 0;
}

.cal-badges-stacked {
    flex-direction: column;
    align-items: flex-start;
}

.cal-badge-group {
    display: inline-flex;
    gap: 2px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.cal-badge {
    --key: var(--series-1);
    box-sizing: border-box;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    border: 1px solid var(--key);
    border-radius: var(--borderRadiusCircular);
    background-color: color-mix(in oklab, var(--key) 32%, var(--cal-surface));
    color: var(--colorNeutralForeground1);
    font-size: var(--fontSizeBase100);
    font-variant-numeric: tabular-nums;
    line-height: 14px;
}

.cal-badge-area {
    border-radius: 3px;
}

/* "+n": what is not drawn. */
.cal-badge-more {
    border-style: dashed;
    border-color: var(--colorNeutralStroke1);
    background-color: transparent;
    color: var(--colorNeutralForeground2);
}

/* A squadron named in full, as in the list of plans. */
.cal-badge-named {
    height: auto;
    min-height: 20px;
    padding: 0 8px;
    font-size: var(--fontSizeBase200);
    line-height: 18px;
}

/* In a year's small cells a badge is only a dot, along the top. */
.cal-badges-dots {
    position: absolute;
    inset-block-start: 2px;
    inset-inline: 2px;
    justify-content: center;
    gap: 3px;
    pointer-events: none;
}

.cal-badges-dots .cal-badge-group {
    gap: 1px;
}

.cal-badges-dots .cal-badge {
    min-width: 0;
    width: 5px;
    height: 5px;
    padding: 0;
    border-width: 0;
    background-color: var(--key);
    font-size: 0;
}

.cal-badges-dots .cal-badge-more {
    border: 1px dashed var(--colorNeutralStroke1);
    background-color: transparent;
}

/* ---- Week: a column for each day, the hours down it, and the requests as blocks. ---- */

.cal-weekview {
    display: flex;
    flex-direction: column;
    overflow-x: auto;
}

/* Three rows on one set of columns: the days' headings, the plans, and the hours with the requests in them. */
.cal-wk {
    --wk-hour: 40px;
    flex: 1 0 auto;
    min-width: 560px;
    border: 1px solid var(--cal-line);
}

.cal-wk-row {
    display: grid;
    grid-template-columns: 3.5rem repeat(7, minmax(0, 1fr));
}

.cal-wk-corner,
.cal-wk-colhead {
    padding: 6px 8px;
    background-color: var(--colorNeutralBackground2);
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase200);
    font-weight: var(--fontWeightSemibold);
    white-space: nowrap;
}

.cal-wk-colhead {
    border-inline-start: 1px solid var(--cal-line);
}

.cal-wk-colhead.cal-today {
    box-shadow: inset 0 3px 0 var(--colorBrandBackground);
    color: var(--colorNeutralForeground1);
}

.cal-wk-colhead .cal-flag {
    margin-inline-start: 6px;
    vertical-align: middle;
}

/* The zone the week's hours are in. */
.cal-zone {
    margin-inline-start: auto;
    color: var(--colorNeutralForeground3);
}

/* The plans' row: its bars lie across the days. */
.cal-wk-plans {
    border-top: 1px solid var(--cal-line);
    border-bottom: 1px solid var(--cal-line);
    background-color: var(--cal-surface);
}

.cal-wk-plans .cal-wk-corner {
    padding: 0;
}

.cal-wk-plans .cal-bars {
    grid-column: 2 / -1;
    padding: 4px 0;
}

.cal-bars {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: repeat(var(--lanes, 1), 24px);
    gap: 2px 0;
}

/* The hours: a label at the top of each, and a line under it across every day. */
.cal-wk-hours {
    display: grid;
    grid-template-rows: repeat(24, var(--wk-hour));
    background-color: var(--colorNeutralBackground2);
}

.cal-wk-hours > span {
    padding: 2px 6px 0;
    color: var(--colorNeutralForeground3);
    font-size: var(--fontSizeBase100);
    font-variant-numeric: tabular-nums;
    text-align: end;
}

.cal-wk-day {
    position: relative;
    height: calc(24 * var(--wk-hour));
    border-inline-start: 1px solid var(--cal-line);
    background-color: var(--cal-surface);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent calc(var(--wk-hour) - 1px),
        var(--cal-line) calc(var(--wk-hour) - 1px),
        var(--cal-line) var(--wk-hour));
}

.cal-wk-day.cal-today {
    background-color: color-mix(in oklab, var(--colorBrandBackground) 6%, var(--cal-surface));
}

/* An hour the clocks skipped never happened: hatched. */
.cal-wk-skipped {
    position: absolute;
    inset-inline: 0;
    background: repeating-linear-gradient(135deg, transparent 0 4px, var(--cal-line) 4px 5px);
}

/* A request: the colour of its squadron or area (--key, set inline) mixed into the surface behind a ring of the colour
   itself, with the text left neutral, so it reads on any colour and in both themes. Approved is outlined solid and
   pending is paler and dashed. It sits in its column by percentages, set inline. */
.cal-req {
    --key: var(--colorBrandStroke1);
    position: absolute;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 16px;
    overflow: hidden;
    padding: 1px 4px;
    border: 1px solid var(--key);
    border-inline-start-width: 4px;
    border-radius: var(--borderRadiusSmall);
    background-color: color-mix(in oklab, var(--key) 32%, var(--cal-surface));
    color: var(--colorNeutralForeground1);
    font-size: var(--fontSizeBase100);
    line-height: 13px;
    text-decoration: none;
}

.cal-req-pending {
    border-style: dashed dashed dashed solid;
    background-color: color-mix(in oklab, var(--key) 14%, var(--cal-surface));
}

.cal-req:hover {
    z-index: 2;
    box-shadow: 0 0 0 2px var(--colorBrandStroke1);
}

.cal-req:focus-visible {
    z-index: 2;
    outline: 2px solid var(--colorStrokeFocus2);
    outline-offset: 1px;
}

.cal-req.continues-before {
    border-start-start-radius: 0;
    border-start-end-radius: 0;
}

.cal-req.continues-after {
    border-end-start-radius: 0;
    border-end-end-radius: 0;
}

.cal-req-title,
.cal-req-detail {
    flex: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-req-title {
    font-weight: var(--fontWeightSemibold);
}

.cal-req-detail {
    color: var(--colorNeutralForeground2);
}

/* The key to a request's outline. */
.cal-req-swatch {
    width: 18px;
    height: 10px;
    border: 1px solid var(--colorBrandStroke1);
    border-inline-start-width: 4px;
    border-radius: 2px;
    background-color: color-mix(in oklab, var(--colorBrandStroke1) 32%, var(--cal-surface));
}

.cal-req-swatch-pending {
    border-style: dashed dashed dashed solid;
    background-color: color-mix(in oklab, var(--colorBrandStroke1) 14%, var(--cal-surface));
}

/* ---- Year: twelve small months. ---- */

.cal-year {
    display: grid;
    grid-auto-rows: 1fr;
    grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
    gap: 16px 20px;
}

/* A month's grid takes what its row has over, so the days grow with the window, from the 4:3 they are at least. Every
   month has the six weeks that any month can need, so a cell is the same size in all of them. */
.cal-mini {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.cal-mini-title {
    margin: 0;
    font-size: var(--fontSizeBase300);
    font-weight: var(--fontWeightSemibold);
}

.cal-mini-title a {
    color: var(--colorNeutralForeground1);
    text-decoration: none;
}

.cal-mini-title a:hover {
    text-decoration: underline;
}

.cal-mini-grid {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: auto repeat(6, 1fr);
    gap: 2px;
}

.cal-mini-head {
    color: var(--colorNeutralForeground3);
    font-size: var(--fontSizeBase100);
    text-align: center;
}

.cal-mini-day {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    place-self: stretch;
    aspect-ratio: 4 / 3;
    box-shadow: inset 0 0 0 1px var(--cal-line);
    color: var(--colorNeutralForeground1);
    font-size: var(--fontSizeBase100);
    text-decoration: none;
}

.cal-mini-day:hover {
    box-shadow: inset 0 0 0 2px var(--colorBrandStroke1);
}

/* The colour of the plan over the day, as an underline. */
.cal-mini-day[class*="status-"]::after {
    content: "";
    position: absolute;
    inset-inline: 3px;
    bottom: 2px;
    height: 3px;
    border-radius: 2px;
    background-color: var(--accent);
}

.cal-mini-day.cal-today {
    font-weight: var(--fontWeightBold);
    box-shadow: inset 0 0 0 2px var(--colorBrandBackground);
}

/* ---- Upcoming: a list. ---- */

.cal-upcoming {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cal-upcoming-title {
    margin: 0 0 8px;
    font-size: var(--fontSizeBase300);
    font-weight: var(--fontWeightSemibold);
}

.cal-upcoming-list {
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--cal-line);
    border-radius: var(--borderRadiusMedium);
    list-style: none;
}

.cal-upcoming-item {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr) minmax(0, 1.3fr) minmax(0, 1fr);
    gap: 4px 20px;
    align-items: start;
    padding: 12px 16px;
    border-bottom: 1px solid var(--cal-line);
}

.cal-upcoming-item:last-child {
    border-bottom: none;
}

.cal-upcoming-main,
.cal-upcoming-when,
.cal-upcoming-counts {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.cal-upcoming-main {
    align-items: flex-start;
}

.cal-upcoming-hint {
    color: var(--colorNeutralForeground2);
    font-size: var(--fontSizeBase200);
    font-weight: var(--fontWeightSemibold);
}

/* ---- Narrow screens: the days shrink to numbers and colours, and the year goes down one column. ---- */

@media (max-width: 600px) {
    .cal {
        padding: 8px 8px 12px;
    }

    .cal-weekday-long {
        display: none;
    }

    .cal-weekday-short {
        display: inline;
    }

    .cal-weekdays > span {
        padding: 4px 2px;
        text-align: center;
    }

    .cal-week {
        grid-template-rows: 24px repeat(var(--lanes, 1), 18px) minmax(31px, 1fr);
    }

    /* A month's badges are only dots here. */

    .cal-day-foot .cal-badge {
        min-width: 0;
        width: 6px;
        height: 6px;
        padding: 0;
        border-width: 0;
        background-color: var(--key);
        font-size: 0;
    }

    .cal-day-foot .cal-badge-more {
        border: 1px dashed var(--colorNeutralStroke1);
        background-color: transparent;
    }

    .cal-day-foot .cal-badges {
        gap: 2px;
    }

    .cal-day {
        padding: 2px 3px;
    }

    .cal-day-value {
        font-size: 10px;
    }

    .cal-bar {
        height: 16px;
        padding: 0 3px;
        line-height: 14px;
    }

    .cal-bar-name {
        display: none;
    }

    .cal-year {
        grid-template-columns: 1fr;
    }

    .cal-upcoming-item {
        grid-template-columns: 1fr;
    }

    .cal-title {
        white-space: normal;
    }
}

/* Forced colours drop the tints; the figure in each cell is what is left to read, so give each cell a visible edge. */
@media (forced-colors: active) {
    .cal-day,
    .cal-mini-day,
    .cal-req,
    .cal-bar {
        border: 1px solid CanvasText;
    }
}
