.service-rating {
    --rating-selected: #fff2d6;
    --rating-border: #e3e3e3;
    min-inline-size: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

body.dark-mode .service-rating {
    --rating-selected: #4b3820;
    --rating-border: var(--dark-border);
}

.service-rating-stars {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.service-rating-stars li {
    position: relative;
    margin: 0;
}

.service-rating-stars input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    clip-path: inset(50%);
}

.service-rating-stars label,
.service-rating-stars input[type="radio"]:checked + label {
    position: relative;
    display: block;
    box-sizing: border-box;
    width: 52px;
    height: 52px;
    margin: 0;
    border: 1px solid var(--rating-border);
    border-radius: 8px;
    color: inherit;
    font-size: 0;
    cursor: pointer;
}

.service-rating-stars label::before {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px;
    height: 20px;
    background: url("../../Images/rating_empty.png") center / contain no-repeat;
}

.service-rating-stars li:has(input:checked, ~ li input:checked) label {
    background: var(--rating-selected);
}

.service-rating-stars li:has(input:checked, ~ li input:checked) label::before {
    background-image: url("../../Images/rating.png");
}

.service-rating-stars input:focus-visible + label {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}

@media (hover: hover) {
    .service-rating-stars label:hover {
        border-color: currentColor;
    }
}

.service-detail {
    --visit-surface: #fff;
    --visit-soft: #f5f7fa;
    --visit-border: #dfe5ec;
    --visit-text: #243247;
    --visit-muted: #596779;
    --visit-accent: #526781;
    --visit-badge-bg: #edf1f6;
    --visit-badge-text: #43566f;
    --portal-page-title-size: clamp(22px, 4vw, 28px);
    --portal-section-title-size: 17px;
    color: var(--visit-text);
}

body.dark-mode .service-detail {
    --visit-surface: var(--dark-surface, #292a2e);
    --visit-soft: var(--dark-bg-secondary, #27282b);
    --visit-border: var(--dark-border, #44464b);
    --visit-text: var(--dark-text, #f1f1f1);
    --visit-muted: var(--dark-text-secondary, #b8bac0);
    --visit-accent: #a7b8d0;
    --visit-badge-bg: #343e4d;
    --visit-badge-text: #d4dfef;
}

.service-detail .service-detail-heading {
    margin: 8px 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px 24px;
}

.service-detail .service-detail-heading h1 {
    margin: 0;
    color: var(--visit-text);
    font-size: var(--portal-page-title-size);
    line-height: 1.25;
    text-align: left;
    flex: 1 1 280px;
    overflow-wrap: anywhere;
}

.service-detail a[href]:not(.button, .portal-home-tile, .search-criteria-toggle),
.portal-breadcrumb a[href] {
    text-decoration: underline;
    text-underline-offset: .18em;
}

.service-detail a[href]:not(.button, .portal-home-tile, .search-criteria-toggle):is(:hover, :focus-visible),
.portal-breadcrumb a[href]:is(:hover, :focus-visible) {
    text-decoration-thickness: 2px;
}

.service-detail a[href]:not(.button, .portal-home-tile, .search-criteria-toggle):focus-visible,
.portal-breadcrumb a[href]:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.service-cancelled-filter {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 16px;
    box-sizing: border-box;
    margin: 0;
    border: 1px solid var(--visit-border);
    border-radius: 12px;
    background: var(--visit-soft);
    color: var(--visit-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
}

.service-cancelled-filter input[type="checkbox"] {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin: 0;
    cursor: pointer;
}

.service-cancelled-filter:focus-within {
    outline: 2px solid var(--visit-accent);
    outline-offset: 3px;
}

.service-detail:has(#hideCancelledWorkOrders:checked) .service-workorders > .is-cancelled {
    display: none;
}

.service-workorders {
    display: grid;
    gap: 20px;
    margin-bottom: 24px;
}

.service-workorder,
.service-review,
.portal-flow .section,
body.dark-mode .portal-flow .section {
    min-width: 0;
    border: 1px solid var(--visit-border);
    border-radius: 16px;
    background: var(--visit-surface);
    box-shadow: 0 4px 16px rgba(20, 35, 55, .04);
    overflow-wrap: anywhere;
}

.service-workorder {
    border-left: 5px solid var(--visit-accent);
    overflow: hidden;
}

.service-workorder.is-completed,
.portal-contract-accepted,
.portal-payment-summary.is-received {
    --visit-accent: #218350;
    --visit-badge-bg: #e9f6ee;
    --visit-badge-text: #18643e;
}

.service-workorder.is-progress {
    --visit-accent: #2869bb;
    --visit-badge-bg: #eaf2ff;
    --visit-badge-text: #20599e;
}

.service-workorder.is-cancelled,
.portal-contract-ended {
    --visit-accent: #c5353e;
    --visit-badge-bg: #fff0f1;
    --visit-badge-text: #b02330;
}

.service-workorder.is-cancelled {
    border-color: #edb7bd;
    border-left-color: var(--visit-accent);
}

.service-workorder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 20px 24px 12px;
}

.service-detail .service-workorder-header h2,
.service-detail .service-review h2 {
    margin: 0;
    color: var(--visit-text);
    font-size: var(--portal-section-title-size);
    font-weight: 700;
    line-height: 1.4;
    text-align: left;
}

.service-workorder-status {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--visit-badge-bg);
    color: var(--visit-badge-text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.service-workorder-status::before {
    content: "";
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
    background: currentColor;
}

.service-workorder-summary {
    padding: 0 24px 20px;
    color: var(--visit-muted);
    line-height: 1.65;
}

.is-cancelled .service-workorder-summary {
    color: var(--visit-badge-text);
}

.service-workorder-tracking {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--visit-soft);
}

.service-workorder-section {
    padding: 18px 24px;
    border-top: 1px solid var(--visit-border);
    line-height: 1.65;
    display: flow-root;
}

.service-detail .service-workorder-section h3 {
    margin: 0 0 10px;
    color: var(--visit-muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    text-align: left;
}

.service-workorder-section p {
    margin: 6px 0;
}

.service-detail-muted {
    color: var(--visit-muted);
    font-style: italic;
}

.service-review,
.portal-document .section {
    padding: 24px;
    margin-bottom: 24px;
}

.portal-document :is(.section, .service-review) {
    margin-top: 0;
}

.portal-flow {
    --portal-section-space: 16px;
}

.portal-flow.service-detail .service-detail-heading,
.portal-flow .service-workorders {
    margin-bottom: var(--portal-section-space);
}

.portal-flow .service-workorders {
    gap: var(--portal-section-space);
}

.portal-flow:not(.portal-document) :is(.section, .service-review):not(.portal-home-tile) {
    padding: var(--portal-section-space);
    margin: 0 0 var(--portal-section-space);
}

.portal-flow > [class-usoft~="row"]:has(> [class-usoft~="col"] > :is(.section, .portal-service-address)) {
    margin-inline: calc(var(--portal-section-space) / -2);
}

.portal-flow > [class-usoft~="row"]:has(> [class-usoft~="col"] > :is(.section, .portal-service-address)) > [class-usoft~="col"] {
    padding-inline: calc(var(--portal-section-space) / 2);
}

.portal-detail-footnote {
    margin-bottom: 16px;
}

.portal-flow .section .section-header,
body.dark-mode .portal-flow .section .section-header {
    margin: 0 0 12px;
    padding: 0 0 10px;
    background: transparent;
    border-bottom-color: var(--visit-border);
    color: var(--visit-text);
}

.portal-flow .section-header.titre {
    font-size: var(--portal-section-title-size);
    line-height: 1.4;
    font-weight: 700;
    text-transform: none;
}

.portal-flow .section .section-header.contract-optional-heading,
body.dark-mode .portal-flow .section .section-header.contract-optional-heading {
    padding-top: 12px;
}

.contract-services-heading > [class-usoft~="col"]:first-child {
    padding-inline-start: 0;
}

.portal-flow .section .section-header.contract-services-heading.contract-optional-heading {
    margin-top: 12px;
}

.portal-flow .section .section-header.contract-heading-no-divider,
body.dark-mode .portal-flow .section .section-header.contract-heading-no-divider {
    border-bottom: 0;
    padding-bottom: 0;
}

.portal-flow .section .section-seperator,
.portal-flow .section .section-footer {
    margin-inline: 0;
    border-color: var(--visit-border);
}

.portal-flow .total-row,
body.dark-mode .portal-flow .total-row {
    color: var(--visit-muted);
}

.portal-flow .total-row.total-final,
body.dark-mode .portal-flow .total-row.total-final {
    color: var(--visit-text);
    border-top-color: var(--visit-border);
}

.portal-flow .client-summary,
body.dark-mode .portal-flow .client-summary {
    border-radius: 16px;
    background: var(--visit-soft);
    color: var(--visit-text);
}

.portal-heading-group {
    flex: 1 1 280px;
    min-width: 0;
}

.portal-invoice-heading-meta {
    display: grid;
    justify-items: end;
    gap: 4px;
    margin-inline-start: auto;
}

.portal-invoice-addresses,
.portal-invoice-address-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

.portal-invoice-address-heading {
    gap: 4px 8px;
}

.portal-invoice-address-heading .portal-service-meta {
    margin-inline-start: auto;
}

.portal-document :is(.section-header, .total-summary) > [class-usoft="col xs-100"],
.portal-invoice-detail .section [class-usoft~="col"],
.portal-invoice-detail .portal-invoice-lines .section-footer {
    padding-inline: 0;
}

.portal-invoice-detail .portal-invoice-lines [class-usoft~="col"]:has(+ [class-usoft~="col"]) {
    padding-inline-end: 8px;
}

.portal-heading-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 8px;
    color: var(--visit-muted);
}

.portal-contract-period {
    color: var(--visit-text);
    font-size: 18px;
    font-weight: 700;
}

.portal-contract-summary > [class-usoft~="col"] {
    padding-inline: 0;
}

.portal-home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: 1fr;
    gap: 24px;
}

.portal-home-group {
    display: contents;
}

.portal-home-cell {
    display: flex;
    min-width: 0;
}

.portal-home-grid .portal-home-tile {
    flex: 1;
    margin-bottom: 0;
}

@media (min-width: 600px) {
    .portal-home-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

.portal-home-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 300px;
}

.service-detail a.portal-home-tile,
body.dark-mode .service-detail a.portal-home-tile {
    color: var(--visit-text);
    text-decoration: none;
}

.portal-home-tile:hover {
    border-color: var(--visit-accent);
    background: var(--visit-soft);
}

.portal-home-tile:focus-visible {
    outline: 2px solid var(--visit-accent);
    outline-offset: 3px;
}

.portal-payment-summary {
    border-inline-start: 5px solid var(--visit-accent);
    background: var(--visit-badge-bg);
    color: var(--visit-badge-text);
}

.service-detail .portal-payment-summary h2 {
    color: inherit;
}

.portal-payment-subtitle {
    display: block;
    font-size: 14px;
    font-weight: 400;
}

.portal-payment-summary.is-pending,
.portal-contract-processing {
    --visit-accent: #ad7a1e;
    --visit-badge-bg: #fff2d6;
    --visit-badge-text: #704900;
}

body.dark-mode .portal-payment-summary.is-pending,
body.dark-mode .portal-contract-processing {
    --visit-accent: #ffda91;
    --visit-badge-bg: #4b3820;
    --visit-badge-text: #ffda91;
}

.portal-contract-completed {
    --visit-badge-bg: #ededee;
    --visit-badge-text: #515156;
}

body.dark-mode .portal-contract-completed {
    --visit-badge-bg: #3c3d41;
    --visit-badge-text: #dedee2;
}

.portal-home-tile .menu-title {
    margin: 0;
    font-size: var(--portal-section-title-size);
    font-weight: 700;
    line-height: 1.4;
}

.portal-home-tile .menu-image {
    height: 176px;
    max-width: 100%;
    max-height: none;
    object-fit: contain;
    margin: 0;
}

.portal-home-tile .menu-info {
    margin: 0;
    color: var(--visit-muted);
    font-size: 14px;
}

.portal-unavailable h1 {
    color: var(--visit-text);
    font-size: var(--portal-page-title-size);
}

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

.service-detail .service-review h2 {
    margin-bottom: 16px;
}

.service-review-rating {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
}

.service-review-stars {
    display: inline-flex;
    align-items: center;
}

.service-review-comment {
    display: block;
    margin-top: 8px;
    white-space: pre-wrap;
}

.portal-service-address {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 4px 12px;
}

.service-detail .portal-service-address h2 {
    margin-bottom: 0;
}

.portal-service-address > div {
    grid-column: 1 / -1;
    color: var(--visit-muted);
}

.service-workorder-status.portal-service-meta::before {
    content: none;
}

.section.search-criteria.portal-list-filter,
body.dark-mode .section.search-criteria.portal-list-filter {
    --criteria-bg: var(--visit-surface);
    --criteria-bar: var(--visit-surface);
    --criteria-hover: var(--visit-soft);
    --criteria-border: var(--visit-border);
    --criteria-text: var(--visit-text);
    --criteria-muted: var(--visit-muted);
    --criteria-icon-bg: var(--visit-soft);
    margin-bottom: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(20, 35, 55, .04);
}

.portal-list-filter .search-criteria-heading {
    padding-inline: 16px;
}

.portal-list-filter .search-criteria-title {
    font-size: 16px;
    font-weight: 700;
}

.portal-list-filter .search-criteria-fields {
    padding-bottom: 8px;
}

.portal-record-columns,
.portal-record-row {
    display: flow-root;
}

.portal-record-columns {
    padding: 0 0 8px;
    color: var(--visit-muted);
    font-size: 13px;
}

.portal-record-columns + .portal-record-row {
    border-top: 0;
}

.portal-record-row {
    padding: 8px 0;
    border-top: 1px solid var(--visit-border);
}

.portal-record-mobile {
    display: none;
}

.portal-payment-methods .portal-payment-action {
    margin-bottom: 28px;
}

@media (max-width: 899px) {
    .portal-list-filter .search-criteria-fields select,
    .portal-list-filter .search-criteria-checkbox label {
        min-height: 52px;
    }

    .portal-list-filter .search-criteria-checkbox input[type="checkbox"] {
        margin-top: 16px;
    }

}

.portal-service-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, .8fr) minmax(0, 1fr)
        minmax(0, .95fr) minmax(105px, .9fr) 184px;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 0;
}

.portal-service-columns {
    color: var(--visit-muted);
    font-size: 13px;
    font-weight: 700;
}

.portal-service-row,
.portal-service-plan {
    border-top: 1px solid var(--visit-border);
}

.service-detail .portal-service-plan,
.service-detail .portal-service-name {
    margin: 0;
    font-size: 15px;
    line-height: 1.4;
    text-align: left;
}

.service-detail .portal-service-plan {
    padding: 12px 0;
    color: var(--visit-text);
    font-weight: 700;
}

.portal-service-caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.portal-service-actions,
.portal-record-mobile-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.portal-service-actions .button-primary {
    width: auto;
    min-width: 52px;
    min-height: 52px;
    margin: 0;
}

@media (width < 900px) {
    .portal-record-columns,
    .portal-service-columns,
    .portal-service-empty-field {
        display: none;
    }

    .portal-invoice-year > .portal-record-columns + .portal-record-row {
        border-top: 1px solid var(--visit-border);
    }

    .portal-record-mobile {
        display: grid;
        gap: 8px 12px;
    }

    .portal-service-row,
    .portal-record-mobile {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-service-name,
    .portal-service-actions,
    .portal-record-mobile-heading,
    .portal-record-mobile-actions {
        grid-column: 1 / -1;
    }

    .portal-record-mobile-heading {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 4px 8px;
    }

    .portal-record-mobile-heading .portal-service-name {
        grid-column: 1;
    }

    .service-detail .portal-record-mobile-heading .portal-record-title {
        font-size: 18px;
        font-weight: 700;
    }

    .portal-record-mobile-heading img {
        max-width: 52px;
        max-height: 36px;
        object-fit: contain;
    }

    .portal-record-mobile-status {
        grid-column: 1 / -1;
        color: var(--visit-muted);
    }

    .portal-record-mobile-balance {
        display: flow-root;
    }

    .portal-record-mobile-actions input {
        width: auto;
    }

    .portal-service-caption {
        position: static;
        display: block;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
        white-space: normal;
        color: var(--visit-muted);
        font-size: 13px;
    }
}

body.dark-mode .service-workorder.is-completed,
body.dark-mode .portal-contract-accepted,
body.dark-mode .portal-payment-summary.is-received {
    --visit-accent: #68d49b;
    --visit-badge-bg: #203d30;
    --visit-badge-text: #8be0b1;
}

body.dark-mode .service-workorder.is-progress {
    --visit-accent: #83b6ff;
    --visit-badge-bg: #243c59;
    --visit-badge-text: #a5ceff;
}

body.dark-mode .service-workorder.is-cancelled,
body.dark-mode .portal-contract-ended {
    --visit-accent: #ff8390;
    --visit-badge-bg: #4b2a31;
    --visit-badge-text: #ffa6af;
}

body.dark-mode .service-workorder.is-cancelled {
    border-color: #81434c;
    border-left-color: var(--visit-accent);
}

@media (max-width: 600px) {
    .service-workorder-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px 16px 12px;
    }

    .service-workorder-summary {
        padding: 0 16px 18px;
    }

    .service-workorder-section,
    .service-review,
    .portal-document .section {
        padding: 18px 16px;
    }

}
