/* Core Scientific — taken from the live marketing site so the portal reads as part of it:
   Montserrat for headings (uppercase, 700), Source Sans Pro for everything else, and
   #EA802E for the one action on the page. */

:root {
    --brand-orange: #ea802e;
    --brand-orange-dark: #d16f21;
    --brand-green: #04693e;
    --ink: #181818;
    /* Headings and form-input text are a desaturated plum on the marketing site, not the
       near-black the body copy uses. Two roles, two values. */
    --ink-heading: #3c3950;
    --ink-muted: #5f727f;
    --ink-faint: #99a9b5;
    --surface: #f4f6f7;
    /* The utility strip: a near-black navy under a lighter rule, top and bottom. */
    --topbar: #212331;
    --topbar-rule: #474b61;
    --card: #ffffff;
    --line: #dfe5e8;
    --danger: #c0392b;

    --heading: Montserrat, "Segoe UI", system-ui, sans-serif;
    --body: "Source Sans 3", "Source Sans Pro", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--surface);
}

h1, h2, h3 {
    font-family: var(--heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ink-heading);
    margin: 0 0 0.5rem;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }
h1:focus { outline: none; }

a { color: var(--brand-orange-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* Sign-in, registration and password pages: one centred card, the shape customers
   already know from the Experience Cloud portal. */
.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: 26rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(24, 24, 24, 0.06);
}

.auth-logo {
    display: block;
    margin: 0 auto 1.75rem;
    height: 40px;
    width: auto;
}

.auth-footer {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--ink-muted);
    text-align: center;
}

.auth-footer a { display: inline-block; margin: 0 0.5rem; }

.auth-aside {
    margin-top: 1.5rem;
    font-size: 0.8125rem;
    color: var(--ink-faint);
    text-align: center;
}

/* Form controls. The scaffold emits Bootstrap's class names and Bootstrap is not
   loaded, so these are defined here rather than pulled in wholesale. */
.form-floating { position: relative; margin-bottom: 1rem; }

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-family: var(--body);
    font-size: 1rem;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 3px;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 3px rgba(234, 128, 46, 0.15);
}

.form-label, .form-floating > label {
    display: block;
    margin-bottom: 0.3125rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-muted);
}

/* The label follows the input in the markup, so it is moved above it here rather than
   by reordering every page. */
.form-floating { display: flex; flex-direction: column; }
.form-floating > input { order: 2; }
.form-floating > label { order: 1; }
.form-floating > .validation-message { order: 3; }

.form-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.form-check-input { width: 1rem; height: 1rem; accent-color: var(--brand-orange); margin: 0; }
.form-check-label { font-size: 0.9375rem; color: var(--ink-muted); }
.darker-border-checkbox.form-check-input { border-color: #929292; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.625rem 1rem;
    font-family: var(--heading);
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    border: 1px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.btn:hover { text-decoration: none; }
.w-100 { width: 100%; }

.btn-primary { background: var(--brand-orange); color: #fff; }
.btn-primary:hover { background: var(--brand-orange-dark); }

.btn-lg { padding: 0.75rem 1.25rem; font-size: 0.875rem; }

.btn-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--brand-orange-dark);
    font-family: var(--body);
    font-size: 0.875rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.btn-link:hover { text-decoration: underline; }

/* Validation and status */
.valid.modified:not([type=checkbox]) { outline: none; }
.invalid { border-color: var(--danger) !important; }

.validation-message, .text-danger {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--danger);
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 3px;
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

.alert-danger { background: #fdecea; border: 1px solid #f5c6c2; color: #8c2620; }
.alert-success { background: #eaf6f0; border: 1px solid #bfe3d1; color: #14603f; }

.blazor-error-boundary {
    background: var(--danger);
    padding: 1rem;
    color: #fff;
}

.blazor-error-boundary::after { content: "An error has occurred."; }

/* Content inside the portal chrome. The marketing site sets its page title at 32px over a
   generous top margin, and its section headings at 36px; these are the same relationships
   at the smaller scale an application page wants. */

.page h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 1.5rem; }
.page h2 { font-size: 1.25rem; margin-top: 2.5rem; }

.lede { color: var(--ink-muted); font-size: 1.125rem; max-width: 60ch; }

/* Forms that create something in Salesforce. Grouped into fieldsets because the container
   request asks four unrelated questions and a flat column of inputs reads as one. */

.field-group {
    border: 1px solid var(--line);
    background: var(--card);
    padding: 1.25rem 1.5rem 1.5rem;
    margin: 0 0 1.5rem;
}

.field-group legend {
    font-family: var(--heading);
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-heading);
    padding: 0 0.5rem;
}

.field-hint { color: var(--ink-muted); font-size: 0.9375rem; margin: 0 0 1rem; }

.field { display: block; margin: 0 0 1rem; }
.field > span { display: block; margin-bottom: 0.35rem; font-size: 0.9375rem; color: var(--ink-muted); }
.field:last-child { margin-bottom: 0; }

/* Fields that belong together, side by side rather than stacked. An address form with one
   control per row is mostly whitespace and a lot of scrolling. */
.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1rem;
}

.field-row > .field {
    flex: 1 1 12rem;
    min-width: 0;
}

/* A state code is two characters and a ZIP is five; neither earns a third of the row. */
.field-row > .field-narrow { flex: 0 1 7rem; }

