.sbs-portal-wrap {
    max-width: 1180px;
    margin: 30px auto;
    padding: 0 18px;
    font-family: inherit;
}

.sbs-portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 22px;
    padding: 24px;
    border-radius: 16px;
    background: #2b2b2b;
    color: #fff;
}

.sbs-portal-header h1 {
    margin: 0;
    color: #fff;
    font-size: 32px;
    line-height: 1.2;
}

.sbs-portal-eyebrow {
    margin: 0 0 6px 0;
    color: #ef3b32;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 13px;
}

.sbs-portal-user {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 14px;
}

.sbs-portal-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    margin-bottom: 20px;
}

.sbs-portal-card {
    background: #fff;
    border: 1px solid #e7e7e7;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.sbs-portal-card h2 {
    margin-top: 0;
    margin-bottom: 16px;
    color: #2b2b2b;
}

.sbs-portal-details {
    margin: 0;
}

.sbs-portal-details div {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eeeeee;
}

.sbs-portal-details div:last-child {
    border-bottom: 0;
}

.sbs-portal-details dt {
    font-weight: 700;
    color: #555;
}

.sbs-portal-details dd {
    margin: 0;
    color: #222;
}

.sbs-site-count {
    font-size: 52px;
    line-height: 1;
    font-weight: 800;
    color: #ef3b32;
}

.sbs-sites-list {
    display: grid;
    gap: 12px;
}

.sbs-site-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 16px;
    border: 1px solid #eeeeee;
    border-radius: 12px;
    background: #fafafa;
}

.sbs-site-row h3 {
    margin: 0 0 6px;
    font-size: 18px;
    color: #2b2b2b;
}

.sbs-site-row p {
    margin: 0;
    color: #666;
}

.sbs-coming-soon {
    white-space: nowrap;
    background: #ef3b32;
    color: #fff;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.sbs-portal-notice {
    border-left: 5px solid #ef3b32;
}

@media (max-width: 780px) {
    .sbs-portal-header,
    .sbs-site-row {
        display: block;
    }

    .sbs-portal-user,
    .sbs-coming-soon {
        display: inline-block;
        margin-top: 14px;
    }

    .sbs-portal-grid {
        grid-template-columns: 1fr;
    }

    .sbs-portal-details div {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

.sbs-portal-subtitle {
    margin: 6px 0 0;
    color: rgba(255,255,255,0.82);
    font-size: 15px;
}

.sbs-portal-button,
.sbs-portal-button:visited {
    display: inline-block;
    white-space: nowrap;
    background: #ef3b32;
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.sbs-portal-button:hover,
.sbs-portal-button:focus {
    color: #fff;
    text-decoration: none;
    filter: brightness(0.95);
}

.sbs-breadcrumb {
    margin: -6px 0 18px;
}

.sbs-breadcrumb a,
.sbs-breadcrumb a:visited {
    color: #ef3b32;
    font-weight: 700;
    text-decoration: none;
}

.sbs-breadcrumb a:hover,
.sbs-breadcrumb a:focus {
    text-decoration: underline;
}

.sbs-jobs-list {
    display: grid;
    gap: 12px;
}

.sbs-job-row {
    display: block;
    padding: 16px;
    border: 1px solid #eeeeee;
    border-radius: 12px;
    background: #fafafa;
}

.sbs-job-row h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #2b2b2b;
}

.sbs-job-row p {
    margin: 10px 0 0;
    color: #555;
}

.sbs-job-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sbs-job-meta span {
    display: inline-block;
    background: #ffffff;
    border: 1px solid #e6e6e6;
    color: #444;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.sbs-responsive-table {
    width: 100%;
    overflow-x: auto;
}

.sbs-jobs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.sbs-jobs-table th,
.sbs-jobs-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e6e6e6;
    text-align: left;
    vertical-align: middle;
}

.sbs-jobs-table th {
    color: #777;
    font-weight: 800;
    background: #fafafa;
    white-space: nowrap;
}

.sbs-jobs-table tr:hover td {
    background: #fcfcfc;
}

.sbs-table-action {
    text-align: right !important;
    white-space: nowrap;
}

.sbs-portal-button-small,
.sbs-portal-button-small:visited {
    padding: 8px 12px;
    font-size: 12px;
}

.sbs-muted {
    color: #999;
    font-size: 13px;
}

@media (max-width: 780px) {
    .sbs-jobs-table,
    .sbs-jobs-table thead,
    .sbs-jobs-table tbody,
    .sbs-jobs-table th,
    .sbs-jobs-table td,
    .sbs-jobs-table tr {
        display: block;
    }

    .sbs-jobs-table thead {
        display: none;
    }

    .sbs-jobs-table tr {
        border: 1px solid #eeeeee;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 12px;
        background: #fafafa;
    }

    .sbs-jobs-table td {
        border-bottom: 0;
        padding: 8px 0;
    }

    .sbs-jobs-table td::before {
        content: attr(data-label);
        display: block;
        color: #777;
        font-size: 12px;
        font-weight: 800;
        margin-bottom: 3px;
    }

    .sbs-table-action {
        text-align: left !important;
    }
}

/* v0.7: allow the site overview to show Jobs and Assets summary cards neatly. */
@media (min-width: 981px) {
    .sbs-portal-grid {
        grid-template-columns: minmax(0, 1fr) 220px 220px;
    }
}

@media (min-width: 781px) and (max-width: 980px) {
    .sbs-portal-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sbs-portal-card-main {
        grid-column: 1 / -1;
    }
}

.sbs-assets-table td:first-child strong,
.sbs-jobs-table td:first-child strong {
    color: #a80014;
}

/* v0.8 asset detail refinements */
.sbs-asset-subtable th,
.sbs-asset-subtable td {
    vertical-align: top;
}

.sbs-assets-table td,
.sbs-jobs-table td {
    white-space: normal;
}

.sbs-debug-json {
    max-height: 520px;
    overflow: auto;
    background: #111;
    color: #f7f7f7;
    padding: 18px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
}

/* v0.10 asset history/readings polish */
.sbs-test-readings-row td {
    background: #f4f6f8;
    padding: 0 !important;
}

.sbs-test-readings {
    padding: 10px 14px 12px;
}

.sbs-test-reading-line {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(120px, 240px);
    gap: 18px;
    padding: 7px 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 0.92em;
}

.sbs-test-reading-line:last-child {
    border-bottom: 0;
}

.sbs-test-reading-line span {
    color: #6f777d;
}

.sbs-test-reading-line strong {
    color: #1f2933;
    font-weight: 600;
}

.sbs-test-failures {
    padding: 10px 14px 12px;
    border-top: 1px solid rgba(0,0,0,0.08);
}

@media (max-width: 760px) {
    .sbs-test-reading-line {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* v0.11 service history accordion */
.sbs-test-history-summary-row td {
    vertical-align: middle;
}

.sbs-history-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #ef3330;
    background: #ef3330;
    color: #ffffff;
    border-radius: 999px;
    padding: 8px 13px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}

.sbs-history-toggle:hover,
.sbs-history-toggle:focus {
    background: #cf1f1d;
    border-color: #cf1f1d;
    color: #ffffff;
}

.sbs-history-toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255,255,255,0.22);
    font-weight: 900;
}

