/* ==========================================================================
   Driver portal
   Only what the shared house sheet (_content/NDSTankTracker.Ui/app.css) does not
   already cover. Colours come from the same --mud-palette-* variables, so the
   two applications stay in step.

   HOW THIS SHEET RESPONDS
   Three things vary, and each is keyed to the thing that actually causes it:

     structure   keyed to WIDTH        how many columns, tabs or no tabs
     rhythm      keyed to HEIGHT       vertical padding, whether Save sticks
     targets     keyed to POINTER      how big a thing you have to hit

   Keeping those separate matters. An earlier version keyed the compact layout
   to `orientation: landscape and max-height: 700px`, which is also every
   laptop — a 1366x768 screen has around 650px of viewport — so desktop users
   were served the cab layout. Height now only ever trims spacing; it never
   changes how many columns there are.

   The ladder, in width:
     base      phone portrait, one column
     >= 600    tablet portrait: two jobs to a row, controls share a line
     >= 900    tablet landscape / small laptop: three to a row, nav in the bar
     >= 1120   desktop: both legs of a job visible at once, no tab strip
     >= 1560   wide desktop: four to a row, all three legs side by side
   ========================================================================== */

/* ------------------------------------------------------------------ reset -- */

/* Neither MudBlazor nor the house sheet resets this globally, and several rules
   below put padding on something that is also 100% wide. Without it the shell
   is two gutters wider than the screen at every size. Scoped to the portal, so
   it cannot reach the back office. */
.portal-shell,
.sign-in-shell,
.portal-shell *,
.sign-in-shell *,
.portal-shell *::before,
.portal-shell *::after { box-sizing: border-box; }

/* ----------------------------------------------------------------- tokens -- */

.portal-shell,
.sign-in-shell {
    /* Fluid rather than stepped: the gutter grows with the window instead of
       jumping at a breakpoint, so there is no size at which the page looks
       like it was designed for something else. */
    --gutter: clamp(14px, 3vw, 32px);
    --gap: clamp(8px, 1.2vw, 16px);
    --panel-gap: clamp(10px, 1.4vw, 16px);

    /* Wide enough to use a big screen, narrow enough that a line of an address
       is still readable. */
    --shell-max: 1320px;

    --bar-height: 54px;
    --radius: 8px;
    --radius-lg: 10px;

    --fs-title: clamp(20px, 1.6vw + 12px, 27px);
    --fs-body: 14px;
    --fs-small: 12.5px;
    --fs-tiny: 11.5px;

    /* A comfortable target for a gloved thumb; relaxed for a mouse just below. */
    --target: 44px;

    --bar-ink: #e6eef7;
    --bar-ink-dim: #a8bdd4;
    --bar-bg: #12253a;

    /* How far through a job is, on the edge of its card. Blue and green are the theme's
       own; the yellow is not. The palette's light Warning (#b7791f) is chosen to be read
       as text on white, and in a 4px strip it comes out brown rather than yellow, so this
       opens the same hue up. If the portal ever gains dark mode, --mud-palette-warning is
       already a good yellow there (#e0a94a) and can take over. */
    --stage-collection: #e3a008;
    --stage-disposal: var(--mud-palette-primary);
    --stage-complete: var(--mud-palette-success);

    font-size: var(--fs-body);
}

/* A mouse is precise, so controls can be tighter and the page denser. Keyed to
   the pointer rather than the window: a touchscreen laptop keeps big targets. */
@media (pointer: fine) {
    .portal-shell,
    .sign-in-shell { --target: 36px; }
}

/* ------------------------------------------------------------------ shell -- */

.portal-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--mud-palette-background);
}

.portal-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    /* Clears the notch on a phone held in a cab cradle. */
    padding-top: env(safe-area-inset-top);
    background: var(--bar-bg);
    color: var(--bar-ink);
}

.portal-bar-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: var(--shell-max);
    margin-inline: auto;
    min-height: var(--bar-height);
    padding-inline: var(--gutter);
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: inherit;
    text-decoration: none;
    flex: 0 0 auto;
}

.portal-brand .mark { width: 26px; height: 26px; flex: 0 0 26px; }
.portal-brand .mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.portal-brand .name { display: block; font-weight: 600; font-size: 15px; line-height: 1.15; }

/* Only ever a caption; the first thing to go when the bar is tight. */
.portal-brand .tenant { display: none; font-size: 11px; color: var(--bar-ink-dim); }

.portal-bar .spacer { flex: 1 1 auto; }

/* -------------------------------------------------------- bar navigation -- */

/* Below the tablet breakpoint these links live in the menu instead, so the bar
   on a phone is a brand and one control rather than four crowded pills. */
.portal-nav { display: none; gap: 2px; }

.portal-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 13.5px;
    color: var(--bar-ink-dim);
    text-decoration: none;
    white-space: nowrap;
}

.portal-nav a.active { color: var(--bar-ink); background: rgba(255, 255, 255, .12); }

@media (hover: hover) {
    .portal-nav a:hover { color: var(--bar-ink); background: rgba(255, 255, 255, .08); }
}