@media (max-width: 30rem) {
    .field-row > .field,
    .field-row > .field-narrow { flex-basis: 100%; }
}

.count-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 1rem;
}

.count-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9375rem;
    color: var(--ink-muted);
}

.count-grid input {
    font-family: var(--body);
    font-size: 1rem;
    padding: 0.5rem 0.65rem;
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    width: 100%;
}

.count-grid input:focus, .field-group textarea:focus, .field-group select:focus {
    outline: none;
    border-color: var(--brand-orange);
}

.field-check {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
    font-size: 0.9375rem;
}

.field-check input { width: 1rem; height: 1rem; accent-color: var(--brand-orange); margin: 0; }

.notice {
    padding: 0.9rem 1.1rem;
    margin: 0 0 1.5rem;
    border-left: 4px solid;
    background: var(--card);
}

.notice-good { border-color: var(--brand-green); }

/* An empty list (EmptyState): centred and quiet, not a warning. */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 2.5rem 1.5rem; text-align: center; color: var(--ink-muted); }
.empty-state .icon-chip { margin-bottom: 0.4rem; }
.empty-state strong { color: var(--ink-heading); font-size: 1.0625rem; }
.empty-state p { margin: 0; max-width: 22rem; line-height: 1.5; }
.notice-bad { border-color: var(--danger); color: var(--danger); }

/* Home: the two things a customer comes to do, then where their material is. */

.cta-row { display: flex; gap: 1rem; flex-wrap: wrap; margin: 0 0 2.5rem; }
.cta-row .btn { width: auto; padding-inline: 1.5rem; }
.btn-secondary { background: var(--brand-green); color: #fff; }
.btn-secondary:hover { background: #035430; }

/* A list of lots (LotList) or requests (RequestList), in one design: an icon; what it is,
   with a line under; its detail - a lot's stage and progress, a request's details - and
   the date. Across one line at a desktop width; on a phone, the detail under the rest.
   The whole row opens it - the title's link or button is stretched over it. */
.item-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    background: var(--card);
    border: 1px solid var(--line);
}

.item {
    display: grid;
    grid-template-columns: auto minmax(10rem, 1fr) minmax(12rem, 1.4fr) 7rem;
    grid-template-areas: "icon main detail date" "icon main detail ref";
    align-items: center;
    gap: 0 1.5rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--line);
}

.item:first-child { border-top: 0; }

.item-linked { position: relative; transition: background 0.12s ease; }
.item-linked .item-title::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.item-linked:hover { background: #fffaf5; }
.item-linked:hover .item-title { color: var(--brand-orange-dark); }

.item-icon { grid-area: icon; }
.item-icon .icon-chip { width: 38px; height: 38px; }
.item-icon .icon-chip svg { width: 19px; height: 19px; }

.item-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }

.item-title,
.item-title.file-open {
    font-family: var(--body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink-heading);
    text-decoration: none;
    text-align: left;
}

.item-title.file-open:hover { text-decoration: none; }

/* A group's location, on one line: long names ended with an ellipsis rather than
   making the row three or four lines tall. */
.item-sub { color: var(--ink-muted); font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.item-detail { grid-area: detail; min-width: 0; color: var(--ink-muted); font-size: 0.9375rem; overflow-wrap: anywhere; }

.item-date { grid-area: date; text-align: right; color: var(--ink-muted); font-size: 0.875rem; white-space: nowrap; }
.item-ref { grid-area: ref; text-align: right; color: var(--ink-faint); font-size: 0.8125rem; white-space: nowrap; }
.item-ref.item-event { color: var(--ink-muted); }

/* "View all" under a short list: the list's last row, a finger-sized link to the rest. */
.list-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    margin: -1rem 0 2rem;
    padding: 0.6rem 1.25rem;
    background: var(--card);
    border: 1px solid var(--line);
    font-weight: 600;
    color: var(--brand-orange-dark);
    text-decoration: none;
}

/* Two of them under one list: the second closes up to the first. */
.list-more.list-more-first { margin-bottom: 0; }
.list-more.list-more-next { margin-top: 0; border-top: 0; }

.list-more:hover { background: #fffaf5; text-decoration: none; }

.list-more svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 600px) {
    .list-more { padding-inline: 1rem; }
}

