/* The service portal and the SLA pages. One stylesheet for what the SLA epic built, scoped
   under .sp so nothing here reaches the rest of SiteInfo, and .sp-dialog for the dialogs,
   which render inside the house popdialog and therefore outside any .sp root.

   Colours: the company palette comes from the CSS generated per company in CssHelper,
   either as the classes thead, si-border-color, si-color-dark-grey and specialbutton on
   the element, or as the variables --si-accent, --si-heading and --si-dark-grey. Everything
   hardcoded below is white or a neutral grey, so a customer with its own palette keeps it. */

/* #region Root */
.sp {
    /* Three cards and their gaps. */
    max-width: 1160px;
    margin: 0 auto;
    padding: 16px 16px 24px 16px;
    text-align: left;
    font-size: 14px;
    line-height: 1.4;
    color: #2F2F33;
}

.sp *,
.sp-dialog * {
    box-sizing: border-box;
}

.sp a {
    color: inherit;
}

.sp a:hover {
    text-decoration: underline;
}

/* A root that sits between the toolbar and the grid framework's table. The table sizes
   itself from the viewport and is centred by the page, so it sits outside the root, and
   the root must add no height below itself and as little as possible above: the bar
   already has its own margin, and the numbers in it should read as part of the same
   header. */
.sp-flush {
    padding-top: 0;
    padding-bottom: 0;
}

.sp-flush .sp-stats {
    padding-top: 6px;
}

.sp-center {
    justify-content: center;
}
/* #endregion Root */

/* #region Panels and strips */
.sp-panel {
    border: 1px solid #E4E4E7;
    border-radius: 10px;
    background-color: #FFFFFF;
    padding: 16px 20px;
    margin-top: 16px;
}

.sp-panel-title {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.sp-hint {
    font-size: 12px;
    margin-bottom: 12px;
}

/* A line of text the page wants noticed: the notice strip, the receipt after a change, a
   failed read. The accent is the company's, on the left edge only. */
.sp-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    border: 1px solid #E4E4E7;
    border-left: 4px solid var(--si-accent, #E4E4E7);
    border-radius: 10px;
    background-color: #FFFFFF;
    padding: 12px 16px;
    margin-top: 16px;
}

.sp-strip-text {
    flex: 1 1 240px;
    min-width: 0;
    overflow-wrap: break-word;
}

/* TinyMCE wraps the notice text in a paragraph whose margin would push the strip taller
   than it needs to be. */
.sp-strip-text p {
    margin: 0;
    display: inline;
}

.sp-strip-more {
    margin-left: 8px;
    font-size: 13px;
    white-space: nowrap;
}

.sp-empty {
    font-size: 13px;
    padding: 12px 0 4px 0;
}
/* #endregion Panels and strips */

/* #region Toolbar */
/* The toolbar the portal's grid pages share, with the look of ListSites: one grey rounded
   bar with the heading to the left and the page's controls after it, in place of a bare
   heading and a white panel under it. ListSites and the other grid pages carry these values
   inline, each in its own view; the portal keeps them once, here, so its five pages cannot
   drift apart. Outside .sp on purpose: the bar sits with the grid, which is outside the
   root too. */
.table-toolbar-container {
    display: block;
}

.sp-toolbar {
    display: inline-block;
    min-width: 1200px;
    margin: 4px;
    padding: 8px 8px 0 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    text-align: right;
}

/* The root sets border-box for its own tree; the bar is outside it, and without this a
   control is its height plus padding plus border. */
.sp-toolbar * {
    box-sizing: border-box;
}

.sp-toolbar .toolbar-title {
    float: left;
    margin: 2px 32px 8px 0;
    border-bottom: 3px solid #e67e22;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    color: #333;
}

/* The page's controls on one row, as ListSites lays them out: each label just before its
   control, the buttons last. */
.sp-toolbar .toolbar-form {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
    padding-bottom: 8px;
    text-align: left;
}

.sp-toolbar .toolbar-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sp-toolbar .toolbar-label {
    font-size: 14px;
    font-weight: 300;
    color: #333;
}

/* The same control as ListSites draws. The grid stylesheet nudges toolbar-select up by
   three pixels for ListSites' layout; on this row the control sits where it is. */
.sp-toolbar .toolbar-select {
    top: 0;
    height: 28px;
    padding: 3px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    color: #333;
    font: inherit;
    font-size: 13px;
    line-height: 1.2;
}

.sp-toolbar .toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* The buttons ListSites draws next to its filters: small and grey with white text. One
   class for the submit button and the Excel link, so the two cannot differ. */
.sp-toolbar .toolbar-button {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 4px;
    background-color: #777777;
    color: #FFFFFF;
    font: inherit;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.sp-toolbar .toolbar-button:hover {
    background-color: #5F5F5F;
    color: #FFFFFF;
    text-decoration: none;
}
/* #endregion Toolbar */

/* #region Cards */
/* A grid, not a wrapped flex row: every row gets the same number of columns and every card
   the height of the tallest, so the wall reads as one thing. auto-fill and not auto-fit,
   so a page with one card keeps the card's width instead of stretching it across. */
.sp-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    grid-auto-rows: 1fr;
    gap: 16px;
    padding-top: 16px;
}

.sp-cards .portal-card {
    display: flex;
    min-width: 0;
    min-height: 104px;
    border: 1px solid #E4E4E7;
    border-radius: 10px;
    background-color: #FFFFFF;
    text-decoration: none;
    overflow: hidden;
    transition: box-shadow 120ms ease, transform 120ms ease;
}

.sp-cards a.portal-card:hover {
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10);
    transform: translateY(-1px);
}

