/* The customer portal's Calm look (portal design, 29 Oct 2026): Bootstrap, white cards on a light grey page, and the dealer's
   colour as a highlight. The layout sets --portal-accent (buttons, the current menu item), --portal-on-accent (text on it)
   and --portal-ink (the colour, darkened when it's too light to read as text or links). From 992px (Bootstrap lg) a side
   menu; below that a header and tabs along the bottom. */

:root {
    --portal-page: #f6f7f9;
    --portal-line: #e3e6ea;
    --portal-line-soft: #eef0f3;
    --portal-text: #1b1f24;
    --portal-text-2: #3a434d;
    --portal-muted: #5b6672;
    --portal-field: #cdd3da;
    --portal-tint: color-mix(in srgb, var(--portal-accent) 11%, #fff);
    --portal-tint-soft: color-mix(in srgb, var(--portal-accent) 7%, #fff);
    --portal-focus: 0 0 0 .2rem color-mix(in srgb, var(--portal-accent) 30%, transparent);
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background: var(--portal-page);
    color: var(--portal-text);
}

a {
    color: var(--portal-ink);
}

a:hover {
    color: var(--portal-ink);
}

/* The dealer's logo, or a tile of its initials and its name. */

.portal-brand {
    display: flex;
    align-items: center;
    gap: .625rem;
    min-width: 0;
    color: var(--portal-text);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}

.portal-brand:hover {
    color: var(--portal-text);
}

/* On its own, so as big as each place allows: many logos are square with space around them. */
.portal-logo {
    max-height: 48px;
    max-width: 200px;
    object-fit: contain;
}

.portal-top-out .portal-logo {
    max-height: 64px;
}

.portal-side .portal-logo {
    max-height: 80px;
}

.portal-tile {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--portal-accent);
    color: var(--portal-on-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
    font-weight: 600;
}

.portal-brand-name {
    overflow-wrap: anywhere;
}

/* Phones and tablets: a header, the page, and tabs along the bottom. */

.portal-side {
    display: none;
}

.portal-top {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    min-height: 60px;
    padding: .5rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--portal-line);
}

.portal-top-out {
    position: static;
    justify-content: center;
}

.portal-main {
    max-width: 1120px;
    padding: 1.25rem 1rem calc(5.5rem + env(safe-area-inset-bottom));
}

.portal-main-out {
    margin: 0 auto;
    padding-bottom: 2.5rem;
}

.portal-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--portal-line);
}

.portal-tab {
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--portal-muted);
    font-size: .75rem;
    text-decoration: none;
}

.portal-tab i {
    font-size: 1.15rem;
}

.portal-tab:hover {
    color: var(--portal-text);
}

.portal-tab.active {
    color: var(--portal-ink);
    font-weight: 600;
}

/* PCs: the side menu. */

@media (min-width: 992px) {
    .portal-shell {
        display: flex;
        min-height: 100vh;
    }

    .portal-side {
        position: sticky;
        top: 0;
        flex: 0 0 248px;
        height: 100vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
        padding: 1.5rem 1rem;
        background: #fff;
        border-right: 1px solid var(--portal-line);
    }

    .portal-side > .portal-brand {
        padding: 0 .5rem;
    }

    .portal-page {
        flex: 1;
        min-width: 0;
    }

    .portal-page > .portal-top,
    .portal-tabs {
        display: none;
    }

    .portal-main {
        padding: 2rem 2.5rem 3rem;
    }

    .portal-main-out {
        padding-top: 2.5rem;
    }
}

/* The menu: the side menu on a PC, the Menu page on a phone. */

.portal-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.portal-nav-group {
    padding: 1rem .75rem .25rem;
    color: var(--portal-muted);
    font-size: .75rem;
}

.portal-nav-link {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .55rem .75rem;
    border-radius: 8px;
    color: var(--portal-text-2);
    text-decoration: none;
}

.portal-nav-link:hover {
    background: var(--portal-page);
    color: var(--portal-text);
}

.portal-nav-link.active {
    background: var(--portal-tint);
    color: var(--portal-ink);
    font-weight: 500;
}

.portal-count {
    margin-left: auto;
    min-width: 1.5rem;
    padding: 0 .45rem;
    border-radius: 999px;
    background: var(--portal-tint);
    color: var(--portal-ink);
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.5rem;
    text-align: center;
}

.portal-nav-link.active .portal-count {
    background: var(--portal-accent);
    color: var(--portal-on-accent);
}

.portal-menu-foot {
    margin-top: auto;
    padding: 1rem .75rem 0;
    border-top: 1px solid var(--portal-line);
    font-size: .875rem;
    line-height: 1.5;
}

.portal-menu-page .portal-nav-link {
    min-height: 48px;
}

