/* The portal's few global styles. Colours come from SMLib's tokens (smlib.css), so light and dark both work. */
body {
    margin: 0;
    background: var(--smt-page-bg);
    color: var(--smt-text);
    font-family: var(--smt-font);
}

code {
    padding: .05rem .3rem;
    font-size: .85em;
    background: var(--smt-bg-hover);
    border-radius: 4px;
}

h1:focus {
    outline: none;
}

.blazor-error-boundary {
    padding: 1rem;
    color: #fff;
    background: #b32121;
    border-radius: var(--smt-radius-sm);
}

    .blazor-error-boundary::after {
        content: "An error has occurred.";
    }

/* Stacks of cards on a page. */
.page-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Cards side by side are as tall as the tallest of their row (SMLib's grid tops them, for forms). */
.smt-dash-grid {
    align-items: stretch;
}

/* A row of buttons under a card's content, and space above an alert inside a card. */
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}

.card-gap {
    margin-top: 1rem;
}

/* Small text under a value, in tables and cards. */
.muted {
    color: var(--smt-text-muted);
    font-size: .8125rem;
}

/* Account pages (statically rendered: global classes, not scoped CSS). */
.auth-link {
    font-weight: 600;
    color: var(--smt-accent-text);
    text-decoration: none;
}

    .auth-link:hover {
        text-decoration: underline;
        text-underline-offset: 3px;
    }

.auth-note {
    margin: 1.25rem 0 0;
    font-size: .8125rem;
    line-height: 1.6;
    color: var(--smt-text-muted);
    text-align: center;
}

.auth-who {
    margin: .75rem 0 0;
    font-size: .875rem;
    color: var(--smt-text-muted);
}

.auth-gap {
    margin-bottom: 1.25rem;
}

.auth-footer-links {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .25rem .75rem;
}

    .auth-footer-links a {
        color: var(--smt-text-muted);
        text-decoration: none;
    }

        .auth-footer-links a:hover {
            color: var(--smt-text);
            text-decoration: underline;
        }

/* NAV pages: the shipment and document panels (drawers render outside the page, so these are global). */
.nav-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: .875rem;
}

/* The trailer report's own dates, side by side. */
.trailer-dates {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1rem;
}

.nav-panel-loading {
    display: grid;
    place-items: center;
    min-height: 12rem;
}

.nav-panel-badges,
.nav-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.nav-panel-heading {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin: .5rem 0 0;
    font-size: .9375rem;
    font-weight: 600;
}

.nav-panel-count {
    padding: 0 .45rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--smt-text-muted);
    background: var(--smt-bg-inset);
    border-radius: 999px;
}

.nav-panel-muted {
    margin: 0;
    font-size: .8125rem;
    color: var(--smt-text-muted);
}

.nav-panel-table {
    overflow-x: auto;
    border: 1px solid var(--smt-border);
    border-radius: var(--smt-radius-sm);
}

    .nav-panel-table table {
        width: 100%;
        border-collapse: collapse;
    }

    .nav-panel-table th,
    .nav-panel-table td {
        padding: .5rem .65rem;
        text-align: left;
        vertical-align: top;
        border-bottom: 1px solid var(--smt-border);
    }

    .nav-panel-table th {
        font-size: .75rem;
        font-weight: 600;
        color: var(--smt-text-muted);
        background: var(--smt-bg-alt);
    }

    .nav-panel-table tr:last-child td {
        border-bottom: none;
    }

    .nav-panel-table tfoot td {
        font-weight: 600;
        border-top: 1px solid var(--smt-border-strong);
    }