.sp-cards .portal-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Fixed: the icon band must not give up width to a long label. */
    flex: 0 0 72px;
}

.sp-cards .portal-card-icon span {
    font-size: 30px;
}

.sp-cards .portal-card-body {
    /* min-width 0 is what lets a flex child shrink and wrap its text; without it the body
       keeps its content width and the card overflows. A column, so the status row can sit
       at the bottom edge whatever the text above it needs: across a row of cards the
       status lines then line up. */
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    padding: 14px 16px;
    overflow-wrap: break-word;
}

.sp-cards .portal-card-title {
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 4px;
}

.sp-cards .portal-card-text {
    font-size: 13px;
}

/* A card the company's level does not include. Dimmed and not hidden: the card is the one
   place a customer learns what the next level buys. The band gives up the palette colour,
   so the lock reads as a lock and not as one more icon in the company's colour. */
.sp-cards .portal-card-locked .portal-card-icon {
    background-color: #F2F2F4;
    color: #8A8A90;
}

/* Muted but still 5:1 against the white card; the lighter band grey would fall to 3:1. */
.sp-cards .portal-card-locked .portal-card-title {
    color: #6B6B70;
}

/* Where the card stands with the company's level: the level that includes it, or a green
   mark that the company's level does, as in the comparison on My SLA. */
.sp-cards .portal-card-status {
    /* Pushed to the bottom of the body, see portal-card-body. */
    margin-top: auto;
    font-size: 13px;
    font-weight: 600;
    padding-top: 10px;
}

.sp-cards .portal-card-status-yes {
    font-size: 13px;
    top: 1px;
    margin-right: 6px;
    color: #2E9E4F;
}

/* The heading between the two groups. Overrides the page's h2 so it sits with the cards
   rather than as a page heading. */
.sp /* The help row under the cards, centred like the cards. */
.sp-help {
    justify-content: center;
    margin: 22px 0 6px 0;
}

.sp-group-title {
    margin: 28px 0 0 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.sp-cards .portal-card-counters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    padding-top: 10px;
}

.sp-cards .portal-card-counter {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sp-cards .portal-card-counter-value {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
}

.sp-cards .portal-card-counter-label {
    font-size: 12px;
}

/* The support telephone on the phone support card. */
.sp-cards .portal-card-contact {
    padding-top: 8px;
}

.sp-cards .portal-card-contact-field {
    font-size: 13px;
}
/* #endregion Cards */

/* #region Forms */
.sp-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}