/* -------------------------------------------------------------- bar menu -- */

/* A details element rather than a scripted popover: it works before any
   WebAssembly has downloaded, and keyboard behaviour comes for free. */
.portal-menu { position: relative; flex: 0 0 auto; }

.portal-menu > summary {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: var(--target);
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

.portal-menu > summary::-webkit-details-marker { display: none; }
.portal-menu > summary::marker { content: ""; }
.portal-menu[open] > summary { background: rgba(255, 255, 255, .12); }

@media (hover: hover) {
    .portal-menu > summary:hover { background: rgba(255, 255, 255, .08); }
}

.portal-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    border-radius: 50%;
    font-size: var(--fs-tiny);
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--bar-bg);
    background: var(--bar-ink-dim);
}

.portal-who {
    font-size: 13px;
    color: var(--bar-ink);
    max-width: 16ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-menu > summary .chev { font-size: 10px; color: var(--bar-ink-dim); }

.portal-menu-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 30;
    min-width: 224px;
    padding: 6px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 28px rgba(8, 17, 28, .28);
}

.portal-menu-panel a,
.portal-menu-panel button {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    min-height: max(40px, var(--target));
    padding: 0 12px;
    font: inherit;
    font-size: 14px;
    text-align: left;
    text-decoration: none;
    color: var(--mud-palette-text-primary);
    background: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

@media (hover: hover) {
    .portal-menu-panel a:hover,
    .portal-menu-panel button:hover { background: var(--mud-palette-action-default-hover); }
}

.portal-menu-panel form { margin: 0; }

.portal-menu-name {
    padding: 8px 12px;
    font-size: var(--fs-tiny);
    color: var(--mud-palette-text-secondary);
    border-bottom: 1px solid var(--mud-palette-lines-default);
    margin-bottom: 4px;
}

.portal-menu-sep { height: 1px; margin: 4px 0; background: var(--mud-palette-lines-default); }

/* ---------------------------------------------------------------- content -- */

.portal-content {
    flex: 1 1 auto;
    width: 100%;
    max-width: var(--shell-max);
    margin-inline: auto;
    padding: clamp(14px, 2vw, 24px) var(--gutter)
             calc(clamp(14px, 2vw, 24px) + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------- page heads -- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px var(--gap);
    margin-bottom: clamp(10px, 1.4vw, 18px);
}

.page-head-main { flex: 1 1 320px; min-width: 0; }

.portal-heading {
    font-size: var(--fs-title);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 2px;
    text-wrap: balance;
}

.portal-lead { color: var(--mud-palette-text-secondary); margin: 0; max-width: 68ch; }

.back-link {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    font: inherit;
    font-size: 13px;
    color: var(--mud-palette-primary);
    background: none;
    border: none;
    padding: 0 0 2px;
    cursor: pointer;
}

.back-link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- sign in -- */

/* Flex rather than a centred grid: an auto grid track sizes to the card's own
   content, so `width: 100%` on the card resolves against that instead of the
   screen and it comes out about 250px wide on a phone. */
.sign-in-shell {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--gutter);
    background: linear-gradient(140deg, #12253a 0%, #1f3b57 55%, #2a4f72 100%);
}

.sign-in-card {
    width: 100%;
    max-width: 400px;
    padding: clamp(22px, 3vw, 32px);
    border-radius: var(--radius-lg);
    background: var(--mud-palette-surface);
    box-shadow: 0 12px 32px rgba(8, 17, 28, .35);
}

.sign-in-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.sign-in-brand .mark { width: 30px; height: 30px; flex: 0 0 30px; }
.sign-in-brand .mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sign-in-brand .name { display: block; font-weight: 600; font-size: 16px; }
.sign-in-brand .tenant { display: block; font-size: 12px; color: var(--mud-palette-text-secondary); }

.sign-in-hint { font-size: 13.5px; margin: 0 0 16px; }

.sign-in-error {
    margin: 0 0 16px;
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--mud-palette-error);
    background: color-mix(in srgb, var(--mud-palette-error) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--mud-palette-error) 35%, transparent);
}