/* One tab of the shipment panel: its blocks spaced as the panel's own. */
.nav-panel-tab {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Two parties side by side (Shipper and Pickup, as CargoCue had them); stacked when the drawer is narrow. */
.nav-parties {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1.25rem 1.5rem;
}

    .nav-party .nav-panel-heading {
        margin: 0 0 .75rem;
    }

/* The Lines tab: every column NAV keeps, in a frame of its own that scrolls both ways, so the header, the goods
   column and the totals stay in view however long or wide the list is. */
.nav-lines {
    max-height: min(65vh, 40rem);
    overflow: auto;
}

    .nav-lines table {
        width: max-content;
        min-width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }

    .nav-lines th,
    .nav-lines td {
        white-space: nowrap;
    }

    .nav-lines thead th {
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .nav-lines tfoot td {
        position: sticky;
        bottom: 0;
        z-index: 2;
        background: var(--smt-bg-alt);
    }

    .nav-lines .nav-lines-goods {
        position: sticky;
        left: 0;
        z-index: 1;
        min-width: 9rem;
        max-width: 14rem;
        white-space: normal;
        background: var(--smt-bg);
        box-shadow: inset -1px 0 0 var(--smt-border);
    }

    .nav-lines thead .nav-lines-goods,
    .nav-lines tfoot .nav-lines-goods {
        z-index: 3;
        background: var(--smt-bg-alt);
    }

.nav-panel .num,
.nav-panel-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.nav-panel .mono {
    font-family: var(--smt-font-mono, ui-monospace, monospace);
    font-size: .8125rem;
}

.nav-panel-links {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

    .nav-panel-links li {
        display: flex;
        flex-wrap: wrap;
        gap: .75rem;
        align-items: center;
        padding: .5rem .65rem;
        border: 1px solid var(--smt-border);
        border-radius: var(--smt-radius-sm);
    }

        .nav-panel-links li > .num {
            margin-left: auto;
        }

.nav-panel a,
.nav-link-cell {
    font-weight: 600;
    color: var(--smt-accent-text);
    text-decoration: none;
}

    .nav-panel a:hover,
    .nav-link-cell:hover {
        text-decoration: underline;
        text-underline-offset: 3px;
    }

/* A filter row above a NAV table: each filter as wide as it needs, not stretched across the page. */
.nav-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 16rem));
    gap: .75rem 1rem;
    align-items: end;
}

/* The filter fields in a NAV table's Filters segment (its toolbar), taking the row's width beside the export. */
.nav-toolbar-filters {
    display: flex;
    flex: 1 1 20rem;
    flex-wrap: wrap;
    padding: .25rem 0;
}

    .nav-toolbar-filters > * {
        flex: 1 1 11rem;
        max-width: 16rem;
    }

/* The audited Export Excel button in a NAV table's toolbar, at its right end, level with the fields (NavExport). */
.nav-export {
    display: inline-flex;
    gap: .5rem;
    align-items: center;
    margin-left: auto;
    align-self: flex-end;
    padding-bottom: .25rem;
}

/* "Updated 10:42 · demo" under a NAV page's header. */
.nav-freshness {
    font-size: .8125rem;
    color: var(--smt-text-muted);
}

.nav-nowrap {
    white-space: nowrap;
}

/* Members and a person's organizations (Features/Organizations, Features/Accounts) — rendered in drawers, so global. */
.mm {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    font-size: .875rem;
}

.mm-add {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: 1rem;
    background: var(--smt-bg-alt);
    border: 1px solid var(--smt-border);
    border-radius: var(--smt-radius);
}

.mm-add-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 10rem auto;
    gap: .75rem;
    align-items: end;
}

@media (max-width: 560px) {
    .mm-add-form {
        grid-template-columns: 1fr;
    }
}

.mm-who,
.mm-role {
    margin: 0;
}

.mm-hint {
    margin: 0;
    font-size: .8125rem;
    line-height: 1.5;
    color: var(--smt-text-muted);
}

.mm-option {
    display: flex;
    gap: .6rem;
    align-items: center;
    min-width: 0;
}

.mm-option-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

    .mm-option-text small {
        overflow: hidden;
        color: var(--smt-text-muted);
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.mm-loading {
    display: grid;
    place-items: center;
    min-height: 6rem;
}

.mm-heading {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin: 0 0 .6rem;
    font-size: .9375rem;
    font-weight: 600;
}

.mm-count {
    padding: 0 .45rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--smt-text-muted);
    background: var(--smt-bg-inset);
    border-radius: 999px;
}

.mm-list {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    list-style: none;
    border: 1px solid var(--smt-border);
    border-radius: var(--smt-radius-sm);
}

    /* On a phone the badges and menu wrap under the name rather than squeezing it. */
    .mm-list li {
        display: flex;
        flex-wrap: wrap;
        gap: .5rem .75rem;
        align-items: center;
        padding: .6rem .75rem;
        border-bottom: 1px solid var(--smt-border);
    }

        .mm-list li:last-child {
            border-bottom: none;
        }