.portal-menu-page .portal-menu-foot {
    margin-top: 1rem;
}

/* Pages. */

.portal-main h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

@media (min-width: 992px) {
    .portal-main h1 {
        font-size: 1.75rem;
    }
}

.portal-main h2 {
    font-weight: 600;
}

.portal-section-title {
    margin: 0 0 .5rem;
    font-size: 1rem;
    font-weight: 600;
}

.portal-card {
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: 12px;
    padding: 1rem 1.125rem;
}

.portal-row {
    display: block;
    margin-bottom: .5rem;
    padding: .8rem 1rem;
    background: #fff;
    border: 1px solid var(--portal-line);
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
}

a.portal-row:hover {
    border-color: color-mix(in srgb, var(--portal-accent) 45%, var(--portal-line));
    color: inherit;
}

.portal-figure {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.25;
}

/* "+ VAT" beside a big figure stays small. */
.portal-figure .small,
.fs-5 .small {
    font-size: .875rem;
}

.portal-muted {
    color: var(--portal-muted);
}

.portal-narrow {
    max-width: 420px;
}

/* An order's (later a job's) page: on a phone the addresses, then the parts, then notes; on a wide screen the addresses
   beside the parts and notes. */
.portal-detail {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "side" "main" "notes";
}

.portal-detail-main {
    grid-area: main;
}

.portal-detail-side {
    grid-area: side;
}

.portal-detail-notes {
    grid-area: notes;
}

/* A job's page: on a phone the work and notes come first, then the totals and the unit (portal design, 29 Oct 2026). */
.portal-detail.is-job {
    grid-template-areas: "main" "notes" "side";
}

@media (min-width: 1200px) {
    .portal-detail,
    .portal-detail.is-job {
        grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
        grid-template-areas: "main side" "notes side";
        align-items: start;
    }
}

/* The job card's tasks: a bar of how many are done, then each ticked in the dealer's colour. */
.portal-progress {
    display: flex;
    gap: 4px;
    margin: .75rem 0 .25rem;
}

.portal-progress > span {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--portal-line);
}

.portal-progress > .is-done {
    background: var(--portal-accent);
}

.portal-tasks {
    margin: 0;
    padding: 0;
    list-style: none;
}

.portal-task {
    display: flex;
    gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--portal-line-soft);
}

.portal-task:last-child {
    border-bottom: 0;
}

.portal-task-mark {
    flex: none;
    width: 24px;
    height: 24px;
    border: 2px solid var(--portal-field);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
}

.portal-task.is-done .portal-task-mark {
    background: var(--portal-accent);
    border-color: var(--portal-accent);
    color: var(--portal-on-accent);
}

.portal-task-heading {
    padding: 1rem 0 .25rem;
    color: var(--portal-ink);
    font-weight: 600;
    border-bottom: 1px solid var(--portal-line-soft);
}

.min-w-0 {
    min-width: 0;
}

/* Two columns from 1200px: the main thing, and a narrower one beside it (the order so far, placing the order). */
.portal-split {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

@media (min-width: 1200px) {
    .portal-split {
        grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    }
}

.portal-back {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: .75rem;
    font-size: .875rem;
    text-decoration: none;
}

/* A note to the customer, e.g. the tracking number. */
.portal-callout {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .75rem .875rem;
    border-radius: 10px;
    background: var(--portal-tint-soft);
}

.portal-callout > i {
    color: var(--portal-ink);
}

/* A list of parts inside a card: part and description on the left, money on the right. */
.portal-line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 0;
    border-top: 1px solid var(--portal-line-soft);
}

.portal-line:first-child {
    border-top: 0;
}

.portal-line > :last-child {
    text-align: right;
}

.portal-totals {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    margin-left: auto;
    max-width: 320px;
    padding-top: .75rem;
    border-top: 1px solid var(--portal-line-soft);
}

.portal-totals > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.portal-total {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Notes, as a conversation: the customer's own in grey, the dealer's in its colour. */
.portal-note {
    display: flex;
    gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--portal-line-soft);
}

.portal-avatar {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--portal-tint);
    color: var(--portal-ink);
    font-size: .75rem;
    font-weight: 600;
}

.portal-avatar.is-you {
    background: var(--portal-line-soft);
    color: var(--portal-text-2);
}

/* Status badges (Display.Badge): the dealer's colour, else done, waiting or turned down. */
.portal-badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: 999px;
    background: var(--portal-tint);
    color: var(--portal-ink);
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.portal-badge.is-done {
    background: #e3f4ea;
    color: #17663a;
}

.portal-badge.is-waiting {
    background: #fdf0d8;
    color: #8a4b00;
}