.sbs-test-readings-row[hidden] {
    display: none !important;
}

.sbs-test-readings-row td {
    border-top: 0;
}

.sbs-small-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #ef342f;
    color: #fff !important;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
}

.sbs-small-action-button:hover,
.sbs-small-action-button:focus {
    filter: brightness(0.95);
    color: #fff !important;
}

.sbs-debug-box {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px dashed #b0b0b0;
    background: #f8f8f8;
    color: #333;
    border-radius: 8px;
    font-size: 14px;
}
.sbs-debug-box pre {
    max-height: 420px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fff;
    padding: 12px;
    border: 1px solid #ddd;
}

.sbs-section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.sbs-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
}

.sbs-dashboard-spacer {
    margin-top: 18px;
}

.sbs-dashboard-tile {
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    padding: 18px 16px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(0,0,0,0.04);
}

.sbs-dashboard-tile span {
    display: block;
    color: #707780;
    font-weight: 800;
    font-size: 14px;
    line-height: 1.25;
    margin-bottom: 10px;
}

.sbs-dashboard-tile strong {
    display: block;
    color: #af001b;
    font-size: 34px;
    line-height: 1;
    font-weight: 900;
}

.sbs-dashboard-tile-primary {
    background: #af001b;
    border-color: #af001b;
}

.sbs-dashboard-tile-primary span,
.sbs-dashboard-tile-primary strong {
    color: #ffffff;
}

.sbs-dashboard-tile-warning {
    border-color: #ffd9d9;
    background: #fff7f7;
}

.sbs-ai-summary {
    border-left: 5px solid #af001b;
    padding: 4px 0 4px 18px;
}

.sbs-ai-summary p {
    margin: 0 0 10px;
}

.sbs-site-search-wrap {
    margin: 10px 0 18px;
}

.sbs-site-search-wrap label {
    display: block;
    font-weight: 800;
    color: #3d4349;
    margin-bottom: 8px;
}

.sbs-site-search {
    width: 100%;
    max-width: 680px;
    padding: 14px 16px;
    border: 1px solid #d7d7d7;
    border-radius: 12px;
    font-size: 16px;
    background: #ffffff;
}

.sbs-site-search:focus {
    outline: none;
    border-color: #ef3330;
    box-shadow: 0 0 0 3px rgba(239, 51, 48, 0.12);
}

.sbs-site-search-empty[hidden] {
    display: none !important;
}