/* A run of labels nobody used, as one row that opens to list them (RequestList). */
.item-list > .item-group { border-top: 1px solid var(--line); }
.item-list > .item-group:first-child { border-top: 0; }
.item-group > details > summary { list-style: none; cursor: pointer; }
.item-group > details > summary::-webkit-details-marker { display: none; }
.item-group > details > summary:hover { background: #fffaf5; }
.item-group > details > summary .item-detail { color: var(--brand-orange-dark); font-weight: 600; }
.item-group > details[open] > summary .item-detail { visibility: hidden; }
.item-group .item-list { margin: 0; border: 0; border-top: 1px solid var(--line); background: var(--surface); }

/* A shipment's carrier logo in its icon's circle (RequestIcon, CarrierMark), on white,
   in the carrier's own colour. */
.icon-chip-carrier { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.icon-chip svg.carrier { display: block; fill: currentColor; stroke: none; }
.icon-chip svg.carrier-fedex { width: 72%; height: auto; color: #4d148c; }
.icon-chip svg.carrier-dhl { width: 76%; height: auto; color: #d40511; }
.icon-chip svg.carrier-usps { width: 66%; height: auto; color: #333366; }
.icon-chip svg.carrier-ups { width: auto; height: 62%; color: #351c15; }
.carrier-name { font-size: 0.625rem; font-weight: 700; color: var(--ink-heading); }

/* Files and notes as rows (FileRow, NoteRow). A file's name runs to one line; its
   Download sits above the row's stretched link so it can be tapped on its own. */
.item-file .item-title { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-file .item-download { position: relative; z-index: 3; color: var(--brand-orange-dark); font-weight: 600; }
.icon-chip-pdf { background: #fbe9e7; color: #b3361f; }
.icon-chip-photo { background: #e4edf6; color: #2f5d86; }
.icon-chip-upload { background: #fdf0e6; color: var(--brand-orange-dark); }
.item-upload .item-title { cursor: pointer; color: var(--brand-orange-dark); }
.item-upload:focus-within { outline: 2px solid var(--brand-orange); outline-offset: -2px; }
.icon-chip-person { background: #e3f0ea; color: var(--brand-green); font-family: var(--heading); font-weight: 700; font-size: 0.8125rem; }
.people-list .item-detail { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: break-word; }
/* No date column for a person: the email takes its room. */
@media (min-width: 601px) { .people-list .item { grid-template-areas: "icon main detail detail" "icon main detail detail"; } }
.people-list + .field-hint { margin-top: 0.75rem; }
.icon-chip-file, .icon-chip-note { background: #eceaf3; color: var(--ink-heading); }
.item-note .item-detail { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* A lot's or a request's detail: where it has got to, and how far along. */
.item-stage { display: block; font-size: 0.9375rem; font-weight: 600; color: var(--ink-heading); margin-bottom: 0.35rem; }
.item-bar { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.item-bar > span { display: block; height: 100%; background: var(--brand-green); border-radius: 3px; }

/* On a phone, how far along as a ring around the icon - and, for a lot, the percentage
   after its stage - in place of the bar. */
.icon-chip { position: relative; }
.item-ring { display: none; }
.item-icon .icon-chip .item-ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); }
.item-ring circle { fill: none; stroke-width: 3; }
.item-ring-track { stroke: var(--line); }
.item-ring-fill { stroke: var(--brand-green); stroke-linecap: round; }
.item-percent { display: none; }

/* The four-stage tracker. The connecting line is drawn behind the dots so it does not
   need a pseudo-element per step. */
.tracker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 0;
    position: relative;
}

.tracker::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 12.5%;
    right: 12.5%;
    height: 2px;
    background: var(--line);
}

.step { text-align: center; position: relative; }

.dot {
    display: block;
    width: 16px;
    height: 16px;
    margin: 0 auto 0.6rem;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid var(--line);
    position: relative;
    z-index: 1;
}

.step.done .dot { background: var(--brand-green); border-color: var(--brand-green); }

.step-label {
    display: block;
    font-family: var(--heading);
    font-weight: 700;
    font-size: 0.625rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding: 0 0.25rem;
}

.step.done .step-label { color: var(--ink-heading); }

.assay {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0 0;
    border-top: 1px solid var(--line);
}

.assay th, .assay td { text-align: left; padding: 0.55rem 0; font-size: 0.9375rem; }

.assay th {
    font-family: var(--heading);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    padding-top: 1rem;
}

.assay td:not(:first-child), .assay th:not(:first-child) { text-align: right; }
.assay tbody td { color: var(--ink-heading); }
.assay tfoot td { border-top: 1px solid var(--line); font-weight: 700; color: var(--ink-heading); }

.lot-settled { margin: 0.75rem 0 0; font-size: 0.875rem; color: var(--ink-muted); }
.lot-summary { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin: 1rem 0 0; color: var(--ink-muted); }
.lot-summary strong { color: var(--ink-heading); }
.lot-view { margin-left: auto; font-weight: 600; }

/* A round icon for a kind of request or a way to get help (RequestIcon, MainLayout's
   dialogs): the same picture wherever that thing appears. */
.icon-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.icon-chip svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-chip-container { background: #fdeee0; color: var(--brand-orange-dark); }
.icon-chip-message, .icon-chip-label { background: #e3f0ea; color: var(--brand-green); }
.icon-chip-call, .icon-chip-pickup { background: #eceaf3; color: var(--ink-heading); }

.icon-chip-lot { background: #fbf1d6; color: #8a6510; }
.icon-chip-shipment { background: #e4edf6; color: #2f5d86; }

.activity { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
.activity th, .activity td { text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.activity th { font-family: var(--heading); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-muted); }
.activity tr:last-child td { border-bottom: 0; }

@media (max-width: 600px) {
    .tracker:not(.lot-hero .tracker) { grid-template-columns: 1fr; gap: 0.75rem; text-align: left; }
    .tracker:not(.lot-hero .tracker)::before { display: none; }
    .step:not(.lot-hero .step) { display: flex; align-items: center; gap: 0.6rem; text-align: left; }
    .dot:not(.lot-hero .dot) { margin: 0; }
    /* Stack each row instead of scrolling it sideways: four columns never fit a phone,
       and a table you have to drag is worse than one you scroll past. */
    .activity thead { display: none; }
    .activity, .activity tbody, .activity tr, .activity td { display: block; width: 100%; }

    .activity tr { border-bottom: 1px solid var(--line); padding: 0.85rem 1rem; }
    .activity tr:last-child { border-bottom: 0; }

    .activity td {
        border: 0;
        padding: 0.2rem 0;
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 1rem;
    }

    .activity td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-family: var(--heading);
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--ink-muted);
    }

    /* The assay table is narrow enough to keep its shape. */
    .assay th, .assay td { padding-inline: 0; font-size: 0.875rem; }
}

/* Lot detail */


/* The lot's own page: the hero panel, its row writ large. */
.lot-hero-head { display: flex; align-items: center; gap: 1rem; }
.lot-hero .item-icon .icon-chip { width: 52px; height: 52px; }
.lot-hero .item-icon .icon-chip svg:not(.item-ring) { width: 24px; height: 24px; }
.lot-hero-title { display: flex; flex-direction: column; min-width: 0; }
.page .lot-hero h1 { margin: 0; font-size: 1.5rem; }
.lot-hero-title span { color: var(--ink-muted); }
.lot-hero .tracker { margin: 1.5rem 0 0; }
.lot-hero .step-label { text-transform: none; letter-spacing: 0; font-family: var(--body); font-weight: 600; font-size: 0.75rem; line-height: 1.3; }
.lot-hero .step[aria-current] .step-label { color: var(--brand-green); }
.lot-facts { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; margin: 1.25rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--line); }
.lot-facts dt { font-size: 0.8125rem; color: var(--ink-muted); }
.lot-facts dd { margin: 0; color: var(--ink-heading); font-weight: 600; }
.lot-facts:not(:has(div)) { display: none; }
.lot-page .panel > .assay:first-of-type, .lot-page .panel-head + .assay { margin-top: 0; border-top: 0; }
.lot-page .panel > .assay th { padding-top: 0; font-size: 0.6875rem; white-space: nowrap; }
.lot-page .settlement-note { color: var(--ink-muted); }
.lot-page .panel > .notice:last-child { margin-bottom: 0; }
.lot-page .panel form { margin: 0; }

.assay.standalone { border-top: 0; margin-top: 0; }

.files { list-style: none; margin: 0 0 1rem; padding: 0; }

.files li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: baseline;
    background: var(--card);
    border: 1px solid var(--line);
    border-bottom: 0;
    padding: 0.8rem 1.1rem;
}

.files li:last-child { border-bottom: 1px solid var(--line); }
.file-meta { color: var(--ink-muted); font-size: 0.8125rem; }

/* File preview.
   A native <dialog>, so Escape, focus trapping and the backdrop come for free rather than
   being reimplemented - which matters more here than usual, because this app has no
   interactivity to lean on. */

.file-open {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--brand-orange-dark);
    cursor: pointer;
    text-align: left;
}

.file-open:hover { text-decoration: underline; }

/* Drawn as the layout's New request and Help dialogs are: rounded, the title in the
   heading face beside a round close button; and, on a phone, a sheet from the bottom. */
.preview {
    width: min(90vw, 900px);
    height: min(88vh, 1100px);
    padding: 0;
    border: 0;
    border-radius: 14px;
    overflow: hidden;
    background: var(--card);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.preview[open] { display: flex; flex-direction: column; }

.preview::backdrop { background: rgba(33, 35, 49, 0.5); }

/* A request's details, rather than a document: a few lines, so a shorter dialog. */
.preview.preview-details { width: min(92vw, 560px); height: min(70vh, 480px); }

.preview-head {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    flex: 0 0 auto;
    padding: 1rem 1rem 0.75rem 1.5rem;
    border-bottom: 1px solid var(--line);
}

#file-preview-name {
    font-family: var(--heading);
    font-weight: 700;
    font-size: 1.125rem;
    text-transform: uppercase;
    color: var(--ink-heading);
    flex: 1 1 auto;
    min-width: 0;
    margin-right: 0.5rem;
    line-height: 1.25;
    /* Two lines rather than an ellipsis, so the reference is not the part cut off. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Print, Download and Close: round icon buttons, as the other dialogs' close is. */
.preview-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    color: var(--ink-muted);
    text-decoration: none;
}

.preview-action:hover { background: var(--surface); color: var(--ink-heading); text-decoration: none; }
.preview-action[hidden] { display: none; }

.preview-action svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.preview iframe,
#file-preview-image {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border: 0;
}

/* The whole photo, as large as the dialog allows and never cropped. */
#file-preview-image { object-fit: contain; background: var(--surface); }

.preview iframe[hidden], #file-preview-image[hidden], #file-preview-text[hidden] { display: none; }

#file-preview-text { flex: 1 1 auto; overflow: auto; padding: 1rem 1.25rem 1.25rem; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.5; }

@media (max-width: 600px) {
    .preview, .preview.preview-details {
        width: 100%;
        max-width: none;
        margin: auto 0 0;
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .preview { height: 92dvh; }
    .preview.preview-details { height: 70dvh; }
    .preview-head { padding-left: 1.25rem; }
}

/* The development-only sign-in link. Dashed, so nobody mistakes it for part of the page. */
.dev-sign-in {
    margin-top: 1rem;
    padding: 0.5rem 0.75rem;
    border: 1px dashed var(--ink-muted);
    font-size: 0.8125rem;
    text-align: center;
}
.dev-sign-in p { margin: 0.25rem 0; }
.dev-sign-in ul { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.dev-sign-in li { margin: 0.2rem 0; }
.dev-sign-in li span { display: block; color: var(--ink-muted); font-size: 0.75rem; }

/* A submit button that is waiting on the server. See busy-submit.js. */
button[aria-busy="true"] { cursor: progress; opacity: 0.85; }

.spinner {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    margin-right: 0.4em;
    vertical-align: -0.1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 2s; }
}

/* A page shown inside the preview dialog: no site chrome, just a margin, on the dialog's
   own white. Its title is the dialog's, so on screen it is not repeated; printed, it is. */
body:has(.bare) { background: var(--card); }
.bare { padding: 1.25rem 1.5rem; max-width: 46rem; }
.bare h1 { font-size: 1.25rem; margin-top: 0; }

@media screen {
    .bare .print-title { display: none; }
}

.request-fields {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.6rem 1.5rem;
    margin: 0;
}

.request-fields dt { color: var(--ink-muted); font-size: 0.875rem; }
.request-fields dd { margin: 0; white-space: pre-line; }

@media (max-width: 600px) {
    .bare { padding: 1rem 1.25rem; }
    .request-fields { grid-template-columns: 1fr; gap: 0.15rem; }
    .request-fields dd { margin-bottom: 0.6rem; }
}

/* Paging under a long list (Pager): Previous, where the rows sit, Next. */
.pager { margin-top: 1rem; }

.pager-pages { display: flex; align-items: center; justify-content: space-between; gap: 1rem; list-style: none; margin: 0; padding: 0; }

.pager-range { margin: 0; font-size: 0.875rem; color: var(--ink-muted); }

.pager-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 44px;
    height: 44px;
    padding: 0 0.6rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--ink-heading);
    font-weight: 600;
    text-decoration: none;
}

a.pager-step:hover { border-color: var(--brand-orange); color: var(--brand-orange-dark); text-decoration: none; }

.pager-step[aria-disabled="true"] { visibility: hidden; }

.pager-step svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* On a phone the arrows go without their words. */
@media (max-width: 600px) {
    .pager-step span { display: none; }
}

/* The header's location switcher. Global, not scoped: it is its own component. A pill:
   pin, name, chevron, on the page's grey, with the native select doing the picking. */
.location-pill {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 16rem;
    min-width: 0;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-heading);
}

.location-pill:hover { background: #ebedf0; }
.location-pill:focus-within { outline: 2px solid var(--brand-orange); outline-offset: 1px; }

.location-pin {
    position: absolute;
    left: 0.7rem;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--brand-green);
    stroke-width: 2;
    pointer-events: none;
}

.location-switch select {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 0 2rem 0 2.1rem;
    border: 0;
    border-radius: 999px;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f727f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.7rem center / 14px;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    color: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}

.location-switch select:focus { outline: none; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}


/* This location / All locations, above a list. */
.scope-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; margin: 0 0 1rem; }
.scope-toggle a { padding: 0.35rem 0.9rem; font-size: 0.875rem; color: var(--ink-heading); text-decoration: none; background: var(--card); }
.scope-toggle a + a { border-left: 1px solid var(--line); }
.scope-toggle a.active { background: var(--ink-heading); color: #fff; }

/* Home's overview: figures beside settlements by quarter. Stacks on a narrow screen. */
.overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 1.5rem;
    background: var(--card);
    border: 1px solid var(--line);
    padding: 1.25rem 1.5rem;
    margin: 0 0 2rem;
}

/* Home's tiles: for a group, where things stand across its locations; for anyone
   else, what is happening now. Each figure is a way into its list. */
.stat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin: 0 0 1.25rem; }
/* The list's heading follows the tiles closely: no section gap above it. */
.stat-tiles + .section-head h2,
h1.visually-hidden + .section-head h2 { margin-top: 0; }
.stat-tiles .stat { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.7rem 0.9rem; background: var(--card); border: 1px solid var(--line); color: var(--ink-muted); font-size: 0.8125rem; text-decoration: none; }
.stat-tiles .stat strong { font-family: var(--heading); font-size: 1.375rem; line-height: 1.2; color: var(--ink-heading); }
.stat-tiles a.stat:hover { border-color: var(--brand-orange); }
/* A lone or odd last tile takes the row, rather than half of it. */
.stat-tiles > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
/* The report: a way out, not a figure - the name in place of a number. */
.stat-tiles .stat-report strong { font-size: 1.125rem; }
.stat-tiles .stat-report span::after { content: " ›"; }
/* Under the Recent list: All lots and All activity, a label and a chevron each. */
.more-tiles { margin: 1rem 0 0; }
.stat-tiles .stat-more { flex-direction: row; align-items: center; justify-content: space-between; }
.stat-tiles .stat-more strong { font-family: var(--body); font-size: 1rem; font-weight: 600; color: var(--brand-orange-dark); }
.stat-more svg { width: 18px; height: 18px; fill: none; stroke: var(--brand-orange-dark); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 900px) { .stat-tiles:not(.more-tiles) { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stat-tiles > .stat:last-child:nth-child(odd) { grid-column: auto; } }

/* An account with nothing yet: a welcome and the way to start. */
.welcome { padding: 1.5rem; background: var(--card); border: 1px solid var(--line); margin: 0 0 1.5rem; }
.welcome h2 { margin-top: 0; }
.welcome p { color: var(--ink-muted); }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.welcome-actions .btn { width: auto; }

.overview-figures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.25rem;
    margin: 0;
    align-content: start;
}

.overview-figures dt { color: var(--ink-muted); font-size: 0.8125rem; }
.overview-figures dd {
    margin: 0.15rem 0 0;
    font-family: var(--heading);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--ink-heading);
}
.overview-figures dd span { font-family: var(--body); font-weight: 400; font-size: 0.875rem; color: var(--ink-muted); }

.overview-chart { margin: 0; }
.overview.overview-chart-only { display: block; }
.overview-empty { color: var(--ink-muted); margin: 0; align-self: center; }
.overview-chart figcaption { color: var(--ink-muted); font-size: 0.8125rem; margin-bottom: 0.5rem; }
.overview-chart svg { display: block; width: 100%; height: auto; }

/* Recessive axes and grid; the data is the only colour. */
.overview-chart .grid { stroke: var(--line); stroke-width: 1; }
.overview-chart .baseline { stroke: var(--ink-faint); stroke-width: 1; }
.overview-chart .axis { fill: var(--ink-muted); font-size: 11px; font-family: var(--body); }
.overview-chart .cap { fill: var(--ink-heading); font-size: 12px; font-weight: 600; font-family: var(--body); }
.overview-chart .mark { fill: var(--brand-green); }
.overview-chart .hit { fill: transparent; }
.overview-chart .bar { outline: none; cursor: default; }
.overview-chart .bar:hover .hit,
.overview-chart .bar:focus-visible .hit { fill: rgba(60, 57, 80, 0.06); }
.overview-chart .bar:focus-visible .mark { stroke: var(--ink-heading); stroke-width: 1.5; }

.chart-table { margin-top: 0.5rem; font-size: 0.8125rem; }
.chart-table summary { cursor: pointer; color: var(--brand-orange-dark); }
.chart-table table { margin-top: 0.5rem; width: 100%; border-collapse: collapse; }
.chart-table th, .chart-table td { text-align: left; padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--line); }

@media (max-width: 760px) {
    .overview { grid-template-columns: 1fr; padding: 1rem; }

    /* The SVG scales as a whole, so its text shrinks with it; on a phone that took the
       axis to about 6px. In viewBox units, so these land near 10-11px on screen. */
    .overview-chart .axis { font-size: 17px; }
    .overview-chart .cap { font-size: 18px; }
}

/* A section heading with an action on the same line. */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-head .download { font-size: 0.875rem; }

/* The description and payee lines under a lot's settlement. Description keeps its line
   breaks: a coin dealer's assay is several lines. */
.settlement-note { white-space: pre-line; font-size: 0.9375rem; margin: 0.5rem 0 0; }

/* The base-metals heading inside a settlement, styled like the table's own head. */
.settlement tr.subhead th { padding-top: 1rem; }

/* The account page: contact beside the figures, stacking on a phone. */
.account-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; margin-bottom: 2rem; }
.account-card { background: var(--card); border: 1px solid var(--line); padding: 1.25rem 1.5rem; }
.account-card h2 { margin-top: 0; }
.account-card h2 + dl { margin-bottom: 1.25rem; }
.people { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.people li { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }

@media (max-width: 760px) {
    .account-grid { grid-template-columns: 1fr; }
}

.your-details { margin-bottom: 2rem; }
.cancel-link { margin-left: 1rem; font-size: 0.875rem; }

.settings-section { margin-bottom: 1.5rem; max-width: 44rem; }

/* A group's Looker Studio report (LookerReports): the old portal embedded it 1400 by 1050. */
.looker-report { margin: 0 0 2rem; }

/* The report on its own page: everything between the header and the bottom of the
   screen, less the tab bar on a phone. */
.report-frame { display: block; width: 100%; height: calc(100dvh - 12rem); min-height: 28rem; border: 1px solid var(--line); background: var(--card); }
@media (max-width: 600px) {
    .has-tabs .page:has(> .report-frame) { padding: 0; }
    .report-frame { height: calc(100dvh - 60px - 56px - env(safe-area-inset-bottom)); min-height: 0; border: 0; }
}
.looker-report iframe { display: block; width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); background: var(--card); }
.looker-open-phone { display: none; }

@media (max-width: 600px) {
    .looker-report iframe, .looker-open { display: none; }
    .looker-open-phone { display: block; }
}

/* An account's notes on My Company: a title, its date, and the text kept as written. */
.account-notes { list-style: none; padding: 0; margin: 0 0 2rem; }
.account-notes li { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.account-notes .file-meta { margin-left: 0.5rem; }
.account-notes p { margin: 0.35rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }

/* The account page (MyAccount.razor): who they are, then panels of the same width - their
   details, sign-in and security, their company - and a quiet way out. */
.account-page { max-width: 46rem; }

.profile-head { display: flex; align-items: center; gap: 1.25rem; margin: 0 0 1.75rem; }
.page .profile-head h1 { margin: 0 0 0.25rem; font-size: 1.75rem; }
.profile-who p { margin: 0; color: var(--ink-muted); }
.profile-who p span + a::before { content: " · "; color: var(--ink-muted); }

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--brand-green);
    color: #fff;
    font-family: var(--heading);
    font-weight: 700;
    font-size: 1.375rem;
    letter-spacing: 0.02em;
}

.panel {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    margin: 0 0 1rem;
}

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 0 1rem; }
.page .panel-head h2 { margin: 0; font-size: 0.875rem; letter-spacing: 0.04em; color: var(--ink-muted); }

/* A quiet, outlined action for a panel: Edit, Change. */
.btn-quiet {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-heading);
    background: var(--card);
    white-space: nowrap;
}