.sign-in-button {
    width: 100%;
    /* A comfortable target for a gloved thumb. */
    min-height: 46px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    color: var(--mud-palette-primary-text);
    background: var(--mud-palette-primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.sign-in-button:hover { background: var(--mud-palette-primary-darken); }

/* The error page uses the same control as a link rather than a submit. */
a.sign-in-button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.sign-in-card .portal-heading { font-size: 19px; margin-bottom: 8px; }
.sign-in-card code { font-family: Consolas, "SF Mono", monospace; word-break: break-all; }

.sign-in-foot {
    margin: 16px 0 0;
    font-size: 12px;
    color: var(--mud-palette-text-secondary);
}

/* ----------------------------------------------------------------- fields -- */

.field { margin-bottom: 14px; }

.field-label {
    display: block;
    font-size: var(--fs-tiny);
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 4px;
}

.field-input {
    width: 100%;
    box-sizing: border-box;
    /* 16px, so iOS does not zoom the page when the field takes focus. */
    font-size: 16px;
    font-family: inherit;
    min-height: max(42px, var(--target));
    padding: 9px 11px;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: var(--radius);
}

/* A mouse cannot trigger the iOS zoom, so text can sit at the page's own size. */
@media (pointer: fine) {
    .field-input { font-size: 14px; min-height: 38px; }
}

.field-input:focus {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: -1px;
    border-color: var(--mud-palette-primary);
}

textarea.field-input { min-height: 72px; resize: vertical; line-height: 1.45; }

/* Two fields that belong together — on site and off site — sharing a line when
   the pair will fit and stacking when it will not. Wrapping decides that, not a
   breakpoint, because what matters is the width of the panel they are sitting
   in, not the width of the screen: the same panel is half a tablet in portrait
   and a comfortable column on a desktop. A datetime-local box will not render
   below about 200px, which is what the basis is protecting. */
.field-pair {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 var(--panel-gap);
}

.field-pair > .field { flex: 1 1 200px; min-width: 0; }

/* Cells that know what they must hold. A time cell needs a datetime-local at
   its floor plus a Now button; a short cell needs a weight plus a Copy button,
   or nothing at all when it is only there to give the time above it a partner
   of the same width. Unequal bases are what let the pair stay side by side on
   a landscape tablet, where two equal halves could not hold both buttons; the
   free space beyond the bases is still shared between them. Below the sum of
   the two bases the pair stacks, and every row keeps its button on the line. */
.field-pair > .field-time-cell { flex-basis: 238px; }
.field-pair > .field-short-cell { flex-basis: 140px; }

/* A pair whose two boxes are not equally sized: one third and two thirds. A zero
   basis is what makes the split exact — the whole row is free space, handed out
   1:2 by the grow factors — and the min-widths are what make them wrap instead
   of shrinking into boxes too small to read. Declared after the even pair above,
   because both rules match and they carry the same specificity. */
.field-pair-thirds > .field { flex: 1 1 0; min-width: 110px; }
.field-pair-thirds > .field-wide { flex: 2 1 0; min-width: 180px; }

/* A field with a shortcut button on the end of it — Now, Copy collection. The
   button wraps under the input rather than squeezing it when there is no room. */
.field-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.field-row .field-input { flex: 1 1 160px; min-width: 0; width: auto; }

/* A row whose button must stay on the line: the input gives way instead of the
   button dropping underneath. Only for inputs that can be narrow. A weight is
   four digits; a datetime-local will not go below about 200px and must not use
   this, or it would overflow rather than wrap. */
.field-row-tight { flex-wrap: nowrap; }
.field-row-tight .field-input { flex: 1 1 0; min-width: 72px; }

/* The same for the four time rows, with a floor a datetime-local can live with:
   at 16px it needs about 170px to show the whole of dd/mm/yyyy --:-- and the
   picker. Below that the value would be clipped, and a time the driver cannot
   read back is worse than a button on the next line - so the pair that holds
   these rows stacks before the floor is reached, rather than the row wrapping. */
.field-row-time { flex-wrap: nowrap; }
.field-row-time .field-input { flex: 1 1 0; min-width: 168px; }

/* Lifts the 460px measure that .job-panel .field imposes, for a field that
   should run the width of the panel. Three classes deep so it beats that rule
   whatever the source order. */
.job-panel .field.field-full { max-width: none; }

/* An empty cell holding the other half of a pair, so a lone field is sized by
   exactly the rule its sibling above it is - half the row side by side, the
   whole row when the pair stacks. Nothing to see, so no margin either. */
.field-pair > .field-spacer { margin: 0; }

.field-action {
    flex: 0 0 auto;
    min-height: max(42px, var(--target));
    padding: 0 14px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-primary);
    border-radius: var(--radius);
    cursor: pointer;
}

@media (hover: hover) {
    .field-action:hover:not(:disabled) { background: var(--mud-palette-primary-lighten); }
}

.field-action:disabled {
    color: var(--mud-palette-text-disabled);
    border-color: var(--mud-palette-lines-default);
    cursor: default;
}

@media (pointer: fine) {
    .field-action { min-height: 38px; }
}

.field-hint { margin: 4px 0 0; font-size: var(--fs-tiny); color: var(--mud-palette-text-secondary); }
.field-error { margin: 4px 0 0; font-size: 12px; color: var(--mud-palette-error); }

.check,
.remember-device {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
    font-size: 13.5px;
    cursor: pointer;
}

.check input,
.remember-device input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--mud-palette-primary);
}

.remember-device { margin-bottom: 18px; }

/* ---------------------------------------------------------------- switch -- */

/* A two-state control where a tickbox would leave one state unnamed. The real
   checkbox is still there, hidden behind the track, so the keyboard, the screen
   reader and the form all behave as they always would. */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.switch-track {
    position: relative;
    flex: 0 0 auto;
    width: 52px;
    height: 30px;
    border-radius: 999px;
    background: var(--mud-palette-success);
    transition: background .15s linear;
}

.switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(8, 17, 28, .35);
    transition: transform .15s ease;
}