.mm-list-quiet li {
    padding-top: .45rem;
    padding-bottom: .45rem;
}

.mm-off {
    opacity: .6;
}

.mm-who-text {
    display: flex;
    flex: 1 1 11rem;
    flex-wrap: wrap;
    gap: .1rem .4rem;
    align-items: center;
    min-width: 0;
}

    .mm-who-text small {
        flex-basis: 100%;
        overflow: hidden;
        font-size: .78rem;
        color: var(--smt-text-muted);
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mm-who-text a,
    .mm-name {
        font-weight: 600;
        color: var(--smt-text);
        text-decoration: none;
    }

    .mm-who-text a:hover {
        color: var(--smt-accent-text);
        text-decoration: underline;
        text-underline-offset: 3px;
    }

.mm-tags {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    gap: .35rem;
    align-items: center;
    margin-left: auto;
}

/* Which companies an invitation to a group also reaches (CompaniesBelowAsync). */
.mm-scope {
    margin: .35rem 0 0;
    line-height: 1.5;
}

    .mm-scope strong {
        font-weight: 600;
    }

.mm-envelope {
    display: grid;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    color: var(--smt-text-muted);
    background: var(--smt-bg-inset);
    border-radius: 50%;
    place-items: center;
}

.pa {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    font-size: .875rem;
}

.pa-head {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: center;
}

.pa-who {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 12rem;
}

    .pa-who strong {
        font-size: 1rem;
    }

    .pa-who small,
    .pa-org small {
        color: var(--smt-text-muted);
    }

.pa-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.pa-list {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    list-style: none;
    border: 1px solid var(--smt-border);
    border-radius: var(--smt-radius-sm);
}

    .pa-list li {
        display: flex;
        flex-wrap: wrap;
        gap: .5rem .75rem;
        align-items: center;
        padding: .6rem .75rem;
        color: var(--smt-text-muted);
        border-bottom: 1px solid var(--smt-border);
    }

        .pa-list li:last-child {
            border-bottom: none;
        }

.pa-off {
    opacity: .6;
}

.pa-org {
    display: flex;
    flex: 1 1 11rem;
    flex-direction: column;
    min-width: 0;
}

    .pa-org a {
        font-weight: 600;
        color: var(--smt-text);
        text-decoration: none;
    }

        .pa-org a:hover {
            color: var(--smt-accent-text);
            text-decoration: underline;
            text-underline-offset: 3px;
        }

/* Tab panels inside a record drawer start a little below the tabs. */
.op .smtab-panel,
.op .mm {
    padding-top: .75rem;
}

.pf {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.mm-add-body {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

/* The top bar's right side. SMLib lets it not shrink and drops the user's name only at 640px, so between a phone and
   a wide screen a long organization and user name pushed the whole page sideways. */
.sal .sal-topbar .sal-topbar-end {
    flex-shrink: 1;
    min-width: 0;
}

.sal .sal-topbar-end .smt-dd {
    min-width: 0;
}

.sal .sal-topbar-end .smt-dd-trigger {
    max-width: 100%;
}

.sal .sal-topbar-end .smt-dd-trigger > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1279.98px) {
    .sal .sal-topbar .sal-user-name {
        display: none;
    }
}

/* A table's search says what it searches: wide enough for its whole placeholder, shrinking only when the row must. */
.smt .smt-header .smt-search {
    flex: 1 1 21rem;
    min-width: min(21rem, 100%);
    max-width: 28rem;
}

/* The per-column filter row, shown only under More filters; what is set in it stays applied and shows as a chip. */
.nav-column-filters-hidden .smt-filter-row {
    display: none;
}

/* On a phone every filter field waits under More filters, so the first rows are in view. */
@media (max-width: 640px) {
    .nav-toolbar-filters:not(.nav-filters-open) {
        display: none;
    }
}

/* The placeholders of a table's search and column filters say what the field is for, so they are read as text. */
.smt .smt-search-input::placeholder,
.smt .smt-filter-input::placeholder {
    color: var(--smt-text-muted);
    opacity: 1;
}

/* A table tool that is on, such as Filters: the accent alone is too faint on its own soft background. */
.smt .smt-header .smt-tool-btn-active {
    color: var(--smt-accent-text);
}