.sp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.sp-field-unit {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sp-field label,
.sp-field .sp-label {
    font-size: 12px;
    font-weight: 500;
}

.sp input[type="text"],
.sp input[type="date"],
.sp input[type="number"],
.sp input[type="tel"],
.sp input[type="email"],
.sp select,
.sp textarea,
.sp-dialog input[type="text"],
.sp-dialog input[type="date"],
.sp-dialog input[type="number"],
.sp-dialog input[type="tel"],
.sp-dialog input[type="email"],
.sp-dialog select,
.sp-dialog textarea {
    height: 34px;
    padding: 6px 10px;
    border: 1px solid #D0D0D5;
    border-radius: 6px;
    background-color: #FFFFFF;
    color: inherit;
    font: inherit;
    font-size: 14px;
    line-height: 1.3;
}

.sp textarea,
.sp-dialog textarea {
    height: auto;
    resize: vertical;
}

.sp select,
.sp-dialog select {
    padding-right: 28px;
}

/* Site.css turns the outline off on every input. The ring is the only sign of where the
   keyboard is, so it comes back here in the company's accent. */
.sp input:focus,
.sp select:focus,
.sp textarea:focus,
.sp-dialog input:focus,
.sp-dialog select:focus,
.sp-dialog textarea:focus {
    outline: 2px solid var(--si-accent, #A0A0A0);
    outline-offset: 1px;
}

.sp input.sp-short {
    width: 90px;
}

.sp-dialog .sp-field {
    margin-bottom: 12px;
}

.sp-dialog .sp-field input,
.sp-dialog .sp-field select,
.sp-dialog .sp-field textarea {
    width: 100%;
}
/* #endregion Forms */

/* #region Buttons */
/* specialbutton outside the menu gets nothing but a background colour from CssHelper, so
   the shape lives here. The background is !important there, which is why hover is a filter
   and not a colour. */
.sp .specialbutton,
.sp-dialog .specialbutton,
.sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: #FFFFFF;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.sp .specialbutton:hover,
.sp-dialog .specialbutton:hover,
.sp-btn:hover {
    text-decoration: none;
    filter: brightness(1.08);
}

.sp-btn-secondary,
.sp .sp-btn-secondary {
    background-color: #FFFFFF;
    color: #2F2F33;
    border: 1px solid #D0D0D5;
}

.sp-btn-secondary:hover,
.sp .sp-btn-secondary:hover {
    background-color: #F4F4F6;
    filter: none;
}

.sp-btn-small,
.sp .sp-btn-small {
    height: 28px;
    padding: 0 10px;
    font-size: 13px;
}
/* #endregion Buttons */

/* #region Numbers */
.sp-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 32px;
    padding: 16px 4px 4px 4px;
}

/* A verdict in a grid cell, the same two colours as the comparison on My SLA. Not under
   .sp, because the grid sits outside the root. */
.sp-status-ok {
    color: #2E9E4F;
}

.sp-status-fail {
    color: #C8473A;
    font-weight: 600;
}

.sp-stat-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    color: #2F2F33;
}

.sp-stat-label {
    font-size: 12px;
}
/* #endregion Numbers */

/* #region Tables */
/* For short hand-built lists. Data grids use the grid framework and keep its own look. */
.sp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 12px;
}

.sp-table th {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
    text-align: left;
    border-bottom: 1px solid #E4E4E7;
}

.sp-table td {
    padding: 10px 12px;
    border-top: 1px solid #EDEDF0;
    vertical-align: middle;
}

.sp-table tr:first-child td {
    border-top: none;
}

.sp-table tbody tr:hover td {
    background-color: #FAFAFB;
}

.sp-table .sp-table-actions {
    text-align: right;
    white-space: nowrap;
}

.sp-table .sp-table-actions form {
    display: inline;
}

/* The grid framework's rows open a dialog on these pages, so they have to look clickable.
   The notice text is HTML from TinyMCE with a paragraph around it. */
.sp-clickable-rows .tabulator-row {
    cursor: pointer;
}

.sp-clickable-rows .tabulator-cell p {
    margin: 0;
    display: inline;
}

.sp-spinner {
    max-width: 100%;
    padding-top: 32px;
    padding-left: calc(50% - 16px);
}
/* #endregion Tables */

/* #region The SLA comparison */
/* Not a table and none of the messageGrid classes. Those size themselves from their content
   and let it run past the cell, which turned a five column comparison into overlapping
   text. A CSS grid declares the columns once and every cell obeys them. The scroll lives
   on the wrapper so a narrow window scrolls the comparison and nothing else. */
.sp-compare {
    padding-top: 16px;
    overflow-x: auto;
}

.sp-compare .sla-grid {
    display: grid;
    /* min-width rather than a fixed width: the grid fills the space it is given and starts
       scrolling instead of crushing the columns. */
    min-width: 640px;
    background-color: #FFFFFF;
    border: 1px solid #E4E4E7;
    border-radius: 10px;
    /* Clips the cell backgrounds to the rounded corners. */
    overflow: hidden;
}

/* Header. Weight and a rule underneath carry it instead of a filled band: a solid bar across
   the top pulls the eye along the header rather than down into the comparison. */
.sp-compare .sla-head {
    padding: 18px 16px 14px 16px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    border-bottom: 1px solid #D8D8DC;
}

/* The offer's line under the level name. Quieter than the name and never bold, so the name
   stays what the eye lands on. */
.sp-compare .sla-tagline {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.35;
    color: #6B6B70;
}

.sp-compare .sla-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 8px;
    border-width: 1px;
    border-style: solid;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

/* The row label. Quieter than the values: it says what is being compared, and the answers
   are what the customer came to read. */