.switch.is-rejected .switch-track { background: var(--mud-palette-error); }
.switch.is-rejected .switch-knob { transform: translateX(22px); }

.switch-state { font-size: 14px; font-weight: 600; }
.switch.is-rejected .switch-state { color: var(--mud-palette-error); }

.switch input:focus-visible + .switch-track {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* ----------------------------------------------------------------- errors -- */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    padding: 12px 20px;
    background: #ffeaa7;
    color: #16202b;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, .2);
}

#blazor-error-ui .dismiss { position: absolute; right: 12px; top: 10px; cursor: pointer; }

/* ------------------------------------------------------------- job queues -- */

/* Tabs and search stack on a phone and share a line from the tablet up, where
   the line is worth about fifty pixels of height — a whole job card. */
.queue-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px var(--gap);
    margin: 0 0 var(--gap);
}

/* Every tab on screen at once, at every width — the My jobs queues and the job's
   legs alike. As a scrolling strip of pills the last tabs went off the edge of a
   tablet in portrait, and the drivers are not going to guess the strip slides.
   So: equal shares of the width, and a long name ("Collection photos") breaks
   onto two lines inside its tab rather than pushing the others off. The button
   keeps its full height — only the text wraps. On a phone even that is too
   tight, so they go two rows deep there (below). Each page sets --tabs and
   --tabs-narrow, because the job's count changes as it goes. The cap keeps the
   tabs from stretching into bars across a monitor. */
.queue-tabs {
    display: grid;
    grid-template-columns: repeat(var(--tabs, 4), minmax(0, 190px));
    gap: 6px;
    flex: 1 1 100%;
}

.queue-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: max(38px, var(--target));
    padding: 6px 10px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius);
    cursor: pointer;
}

@media (max-width: 599.98px) {
    .queue-tabs { grid-template-columns: repeat(var(--tabs-narrow, 2), minmax(0, 1fr)); }
}

@media (hover: hover) {
    .queue-tab:hover {
        border-color: var(--mud-palette-primary);
        color: var(--mud-palette-text-primary);
    }
}

.queue-tab.active {
    color: var(--mud-palette-primary-text);
    background: var(--mud-palette-primary);
    border-color: var(--mud-palette-primary);
    font-weight: 600;
}

.queue-tab .count {
    font-size: var(--fs-tiny);
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--mud-palette-divider-light);
    color: var(--mud-palette-text-primary);
}

.queue-tab.active .count { background: rgba(255, 255, 255, .25); color: inherit; }

/* A tab that a save has complained about, while the driver is looking at
   another one. The highlighted box is out of sight, so the pill carries the
   warning until they get there. Filled, because at 18px the warning colour
   needs a solid disc behind white to read; as a thin stroke it went brown. */
.queue-tab .tab-warn {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: #ffffff;
    background: var(--mud-palette-warning);
}

/* MudAlert top-aligns its icon and its message and relies on the Material line
   height to make them look level. This sheet sets its own, so the two drift by
   a pixel or two and the text sits visibly off the icon. Centring the row levels
   them at any font size. The portal only ever shows one-line alerts, so nothing
   is given up by not top-aligning a long one. */
.portal-shell .mud-alert.mud-dense .mud-alert-position { align-items: center; }

.queue-search { flex: 1 1 100%; min-width: 0; }

.queue-search input {
    width: 100%;
    box-sizing: border-box;
    min-height: max(40px, var(--target));
    /* 16px keeps iOS from zooming the page when the field takes focus. */
    font-size: 16px;
    font-family: inherit;
    padding: 8px 12px;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-inputs);
    border-radius: var(--radius);
}

@media (pointer: fine) {
    .queue-search input { font-size: 14px; min-height: 36px; }
}

.queue-search input:focus {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: -1px;
}

.queue-empty {
    margin: clamp(24px, 5vw, 48px) 0;
    text-align: center;
    color: var(--mud-palette-text-secondary);
}

.queue-more { display: flex; justify-content: center; margin-top: var(--gap); }

/* --------------------------------------------------------------- job card -- */

.job-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--gap);
    align-items: start;
}

.job-card {
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-left: 4px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
}

@media (hover: hover) {
    .job-card:not(.is-static):hover {
        border-color: var(--mud-palette-primary);
        box-shadow: 0 2px 10px rgba(18, 37, 58, .1);
    }
}

/* A card that opens nothing should not offer itself as a target. */
.job-card.is-static { cursor: default; }

/* The coloured edge says how far through the job is — yellow still to collect, blue
   collected and waiting to be disposed of, green finished. Whether a job is under
   way is a different fact and is carried by the pill, so the two do not compete for
   the same signal. */
.job-card.stage-collection { border-left-color: var(--stage-collection); }
.job-card.stage-disposal { border-left-color: var(--stage-disposal); }
.job-card.stage-complete { border-left-color: var(--stage-complete); }

.job-card:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}


.job-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.job-head .spacer { flex: 1 1 auto; }

.job-number { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.job-date { font-size: var(--fs-small); color: var(--mud-palette-text-secondary); white-space: nowrap; }

.job-flag {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--mud-palette-primary-text);
    background: var(--mud-palette-primary);
}