.btn-quiet:hover { border-color: var(--brand-orange); color: var(--brand-orange-dark); text-decoration: none; }

.btn-quiet svg, .btn-signout svg, .panel-link svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-quiet svg { width: 16px; height: 16px; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 2rem; margin: 0; }
.detail-grid dt, .setting-rows dt { font-size: 0.8125rem; color: var(--ink-muted); margin-bottom: 0.15rem; }
.detail-grid dd, .setting-rows dd { margin: 0; color: var(--ink-heading); overflow-wrap: anywhere; }
.detail-grid dd.figure { font-family: var(--heading); font-weight: 700; font-size: 1.25rem; }
.detail-grid dd.figure span { font-family: var(--body); font-weight: 400; font-size: 0.875rem; color: var(--ink-muted); }
.panel .files, .panel .people, .panel .account-notes { margin-bottom: 0; }
/* The quarterly chart inside the summary panel, without a card of its own. */
.panel .overview { border: 0; padding: 0; margin: 1.25rem 0 0; background: none; }
/* Figures stay two to a row on a phone: they are short. */
.detail-grid:has(dd.figure) { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

.setting-rows { margin: 0; }
.setting-rows > div {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.25rem 1rem;
    padding: 0.85rem 0;
    border-top: 1px solid var(--line);
}

.setting-rows > div:first-child { border-top: 0; padding-top: 0; }
.setting-rows dt { margin: 0; }
.setting-rows small { display: block; margin-top: 0.2rem; font-size: 0.8125rem; color: var(--ink-muted); }
.password-mask { letter-spacing: 0.15em; }
.notice-inline { color: var(--brand-green); font-weight: 600; }
.password-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.form-actions { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }

/* My Company, as a row you tap. */
.panel-link { display: flex; align-items: center; gap: 1rem; color: var(--ink-heading); }
.panel-link:hover { border-color: var(--brand-orange); text-decoration: none; }
.panel-link-icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: #e3f0ea; color: var(--brand-green); flex: 0 0 auto; }
.panel-link-icon svg { width: 22px; height: 22px; }
.panel-link-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.panel-link-text span { font-size: 0.875rem; color: var(--ink-muted); }
.panel-link .chevron { width: 20px; height: 20px; color: var(--ink-faint); flex: 0 0 auto; }

.account-signout-form { margin: 1.5rem 0 0; }

.btn-signout {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--card);
    font: inherit;
    font-weight: 600;
    color: var(--ink-muted);
    cursor: pointer;
}