.sp-compare .sla-label {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    border-top: 1px solid #EDEDF0;
}

.sp-compare .sla-cell {
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.4;
    border-top: 1px solid #EDEDF0;
    overflow-wrap: break-word;
}

/* The yes and the no of a cell: a mark and a colour rather than a word, as in the offer's
   own table. Fourteen rows of "included" and "not included" read as a wall of text, and the
   colour is what lets the columns be compared at a glance. The word is in the title. */
.sp-compare .sla-yes,
.sp-compare .sla-no {
    font-size: 15px;
    top: 2px;
}

.sp-compare .sla-yes {
    color: #2E9E4F;
}

.sp-compare .sla-no {
    color: #C8473A;
}

/* The first row sits straight under the header rule, so it must not add a second one. */
.sp-compare .sla-first-row {
    border-top: none;
}

.sp-compare .sla-foot {
    padding: 16px;
    border-top: 1px solid #EDEDF0;
}

/* The corner cell of the action row. It says where a level change actually happens, so it
   sits beside the buttons rather than under the grid, and is quieter than they are. */
.sp-compare .sla-foot-note {
    font-size: 12px;
    line-height: 1.4;
}

/* The customer's own column. Assembled cell by cell, since a grid has no column to style:
   sides all the way down, closed at the top by the header and at the bottom by the action
   row. The colour is si-border-color on the cells. */
.sp-compare .sla-own {
    border-left-width: 2px;
    border-right-width: 2px;
    border-left-style: solid;
    border-right-style: solid;
}

.sp-compare .sla-cell.sla-own {
    font-weight: 600;
}

.sp-compare .sla-head.sla-own {
    border-top-width: 2px;
    border-top-style: solid;
}

.sp-compare .sla-foot.sla-own {
    border-bottom-width: 2px;
    border-bottom-style: solid;
}
/* #endregion The SLA comparison */

/* #region Dialogs */
/* The house popdialog builds its frame in dialog.js and resets the class on #popcontent
   after the partial has loaded, so the partial cannot mark the frame itself. :has() reads
   the mark from the content instead. A browser without :has() gets the house frame. */
.popcontent:has(.sp-dialog) {
    border: 0;
    border-radius: 12px;
    background-color: #FFFFFF;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}

.sp-dialog {
    width: min(560px, calc(100vw - 40px));
    /* The house frame is fixed to the window and never scrolls, so a dialog taller than the
       window would put its buttons out of reach. Capped at the window, the dialog scrolls
       itself instead. The cap is on the content, so the 80px is the padding and a margin, and
       dvh is the height a phone actually shows, where the browser knows it. */
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
    padding: 20px 24px;
    text-align: left;
    font-size: 14px;
    line-height: 1.4;
    color: #2F2F33;
}

.sp-dialog-wide {
    width: min(720px, calc(100vw - 40px));
}

/* Two columns of fields side by side where the window has room for them, and the one column
   of a narrow dialog below that. What spans both, such as a table or the buttons, goes after
   the columns and takes the whole width. */
@media (min-width: 1100px) {
    .sp-dialog:has(.sp-dialog-split) {
        width: min(960px, calc(100vw - 80px));
    }

    .sp-dialog-split {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        column-gap: 32px;
        align-items: start;
    }
}

.sp-dialog-title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.sp-dialog-subject {
    font-weight: 600;
    padding-bottom: 6px;
}

.sp-dialog-meta {
    font-size: 12px;
    padding-bottom: 12px;
}

.sp-dialog-text {
    padding-bottom: 4px;
}

.sp-dialog-text-pre {
    white-space: pre-wrap;
}

/* Read only detail rows. The label column takes the width of the longest label and the
   value gets the rest. */
.sp-detail {
    display: grid;
    grid-template-columns: minmax(120px, max-content) 1fr;
    gap: 8px 16px;
    margin: 0;
}

.sp-detail dt {
    font-size: 12px;
    padding-top: 2px;
}

.sp-detail dd {
    margin: 0;
    min-width: 0;
    overflow-wrap: break-word;
}

.sp-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #E4E4E7;
}

/* The validation box the house helper renders, with the house colours and the dialog's
   proportions. */
.sp-dialog .validation-summary-errors {
    max-width: none;
    margin: 0 0 12px 0;
    padding: 8px 12px;
    border: 1px solid #F27C4E;
    border-radius: 8px;
    background-color: #FCE5DC;
}

.sp-dialog .validation-summary-errors ul {
    margin: 0;
    padding-left: 18px;
    list-style: disc;
    line-height: 1.4;
    color: #8A2E12;
}
/* #endregion Dialogs */