.portal-badge.is-off {
    background: var(--portal-line-soft);
    color: var(--portal-text-2);
}

.portal-badge.is-danger {
    background: #fde7e7;
    color: #a61b1b;
}

/* Steps (ProgressSteps): a line joins each step to the one before, in the dealer's colour once it's reached. */
.portal-steps {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}

.portal-step {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .1rem;
    font-size: .875rem;
    text-align: center;
}

.portal-step::before {
    content: "";
    position: absolute;
    top: 13px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--portal-line);
}

.portal-step:first-child::before {
    display: none;
}

.portal-step.is-done::before,
.portal-step.is-now::before {
    background: var(--portal-accent);
}

.portal-step-mark {
    position: relative;
    z-index: 1;
    width: 28px;
    height: 28px;
    margin-bottom: .35rem;
    border: 2px solid var(--portal-field);
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
}

.is-done .portal-step-mark {
    background: var(--portal-accent);
    border-color: var(--portal-accent);
    color: var(--portal-on-accent);
}

.is-now .portal-step-mark {
    border-color: var(--portal-accent);
}

.is-now .portal-step-mark::after {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--portal-accent);
}

.portal-step-label {
    color: var(--portal-muted);
    font-weight: 500;
}

.is-done .portal-step-label {
    color: var(--portal-text);
}

.is-now .portal-step-label {
    color: var(--portal-text);
    font-weight: 600;
}

.portal-step-detail {
    color: var(--portal-muted);
    font-size: .8125rem;
}

.portal-steps.is-compact .portal-step {
    font-size: .75rem;
}

.portal-steps.is-compact .portal-step::before {
    top: 9px;
}

.portal-steps.is-compact .portal-step-mark {
    width: 20px;
    height: 20px;
    margin-bottom: .2rem;
    font-size: .6rem;
}

.portal-steps.is-compact .is-now .portal-step-mark::after {
    width: 8px;
    height: 8px;
}

.portal-steps.is-compact .portal-step-detail {
    display: none;
}

/* The home page's lists: in progress, and what needs the customer. */
.portal-item {
    padding: .85rem 0;
    border-top: 1px solid var(--portal-line-soft);
}

.portal-item:first-of-type {
    border-top: 0;
}

.portal-notice {
    display: flex;
    gap: .875rem;
    padding: 1rem 1.125rem;
    border: 1px solid color-mix(in srgb, var(--portal-accent) 30%, #fff);
    border-radius: 12px;
    background: var(--portal-tint-soft);
}

.portal-notice > i {
    margin-top: .2rem;
    color: var(--portal-ink);
}

/* Bootstrap in the Calm look: rounder corners, the dealer's colour for buttons, focus rings and switches. */

.btn {
    --bs-btn-border-radius: 8px;
    --bs-btn-font-weight: 500;
    --bs-btn-focus-box-shadow: var(--portal-focus);
}

.btn-sm {
    --bs-btn-border-radius: 6px;
}

.btn-portal {
    --bs-btn-color: var(--portal-on-accent);
    --bs-btn-bg: var(--portal-accent);
    --bs-btn-border-color: var(--portal-accent);
    --bs-btn-hover-color: var(--portal-on-accent);
    --bs-btn-hover-bg: color-mix(in srgb, var(--portal-accent) 88%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--portal-accent) 88%, #000);
    --bs-btn-active-color: var(--portal-on-accent);
    --bs-btn-active-bg: color-mix(in srgb, var(--portal-accent) 80%, #000);
    --bs-btn-active-border-color: color-mix(in srgb, var(--portal-accent) 80%, #000);
    --bs-btn-disabled-color: var(--portal-on-accent);
    --bs-btn-disabled-bg: var(--portal-accent);
    --bs-btn-disabled-border-color: var(--portal-accent);
}

.btn-outline-secondary {
    --bs-btn-color: var(--portal-text);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--portal-field);
    --bs-btn-hover-color: var(--portal-text);
    --bs-btn-hover-bg: var(--portal-page);
    --bs-btn-hover-border-color: #b9c1ca;
    --bs-btn-active-color: var(--portal-text);
    --bs-btn-active-bg: var(--portal-line-soft);
    --bs-btn-active-border-color: #b9c1ca;
}

.btn-link {
    --bs-btn-color: var(--portal-ink);
    --bs-btn-hover-color: var(--portal-ink);
    --bs-btn-active-color: var(--portal-ink);
}

.form-control,
.form-select {
    border-color: var(--portal-field);
    border-radius: 8px;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--portal-accent);
    box-shadow: var(--portal-focus);
}

.form-check-input:checked {
    background-color: var(--portal-accent);
    border-color: var(--portal-accent);
}

.alert {
    --bs-alert-border-radius: 10px;
}