/* v0.21: add clearer vertical spacing between the main portal sections. */
.sbs-portal-wrap > .sbs-portal-card {
    margin-bottom: 24px;
}

.sbs-portal-wrap > .sbs-portal-grid {
    margin-bottom: 24px;
}

.sbs-dashboard-card {
    margin-top: 4px;
}

/* v0.26: jobs are temporarily removed from the company dashboard to protect page speed. */
.sbs-dashboard-notice {
    border: 1px solid #ffd9d9;
    border-radius: 16px;
    background: #fff7f7;
    padding: 16px 18px;
    color: #707780;
    margin-bottom: 18px;
}

.sbs-dashboard-notice strong {
    display: block;
    color: #af001b;
    margin-bottom: 6px;
}

.sbs-dashboard-notice span {
    display: block;
}

.sbs-dashboard-tile-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sbs-dashboard-tile-link:hover,
.sbs-dashboard-tile-link:focus {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: #af001b;
    text-decoration: none;
}

.sbs-dashboard-tile-link:focus {
    outline: 3px solid rgba(175,0,27,0.22);
    outline-offset: 3px;
}

/* v0.32: customer-facing compliance dashboard tiles. */
.sbs-compliance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.sbs-compliance-tile {
    border: 1px solid #e8e8e8;
    border-radius: 18px;
    padding: 16px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(0,0,0,0.04);
    color: inherit;
    text-decoration: none;
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.sbs-compliance-tile-link:hover,
.sbs-compliance-tile-link:focus {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    text-decoration: none;
}

.sbs-compliance-tile-link:focus {
    outline: 3px solid rgba(175,0,27,0.22);
    outline-offset: 3px;
}

.sbs-compliance-tile-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.sbs-compliance-tile-head span {
    color: #3d4349;
    font-weight: 900;
    font-size: 16px;
}

.sbs-compliance-tile-head strong {
    color: #af001b;
    font-size: 30px;
    line-height: 1;
    font-weight: 900;
}

.sbs-compliance-tile-body {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sbs-compliance-gauge {
    --gauge-color: #af001b;
    width: 94px;
    height: 94px;
    border-radius: 50%;
    flex: 0 0 94px;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--gauge-color) calc(var(--score) * 1%), #eeeeee 0);
    position: relative;
}

.sbs-compliance-gauge::before {
    content: "";
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: #ffffff;
    position: absolute;
}

.sbs-compliance-gauge span {
    position: relative;
    z-index: 1;
    font-weight: 900;
    color: #2f353a;
    font-size: 15px;
}

.sbs-compliance-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #707780;
    font-size: 14px;
    line-height: 1.35;
}

.sbs-compliance-meta strong {
    color: #3d4349;
    font-size: 15px;
}

.sbs-compliance-green {
    border-color: rgba(34, 139, 34, 0.35);
    background: #f6fff6;
}

.sbs-compliance-green .sbs-compliance-gauge {
    --gauge-color: #2e9d45;
}

.sbs-compliance-amber {
    border-color: rgba(219, 139, 0, 0.42);
    background: #fffaf0;
}

.sbs-compliance-amber .sbs-compliance-gauge {
    --gauge-color: #d88a00;
}

.sbs-compliance-red {
    border-color: rgba(175, 0, 27, 0.30);
    background: #fff7f7;
}

.sbs-compliance-red .sbs-compliance-gauge {
    --gauge-color: #af001b;
}

@media (max-width: 640px) {
    .sbs-compliance-tile-body {
        align-items: flex-start;
    }
    .sbs-compliance-gauge {
        width: 80px;
        height: 80px;
        flex-basis: 80px;
    }
    .sbs-compliance-gauge::before {
        width: 56px;
        height: 56px;
    }
    .sbs-compliance-gauge span {
        font-size: 13px;
    }
}

/* v0.32: filtered asset list improvements. */
.sbs-section-heading-row-actions {
    align-items: flex-start;
    gap: 18px;
}

.sbs-list-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.sbs-portal-button-secondary {
    background: #ffffff !important;
    color: #af001b !important;
    border: 1px solid rgba(175, 0, 27, 0.35) !important;
}

.sbs-portal-button-secondary:hover {
    background: #fff5f5 !important;
}

.sbs-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
}

.sbs-status-compliant {
    color: #207a35;
    background: #eefaf0;
    border: 1px solid rgba(46, 157, 69, 0.25);
}

.sbs-status-overdue,
.sbs-status-review,
.sbs-status-no-recent {
    color: #af001b;
    background: #fff1f3;
    border: 1px solid rgba(175, 0, 27, 0.25);
}

.sbs-status-review {
    color: #9b5400;
    background: #fff7e8;
    border-color: rgba(216, 138, 0, 0.30);
}

@media (max-width: 760px) {
    .sbs-section-heading-row-actions,
    .sbs-list-header-actions {
        align-items: flex-start;
        justify-content: flex-start;
    }
}
