/* v2 base rules — scoped to .flott-v2 (the V2Layout root) and .flott-popover (v2 popovers, which
   MudBlazor renders outside the layout). Values come from tokens.css only. */

/* Reserve the scrollbar's space so pages and tabs of different heights never shift sideways. */
html:has(.flott-v2) {
    scrollbar-gutter: stable;
}

.flott-v2 {
    min-height: 100vh;
    background: var(--mud-palette-background);
    color: var(--flott-ink);
    font-family: var(--flott-font);
    font-size: var(--flott-text-body);
    line-height: 1.43;
}

.flott-v2 h1,
.flott-v2 h2,
.flott-v2 p {
    margin: 0;
}

/* Every number lines up down a column. */
.flott-num {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.flott-mono {
    font-family: var(--flott-font-mono);
}

/* One focus ring everywhere; never removed. */
.flott-v2 :focus-visible,
.flott-popover :focus-visible,
.flott-dialog :focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* Buttons read as sentences, not shouting capitals. */
.flott-v2 .mud-button-root,
.flott-popover .mud-button-root,
.flott-dialog .mud-button-root {
    text-transform: none;
    letter-spacing: 0;
}

/* ── Filters: one height, one radius, highlighted when in use ───────────── */
.flott-v2 .flott-filter .mud-input-control,
.flott-v2 .flott-filter.mud-input-control {
    margin: 0;
}

.flott-v2 .flott-filter .mud-input.mud-input-outlined {
    min-height: var(--flott-control-h);
    background: var(--mud-palette-surface);
}

.flott-v2 .flott-filter--active .mud-input-outlined-border {
    border-color: var(--mud-palette-primary);
}

.flott-v2 .flott-filter--active .mud-input-label {
    color: var(--mud-palette-primary);
}

.flott-popover .flott-muted,
.flott-dialog .flott-muted {
    color: var(--flott-ink-disabled);
}

/* ── Popovers ───────────────────────────────────────────────────────────── */
/* The outline is a 1px ring in the shadow, not a border: a border shrinks the popover's content box below the
   max-height its inner .mud-list inherits, so the popover scrolled by 2px next to the list's own scrollbar
   (two sliders on every long dropdown). */
.flott-popover.mud-paper {
    border: 0;
    border-radius: var(--flott-radius);
    box-shadow: 0 0 0 1px var(--flott-line), var(--flott-shadow-pop);
}

/* ── Skeletons use the line color, not MudBlazor's grey ─────────────────── */
.flott-v2 .mud-skeleton {
    background-color: var(--flott-line);
    border-radius: var(--flott-radius);
}

/* ── Dialogs (MudDialogProvider renders them outside .flott-v2) ─────────── */
.flott-dialog.mud-dialog {
    border: var(--flott-border);
    border-radius: var(--flott-radius);
    box-shadow: var(--flott-shadow-pop);
    color: var(--flott-ink);
    font-family: var(--flott-font);
    font-size: var(--flott-text-body);
}

/* A window that holds a table takes the screen's width, up to a reading limit, so its table never scrolls sideways
   on a laptop. */
.flott-dialog.mud-dialog:has(.sheet-review) {
    max-width: min(1440px, calc(100vw - var(--flott-space-5)));
}

.flott-dialog .mud-dialog-title,
.flott-dialog .mud-dialog-title .mud-typography {
    font-size: var(--flott-text-body);
    font-weight: var(--flott-weight-bold);
}

.flott-dialog .mud-dialog-actions {
    gap: var(--flott-space-2);
    padding: var(--flott-space-3) var(--flott-space-5) var(--flott-space-4);
}

.flott-dialog .form-dialog__spinner {
    width: 16px;
    height: 16px;
    margin-right: var(--flott-space-2);
}

.flott-dialog .form-dialog__more {
    margin-left: calc(-1 * var(--flott-space-2));
}

/* Two naturally paired fields side by side; one column on phones. */
.flott-dialog .form-dialog__pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--flott-space-3);
}

/* Three short related numbers side by side (pay · miles · rate); one column on phones. */
.flott-dialog .form-dialog__trio {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--flott-space-3);
}

@media (max-width: 600px) {
    .flott-dialog .form-dialog__pair,
    .flott-dialog .form-dialog__trio {
        grid-template-columns: minmax(0, 1fr);
    }
}