.btn-signout:hover { color: #b3261e; border-color: #e6b8b4; }
.btn-signout svg { width: 18px; height: 18px; }

@media (max-width: 600px) {
    .profile-head { gap: 1rem; margin-bottom: 1.25rem; }
    .avatar { width: 52px; height: 52px; font-size: 1.125rem; }
    .page .profile-head h1 { font-size: 1.375rem; }
    .panel { padding: 1rem; border-radius: 12px; }
    .detail-grid { grid-template-columns: 1fr; gap: 0.85rem; }
    .setting-rows > div { grid-template-columns: minmax(0, 1fr) auto; }
    .setting-rows dt { grid-column: 1 / -1; }
    .btn-signout { width: 100%; justify-content: center; min-height: 48px; }
}

/* ---- Phones -----------------------------------------------------------------------
   Seven of the first eleven customers signed in on a phone, so below 600px the portal is
   laid out as a phone app rather than a narrow website: a tab bar under the thumb, sheets
   for the less frequent places, tighter type and margins, cards you can tap anywhere. */

.tab-bar { display: none; }

@media (max-width: 600px) {
    .tab-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        background: var(--card);
        border-top: 1px solid var(--line);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-height: 56px;
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--ink-muted);
        text-decoration: none;
        cursor: pointer;
        list-style: none;
        -webkit-tap-highlight-color: transparent;
    }

    .tab::-webkit-details-marker { display: none; }

    .tab svg {
        width: 24px;
        height: 24px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .tab.active { color: var(--brand-orange-dark); }
    .tab:hover { text-decoration: none; }

    /* New is the action, so it looks like one. */
    .tab-new svg {
        width: 34px;
        height: 34px;
        padding: 6px;
        border-radius: 50%;
        margin-top: -10px;
        background: var(--brand-orange);
        color: #fff;
        stroke-width: 2.4;
    }

    /* The location picker takes what the logo and the Help button leave, and no more:
       wider, it pushed the Help button off the screen and the page sideways. */
    .has-tabs .location-switch { flex: 1 1 auto; min-width: 0; }
    .has-tabs .location-pill { max-width: none; }

    /* Type and spacing for a 375px screen. */
    .page h1 { font-size: 1.5rem; margin-bottom: 1rem; }
    .page h2 { font-size: 1.0625rem; margin-top: 2rem; }
    .lede { font-size: 1rem; }

    /* Home: the tab bar's New does what these two buttons did. */
    .has-tabs .cta-row { display: none; }

    .overview-figures dd { font-size: 1.25rem; }

    /* A lot or a request in two lines: what it is and when, then its detail - and a
       request's reference under the date. The icon beside both. */
    .item {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas: none;
        align-items: baseline;
        gap: 0.3rem 0.85rem;
        padding: 0.8rem 1rem;
    }

    .item-icon { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
    .item-main { grid-column: 2; grid-row: 1; }
    .item-date { grid-column: 3; grid-row: 1; }
    .item-ref { grid-column: 3; grid-row: 2; }
    .item-detail { grid-column: 2 / -1; grid-row: 2; }
    .item-ref + .item-detail { grid-column: 2; }

    /* Lists run edge to edge, as an app's do: no side borders and no gutter around
       them, their rows' own 16px lining up with the headings above. */
    .has-tabs .item-list, .has-tabs .list-more, .has-tabs .pager {
        margin-left: -16px;
        margin-right: -16px;
        border-left: 0;
        border-right: 0;
    }
    .has-tabs .pager { padding: 0 16px; }
    .has-tabs .item-group .item-list { margin-left: 0; margin-right: 0; }
    /* A list closing a panel meets its edge, rather than leaving the panel's padding
       empty under it. */
    .has-tabs .panel > .item-list:not(:has(~ :not(dialog, #lot-upload))) { margin-bottom: -1rem; border-bottom: 0; }
    .has-tabs .panel:has(> .item-list) { overflow: hidden; }

    /* The tiles run edge to edge too, as one band split by hairlines, rather than boxes
       inset from the rows under them. */
    .has-tabs .stat-tiles { margin-left: -16px; margin-right: -16px; gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
    .has-tabs .stat-tiles .stat { border: 0; padding: 0.75rem 16px; }
    .has-tabs .page > .stat-tiles:not(.more-tiles):first-of-type { margin-top: -20px; border-top: 0; }
    .has-tabs .more-tiles { margin-top: 0; border-top: 0; }

    /* The ring round the icon says how far along, so no bar. */
    .item-detail .item-bar { display: none; }
    .item-icon .icon-chip .item-ring { display: block; }
    .item-percent { display: inline; }
    .item-detail .item-stage { margin: 0; font-weight: 400; color: var(--ink-muted); }
    /* One line, so every row stays the same height. */
    .item-detail, .item-detail .item-stage { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* iOS zooms into any field set smaller than 16px. */
    input, select, textarea, .form-control { font-size: 16px; }

    /* Fingers, not pointers. */
    .btn { min-height: 48px; }

    /* The remaining tables (the company's shipments) as compact two-column cards rather
       than a labelled row per cell. */
    .activity tr {
        display: grid;
        grid-template-columns: 1fr auto;
        column-gap: 1rem;
        row-gap: 0.2rem;
        padding: 0.8rem 1rem;
    }

    .activity td { display: block; padding: 0; }
    .activity td::before { content: none; }

}

/* While the next page is on its way (tab-bar.js): a bar along the top of the screen that
   creeps towards the end and never quite reaches it, so a slow answer still looks alive. */
html.is-navigating::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    height: 3px;
    width: 0;
    background: var(--brand-orange);
    animation: navigating 8s cubic-bezier(0.1, 0.7, 0.2, 1) forwards;
}

@keyframes navigating {
    from { width: 0; }
    10% { width: 35%; }
    to { width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
    html.is-navigating::before { animation: none; width: 100%; opacity: 0.6; }
}

/* Placeholders while a page streams in (LoadingRows, Home's tiles): grey shapes with a
   slow sheen, so it reads as on its way rather than empty. */
.skeleton {
    display: block;
    border-radius: 4px;
    background: linear-gradient(90deg, #eceef1 25%, #f5f6f8 37%, #eceef1 63%);
    background-size: 400% 100%;
    animation: skeleton 1.4s ease infinite;
}
.icon-chip.skeleton { border-radius: 50%; }
.skeleton-line { height: 0.8rem; width: 60%; margin: 0.3rem 0; }
.skeleton-short { width: 4.5rem; margin-left: auto; }
.skeleton-figure { height: 1.4rem; width: 3rem; margin-bottom: 0.35rem; }
.item-list-loading .item-date .skeleton-short { width: 4rem; }
@keyframes skeleton { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* LocationSwitcher's stand-in while the layout streams: the pill's size, no content. */
.location-switch-loading .location-pill { width: 11rem; height: 36px; }

/* Activity's filters: a row of pills that scrolls sideways on a
   phone rather than wrapping into a second row. */
.filter-pills {
    display: flex;
    gap: 0.5rem;
    margin: 0 0 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pills a {
    flex: none;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink-heading);
    font-size: 0.875rem;
    text-decoration: none;
    white-space: nowrap;
}
.filter-pills a.active { background: var(--ink-heading); border-color: var(--ink-heading); color: #fff; }