.job-description { margin: 0 0 8px; font-size: 13.5px; line-height: 1.4; }

/* Pushed to the foot of the card, so that in a row of cards of different
   heights the From / To / Vehicle lines still line up across the row. */
.job-detail {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 2px 10px;
    margin: auto 0 0;
    font-size: var(--fs-small);
}

.job-detail dt { color: var(--mud-palette-text-secondary); }
.job-detail dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------- job detail -- */

.job-detail-meta { margin: 4px 0 0; font-size: var(--fs-small); color: var(--mud-palette-text-secondary); }

/* --------------------------------------------------------- job header -- */

/* What the job is, and where the driver is going, in one band. Two columns from
   the tablet up; stacked on a phone. This replaced a page heading plus an address
   panel inside the leg, which between them cost a lot of height for three short
   lines — and height is what a tablet in a cradle has least of. */
.job-header { display: grid; gap: 12px var(--panel-gap); }

.job-header-main { min-width: 0; }

/* The coloured rule is the same language the cards on the list speak: yellow
   while collecting, blue while disposing, nothing on Information. */
.job-header-place {
    min-width: 0;
    padding-left: 12px;
    border-left: 4px solid var(--mud-palette-lines-default);
}

.job-header-place.stage-collection { border-left-color: var(--stage-collection); }
.job-header-place.stage-disposal { border-left-color: var(--stage-disposal); }

.job-header-place h2 { margin: 0 0 2px; font-size: 15px; font-weight: 600; }
.job-header .portal-heading { margin-bottom: 1px; }

/* ------------------------------------------------------------ job legs -- */

/* One leg at a time, at every width. The header names the place for whichever
   leg is chosen, so showing two at once would leave it saying the wrong thing
   about one of them. */
/* This strip stands on its own rather than inside .queue-controls, which is
   where the queue page's spacing comes from, so it carries its own. */
.leg-tabs { margin-bottom: var(--gap); }

.job-legs { display: grid; gap: var(--panel-gap); align-items: start; }

.job-leg { display: none; min-width: 0; }
.job-leg.is-active { display: block; }

.job-panel {
    padding: 14px;
    margin-bottom: var(--panel-gap);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius-lg);
}

.job-panel:last-child { margin-bottom: 0; }

.job-panel h2 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }

/* A panel heading with a control on its right, such as Paperwork's refresh. */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.panel-head h2 { margin: 0; }
.job-panel-address { margin: 0 0 6px; font-size: 13px; color: var(--mud-palette-text-secondary); }
.job-panel p { margin: 0 0 6px; font-size: 13.5px; }

.job-step-hint { color: var(--mud-palette-text-secondary); font-size: 13.5px; }

/* The four panels of one leg. Stacked on a phone; from a tablet up the address
   runs across the top, what the driver fills in sits beside what they collect a
   signature on, and the photographs run across the bottom:

       +-----------------------------+
       |           address           |
       +--------------+--------------+
       |   details    |  signature   |
       +--------------+--------------+
       |           photos            |
       +-----------------------------+

   Pairing details with the signature is what removes the dead space: they are
   the two tallest panels, so they end a row at roughly the same depth, whereas
   the address is three short lines and left a hole beside it. */
/* Stretch, not start: the details and the signature sit side by side and are read
   as a pair, so they square off to the taller of the two whether or not a
   signature has been captured yet. A panel that changes height as soon as
   somebody signs makes the page jump under the driver's hand. */
.leg-grid { display: grid; gap: var(--panel-gap); align-items: stretch; }

/* The gap does the separating, so the panels' own margin would only add a
   phantom gap under the shorter column. */
.leg-grid > .job-panel { margin-bottom: 0; }

/* A grid track is min-width:auto by default, which means it refuses to shrink
   below its content's intrinsic width. A datetime-local input asks for about
   200px whatever you tell it, so without this the column pushes past the right
   edge of the tablet and the whole page scrolls sideways. */
.job-legs > *,
.leg-grid > *,
.consignment-panels > *,
.panel-grid > *,
.job-list > * { min-width: 0; }

/* The waste details, the paperwork and the consignment note read as three separate
   things and sit as three whenever three will fit. As many columns as the room
   allows, rather than a breakpoint: this used to wait for a 1120px window, so a
   landscape tablet — about 1000px — dropped to a single column and left the waste
   details card mostly empty on its right. auto-fit also handles the load that
   needs no consignment note: the empty track collapses and the two panels that
   remain share the width, instead of leaving a hole where the third would be. */
.consignment-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--panel-gap);
    align-items: start;
}

.consignment-panels > .job-panel { margin-bottom: 0; }

.job-times,
.job-reference {
    display: grid;
    grid-template-columns: minmax(86px, auto) minmax(0, 1fr);
    gap: 4px 12px;
    margin: 0 0 12px;
    font-size: 13.5px;
}

.job-times dt,
.job-reference dt { color: var(--mud-palette-text-secondary); }
.job-times dd,
.job-reference dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.job-signed { margin: 10px 0 0; font-size: var(--fs-small); color: var(--mud-palette-success); }