.flott-dialog .form-dialog__section {
    color: var(--flott-ink-secondary);
    font-size: var(--flott-text-label);
    font-weight: var(--flott-weight-medium);
    letter-spacing: var(--flott-tracking-label);
    text-transform: uppercase;
}

.flott-dialog .form-dialog__hint {
    color: var(--flott-ink-secondary);
    font-size: var(--flott-text-label);
}

/* ── Heat scale (Hot zones): swatches and bars that echo the map colours ── */
.flott-heat-0 { background: var(--flott-heat-0); }
.flott-heat-1 { background: var(--flott-heat-1); }
.flott-heat-2 { background: var(--flott-heat-2); }
.flott-heat-3 { background: var(--flott-heat-3); }
.flott-heat-4 { background: var(--flott-heat-4); }
.flott-heat-5 { background: var(--flott-heat-5); }
.flott-heat-6 { background: var(--flott-heat-6); }
.flott-heat-7 { background: var(--flott-heat-7); }

/* A switch lines its track up with the fields' left edge. */
.flott-dialog .form-dialog__switch {
    margin-left: calc(-1 * var(--flott-space-2));
}

/* A value filled in for the user (read from a Telegram message): a faint purple wash until it is edited. */
.flott-dialog .form-dialog__filled .mud-input.mud-input-outlined {
    background-color: var(--flott-primary-tint);
}

/* Codes typed as IDs (load ID) read in the monospace face, as on the board. */
.flott-dialog .form-dialog__mono input {
    font-family: var(--flott-font-mono);
}

/* ── Gross tip: the card shown over a figure on Analytics (GrossTip.razor) ─────────────────────────────
   MudBlazor draws tooltips in the popover provider, outside the page, so these rules are global. The popup is
   .mud-popover.mud-tooltip.mud-tooltip-default (grey, white text); three classes outrank MudBlazor's two, so the
   surface card wins whatever order the stylesheets load in. */
.mud-popover.mud-tooltip.gross-tip-popup {
    display: block;
    max-width: none;
    padding: 0;
    border: var(--flott-border);
    border-radius: var(--flott-radius);
    background-color: var(--mud-palette-surface);
    box-shadow: var(--flott-shadow-pop);
    color: var(--flott-ink);
    font-family: var(--flott-font);
    font-size: var(--flott-text-body);
    font-weight: var(--flott-weight-regular);
    line-height: 1.43;
    text-align: left;
}

.gross-tip {
    display: flex;
    flex-direction: column;
    gap: var(--flott-space-4);
    width: 360px;
    padding: var(--flott-space-5);
    color: var(--flott-ink);
}

.gross-tip__head {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gross-tip__name {
    font-size: var(--flott-text-body);
    font-weight: var(--flott-weight-bold);
}

.gross-tip__period,
.gross-tip__label {
    color: var(--flott-ink-secondary);
    font-size: var(--flott-text-label);
}

.gross-tip__label {
    letter-spacing: var(--flott-tracking-label);
    text-transform: uppercase;
}

.gross-tip__hero {
    display: flex;
    flex-direction: column;
    gap: var(--flott-space-1);
}

.gross-tip__total {
    font-size: var(--flott-text-title);
    font-weight: var(--flott-weight-bold);
    line-height: 1.1;
    text-align: left;
}

.gross-tip__facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--flott-space-3);
    margin: 0;
    padding: var(--flott-space-3) 0;
    border-top: var(--flott-border);
    border-bottom: var(--flott-border);
}