/* One box about the whole job. Full width: it sits alone on its tab, and a
   card narrower than the tab strip above it reads as unfinished rather than
   considered. The textarea keeps a comfortable measure of its own below. */
.job-notes { min-height: 180px; }

/* Three classes deep on purpose. The 460px measure that .job-panel .field imposes
   is right for a row of short inputs and wrong for the one box on this tab, and
   that rule lives in a later media block — so matching its specificity would lose
   on source order and leave the box short inside its own card. */
.job-leg-notes .job-panel .field { max-width: none; }

/* Sits above the home indicator on a phone, always reachable. Height, not
   width, decides whether it needs to stick — see the short-screen block. */
.job-save {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    margin-top: var(--panel-gap);
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--mud-palette-background) 70%, transparent);
}

.job-save > * { flex: 1 1 auto; }

/* -------------------------------------------------------------- signatures -- */

.signature-pad {
    width: 100%;
    height: clamp(150px, 22vh, 210px);
    margin-bottom: 10px;
    background: #ffffff;
    border: 1px dashed var(--mud-palette-lines-inputs);
    border-radius: var(--radius);
    /* Stops the page panning while a finger is drawing on it. */
    touch-action: none;
    cursor: crosshair;
}

.signature-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.signature-image {
    display: block;
    max-width: 100%;
    max-height: 120px;
    margin-top: 8px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius);
}

/* ------------------------------------------------------------ photographs -- */

/* auto-fit with a ceiling: two photographs fill the row on a phone, and on a
   monitor they stay thumbnail-sized instead of blowing up to half a screen. */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 140px));
    gap: 8px;
    margin-bottom: 12px;
}

.photo-tile { position: relative; margin: 0; }

.photo-tile img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--mud-palette-lines-default);
}

.photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    font-size: 17px;
    line-height: 1;
    color: #fff;
    background: rgba(18, 37, 58, .72);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* The real input is hidden behind the label, which is the visible button. */
.photo-add {
    display: block;
    text-align: center;
    min-height: max(44px, var(--target));
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-surface);
    border: 1px dashed var(--mud-palette-primary);
    border-radius: var(--radius);
    cursor: pointer;
}

.photo-add input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* -------------------------------------------------------------- paperwork -- */

.document-links { display: grid; gap: 8px; }

/* Buttons that open the viewer, not links: a link to a PDF is a download on the tablets. */
.document-links button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: max(44px, var(--target));
    padding: 12px 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    color: var(--mud-palette-primary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius);
    cursor: pointer;
}

.document-links button::after {
    content: "View";
    margin-left: auto;
    font-size: var(--fs-small);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

@media (hover: hover) {
    .document-links button:hover { border-color: var(--mud-palette-primary); }
}

/* --------------------------------------------------------------- viewer -- */

/* Photographs and paperwork, full screen over the job (Shared/MediaViewer.razor). Dark
   behind, whatever the theme, so a photograph reads as a photograph and a white page of
   paperwork stands out from what is around it. Above MudBlazor's dialogs (1400) and bars. */

.photo-open {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
}

html.viewer-open, html.viewer-open body { overflow: hidden; }

.viewer {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    background: #0d1620;
    color: #e6eef7;
}

.viewer-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px var(--gutter);
    padding-top: max(8px, env(safe-area-inset-top));
    background: #12253a;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .08);
}

.viewer-heading {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1 1 auto;
}

.viewer-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer-caption { font-size: var(--fs-small); color: #a8bdd4; }

.viewer-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.viewer-tool,
.viewer-close {
    min-width: max(44px, var(--target));
    min-height: max(44px, var(--target));
    padding: 0 12px;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    color: #e6eef7;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: var(--radius);
    cursor: pointer;
}

/* The way out is the one thing that must never be missed. */
.viewer-close {
    padding: 0 18px;
    font-size: 15px;
    font-weight: 600;
    color: #12253a;
    background: #e6eef7;
    border-color: #e6eef7;
}

.viewer-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* A photograph: fitted whole, and the fingers do the rest (tankPortal.viewer). */
.viewer-stage.is-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    user-select: none;
}

.viewer-stage.is-photo img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    transform-origin: center;
    will-change: transform;
    -webkit-user-drag: none;
}

.viewer-stage.is-zoomed { cursor: grab; }

.viewer-step {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 72px;
    font-size: 40px;
    line-height: 1;
    color: #fff;
    background: rgba(18, 37, 58, .72);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.viewer-prev { left: 8px; }
.viewer-next { right: 8px; }
.viewer-step:disabled { opacity: .25; cursor: default; }
.viewer-stage.is-zoomed .viewer-step { display: none; }

/* A document: pages one under another, scrolled natively, and both ways once zoomed. */
.viewer-stage.is-document {
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.viewer-pages {
    width: max-content;
    min-width: 100%;
    padding: 12px 12px 0;
    box-sizing: border-box;
}

.viewer-page {
    display: block;
    margin: 0 auto 12px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}

.viewer-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: var(--gutter);
    text-align: center;
    font-size: 15px;
    color: #a8bdd4;
    pointer-events: none;
}

/* "Opening…" only until the first page is up; the rest draw in behind it. */
.viewer-pages:not(:empty) + .viewer-status { display: none; }

/* -------------------------------------------------- viewing as a driver -- */

/* Amber rather than the accent: this is a state to notice and leave, not a
   feature. It sticks under the bar so it cannot be scrolled out of mind. */
.viewing-banner {
    position: sticky;
    top: var(--bar-height);
    z-index: 15;
    padding: 9px var(--gutter);
    font-size: 13px;
    color: #3c2c08;
    background: #f6d67a;
    border-bottom: 1px solid #d8b657;
}

.viewing-banner-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: var(--shell-max);
    margin-inline: auto;
}

.viewing-banner strong { font-weight: 600; }

.viewing-banner a {
    margin-left: auto;
    font-weight: 600;
    color: #3c2c08;
    text-decoration: underline;
    /* A real target, not a word to poke at. */
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
}

/* The view has run out. Grey, not amber: nothing is being viewed any more, and the
   lists under it are the administrator's own again — which the amber banner failed
   to say when it went on naming the driver (8 Oct 2026). */
.viewing-banner-ended {
    color: #333;
    background: #e4e4e4;
    border-bottom-color: #c8c8c8;
}

.viewing-banner-ended a { color: #333; }

.driver-list {
    list-style: none;
    margin: var(--gap) 0 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.driver-row {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    width: 100%;
    text-align: left;
    font: inherit;
    font-size: 14px;
    min-height: max(46px, var(--target));
    padding: 10px 14px;
    color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius);
    cursor: pointer;
}

@media (hover: hover) {
    .driver-row:hover { border-color: var(--mud-palette-primary); }
}

.driver-row-name { font-weight: 500; }

.driver-row-account {
    font-size: var(--fs-tiny);
    color: var(--mud-palette-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------- account -- */

/* The account page is a set of independent cards, so it tiles rather than
   running one long column down the middle of a monitor. */
.panel-grid { display: grid; gap: var(--panel-gap); align-items: start; }
.panel-grid > .job-panel { margin-bottom: 0; }

.qr-code {
    display: block;
    width: clamp(150px, 26vw, 220px);
    max-width: 100%;
    margin: 10px 0 14px;
    padding: 8px;
    background: #ffffff;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius);
}

.account-2fa {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .06em;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--mud-palette-success);
    background: color-mix(in srgb, var(--mud-palette-success) 14%, transparent);
}

/* ===================================================== structure, by width ==
   Only column counts and what is on screen change below. Nothing here touches
   the size of anything you have to press.
   ========================================================================== */

/* -- tablet portrait, and a phone turned sideways ------------------------- */
@media (min-width: 600px) {
    .portal-brand .tenant { display: block; }

    /* Tabs and search share a line: worth about fifty pixels of height. The cap
       is because a search box the width of a monitor looks like a mistake. */
    /* A small basis, so the tabs and the search both fit on the line and share
       what is left; at their natural 190px each the search would drop below. */
    .queue-tabs { flex: 1 1 360px; }
    .queue-search { flex: 1 1 240px; max-width: 420px; }

    .job-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* The job on the left, where it is going on the right. */
    .job-header { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* Details beside the signature. The photographs have a tab of their own — they
       are the tallest thing on a leg and were pushing the boxes a driver fills in
       off the top of a tablet screen. */
    .leg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* Before the leg is started there is no signature to sit beside, so the
       details take the whole row rather than leaving half of it empty. */
    .leg-details.span-all { grid-column: 1 / -1; }

    .driver-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* A form field the width of a landscape tablet is unpleasant to read and to
       fill in; the panels keep their own comfortable measure. */
    .job-panel .field,
    .job-panel .check { max-width: 460px; }

    /* Save is a button, not a bar, once there is room beside it. */
    .job-save { justify-content: flex-end; }
    .job-save > * { flex: 0 0 auto; min-width: 220px; }
    .job-save .mud-width-full { width: auto; }
}

/* -- tablet landscape, small laptop --------------------------------------- */
@media (min-width: 900px) {
    .job-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }

    /* Room to name the destinations in the bar rather than behind the menu. */
    .portal-nav { display: flex; }
}

/* -- desktop --------------------------------------------------------------
   The leg layout is already right by this point — details beside the signature,
   photographs beneath. A desktop just gets more room for it.                  */
@media (min-width: 1120px) {
    /* The job's own details need less width than where it is going, whose lines
       are addresses. */
    .job-header { grid-template-columns: minmax(0, 4fr) minmax(0, 5fr); }

    .panel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .driver-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* -- wide desktop --------------------------------------------------------- */
@media (min-width: 1560px) {
    .job-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ======================================================= rhythm, by height ==
   A tablet in a cab cradle has around 560px of usable height; so does a laptop
   once the browser has taken its share of a 768px screen. Both want the same
   thing — less vertical padding. Neither wants a different number of columns,
   which is why nothing structural appears below.
   ========================================================================== */

@media (max-height: 720px) {
    .portal-shell { --bar-height: 46px; }

    .portal-content { padding-block: 12px; }
    .page-head { margin-bottom: 10px; }
    .portal-lead,
    .job-detail-meta { font-size: var(--fs-small); }

    .job-panel { padding: 11px 13px; }
    .job-panel h2 { margin-bottom: 2px; }
    .job-times,
    .job-reference { margin-bottom: 8px; }
    .field { margin-bottom: 10px; }

    /* Enough to sign in, without eating the screen. */
    .signature-pad { height: clamp(120px, 20vh, 150px); }

    /* Sticking Save to the bottom costs height a short screen has not got, and
       the page is short enough here that it stays in reach anyway. */
    .job-save {
        position: static;
        padding: 8px 0 4px;
        background: none;
    }
}

/* ================================================================== detail == */

/* MudBlazor sizes from the shared sheet's 13.5px root, which is a back-office
   density. On a touchscreen its buttons come out under a fingertip. */
@media (pointer: coarse) {
    .portal-shell .mud-button-root { min-height: 44px; font-size: 14px; }
}

/* Keyboard users on a desktop need to see where they are. */
.portal-shell :is(a, button, summary, input, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* There is deliberately no `prefers-reduced-motion` block here.
   The portal declares no animation of its own — every moving thing on screen
   belongs to MudBlazor, and the only one that matters is the loading bar, whose
   movement is information rather than decoration. A blanket damping rule can
   therefore only reach into a third party's animations, which is exactly where
   it does harm: `animation-duration: .01ms` does not stop something declared
   `infinite`, it runs the whole cycle tens of thousands of times a second and
   turns the loading bar into a strobe. If motion is ever added here, damp that
   animation specifically rather than reintroducing a rule over `*`. */

/* ------------------------------------------------------------- timesheets -- */

/* The week as a list of weeks, like the job list: a card per week, the whole
   card the target. */
.week-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.week-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-left: 4px solid var(--mud-palette-lines-default);
    border-radius: var(--radius);
    cursor: pointer;
}

.week-card.status-draft { border-left-color: var(--mud-palette-warning); }
.week-card.status-submitted { border-left-color: var(--mud-palette-info); }
.week-card.status-processed { border-left-color: var(--mud-palette-success); }

.week-card .week-dates { font-weight: 600; }
.week-card .week-meta { font-size: var(--fs-small); color: var(--mud-palette-text-secondary); }

/* One day of the sheet: a card with the paper form's columns as fields. Two
   fields to a line where they fit, the comments the full width. */
.day-list { display: grid; gap: 12px; }

.day-card {
    padding: 12px 14px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius);
}

.day-card.day-worked { border-left: 4px solid var(--mud-palette-primary); }

.day-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.day-head h3 { margin: 0; font-size: 15px; }
.day-head .day-hours { margin-left: auto; font-size: var(--fs-small); color: var(--mud-palette-text-secondary); font-variant-numeric: tabular-nums; }

.day-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 4px 12px;
}

.day-grid .field { margin-bottom: 8px; }
.day-grid .field-wide { grid-column: 1 / -1; }

.day-flags { display: flex; flex-wrap: wrap; gap: 16px; grid-column: 1 / -1; margin-bottom: 8px; }

.sheet-locked {
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--mud-palette-info-lighten);
    color: var(--mud-palette-info-darken);
    margin-bottom: 14px;
}

.sheet-declaration { margin: 16px 0 8px; }

.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ----------------------------------------------------------------- leave -- */

.leave-balance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.leave-stat {
    padding: 10px 12px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius);
}