.gross-tip__fact {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gross-tip__fact dt {
    color: var(--flott-ink-secondary);
    font-size: var(--flott-text-label);
    font-weight: var(--flott-weight-regular);
}

.gross-tip__fact dd {
    margin: 0;
    font-weight: var(--flott-weight-bold);
    text-align: left;
}

.gross-tip__weeks {
    display: flex;
    flex-direction: column;
    gap: var(--flott-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.gross-tip__week {
    display: grid;
    grid-template-columns: 84px 1fr 88px;
    align-items: center;
    gap: var(--flott-space-3);
}

.gross-tip__week-range {
    color: var(--flott-ink-secondary);
    font-size: var(--flott-text-label);
    white-space: nowrap;
}

.gross-tip__week-bar {
    display: flex;
    height: 6px;
}

.gross-tip__week-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--mud-palette-primary);
}

.gross-tip__week-value {
    font-weight: var(--flott-weight-medium);
    white-space: nowrap;
}

/* Secondary ink, not disabled: the dash still has to pass 4.5:1 on the card. */
.gross-tip__week-value--zero {
    color: var(--flott-ink-secondary);
    font-weight: var(--flott-weight-regular);
}

/* ── Salary tip: the same card for a salary figure (SalaryTip.razor), with the sum written out ─────────────── */
.salary-tip__sum {
    display: flex;
    flex-direction: column;
    margin: 0;
    /* Room on the left for the operator column. */
    padding: var(--flott-space-3) 0 var(--flott-space-3) 16px;
    border-top: var(--flott-border);
    border-bottom: var(--flott-border);
}

.salary-tip__line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--flott-space-3);
    padding: 2px 0;
}

.salary-tip__line dt {
    display: inline-flex;
    align-items: baseline;
    color: var(--flott-ink-secondary);
    font-weight: var(--flott-weight-regular);
}

.salary-tip__line dd {
    margin: 0;
    font-weight: var(--flott-weight-medium);
    text-align: right;
}

/* The operator sits in its own narrow column so the words line up under each other. */
.salary-tip__op {
    display: inline-block;
    width: 16px;
    margin-left: -16px;
    color: var(--flott-ink-secondary);
    font-family: var(--flott-font-mono);
}

.salary-tip__line--subtotal {
    margin-top: var(--flott-space-1);
    padding-top: var(--flott-space-2);
    border-top: 1px dashed var(--flott-line);
}

.salary-tip__line--subtotal dt,
.salary-tip__line--result dt {
    color: var(--flott-ink);
}

.salary-tip__line--result {
    margin-top: var(--flott-space-1);
    padding-top: var(--flott-space-2);
    border-top: var(--flott-border);
}

.salary-tip__line--result dt,
.salary-tip__line--result dd {
    font-weight: var(--flott-weight-bold);
}

.salary-tip__line--result dd {
    color: var(--mud-palette-primary);
}

/* What the salary is made of: commission in primary, the bonus in a lighter primary. */
.salary-tip__split {
    display: flex;
    flex-direction: column;
    gap: var(--flott-space-2);
}

.salary-tip__split-bar {
    display: flex;
    gap: 2px;
    height: 8px;
}

.salary-tip__split-commission,
.salary-tip__split-bonus {
    display: block;
    flex-basis: 0;
    min-width: 4px;
    height: 100%;
    border-radius: calc(var(--flott-radius) / 2);
}

.salary-tip__split-commission {
    background: var(--mud-palette-primary);
}

.salary-tip__split-bonus {
    background: color-mix(in srgb, var(--mud-palette-primary) 35%, var(--mud-palette-surface));
}

.salary-tip__split-legend {
    display: flex;
    justify-content: space-between;
    gap: var(--flott-space-3);
    color: var(--flott-ink-secondary);
    font-size: var(--flott-text-label);
}

.salary-tip__key {
    display: inline-flex;
    align-items: center;
    gap: var(--flott-space-1);
}

.salary-tip__key::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: calc(var(--flott-radius) / 3);
}

.salary-tip__key--commission::before {
    background: var(--mud-palette-primary);
}

.salary-tip__key--bonus::before {
    background: color-mix(in srgb, var(--mud-palette-primary) 35%, var(--mud-palette-surface));
}

.salary-tip__weeks {
    display: flex;
    flex-direction: column;
    gap: var(--flott-space-2);
}

/* "Set for September": the month has its own term instead of the profile's. */
.salary-tip__tag {
    margin-left: var(--flott-space-2);
    padding: 0 var(--flott-space-1);
    border-radius: var(--flott-radius);
    background: var(--flott-primary-tint);
    color: var(--mud-palette-primary);
    font-size: var(--flott-text-label);
    white-space: nowrap;
}

.salary-tip__hint {
    margin: 0;
    padding-top: var(--flott-space-3);
    border-top: var(--flott-border);
    color: var(--flott-ink-secondary);
    font-size: var(--flott-text-label);
}