.leave-stat .label { font-size: var(--fs-tiny); color: var(--mud-palette-text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.leave-stat .value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.leave-stat.accent { border-color: var(--mud-palette-primary); }
.leave-stat.neg .value { color: var(--mud-palette-error); }

.leave-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.leave-card {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-left: 4px solid var(--leave-colour, #0099cc);
    border-radius: var(--radius);
}

.leave-card .leave-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.leave-card .leave-type { font-weight: 600; }
.leave-card .leave-status {
    margin-left: auto;
    font-size: var(--fs-tiny);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--mud-palette-lines-default);
}
.leave-card .leave-status.status-approved { background: var(--mud-palette-success-lighten); color: var(--mud-palette-success-darken); }
.leave-card .leave-status.status-pending { background: var(--mud-palette-warning-lighten); color: var(--mud-palette-warning-darken); }
.leave-card .leave-status.status-declined { background: var(--mud-palette-error-lighten); color: var(--mud-palette-error-darken); }
.leave-card .leave-dates { font-size: 13.5px; }
.leave-card .leave-meta { font-size: var(--fs-small); color: var(--mud-palette-text-secondary); }
.leave-card .leave-actions { display: flex; justify-content: flex-end; }

.leave-form {
    padding: 14px;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.leave-form .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.leave-form .form-grid .field-wide { grid-column: 1 / -1; }

.leave-check {
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--mud-palette-background-gray);
    margin-bottom: 10px;
    font-size: 13.5px;
}
