/* Job Submittals tab and dialog. One accent colour, #2828da. Status always shows a word and an icon. */

.sm-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.05rem 0.5rem;
    border: 1px solid #6b6b6b;
    border-radius: 1rem;
    color: #222;
    background: #fff;
    font-size: 0.8125rem;
    line-height: 1.4;
    white-space: nowrap;
}

/* The ball is with the reviewer: the one state that needs watching gets the accent. */
.sm-chip[data-status="Sent"],
.sm-chip[data-status="WaitingApproval"] {
    border-color: #2828da;
    color: #2828da;
}

.sm-chip-large {
    font-size: 1rem;
    padding: 0.2rem 0.75rem;
}

.sm-grid:focus-visible,
.sm-close:focus-visible,
.sm-open-link:focus-visible {
    outline: 2px solid #2828da;
    outline-offset: 2px;
}

.sm-dialog.mud-dialog {
    width: 90vw;
    max-width: 60rem;
    max-height: 92vh;
}

.sm-dialog .sm-body {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sm-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sm-close {
    border: 0;
    background: transparent;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
}

.sm-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 2rem;
    padding: 0.75rem 1rem;
    border: 1px solid #c8c8c8;
    border-left: 4px solid #2828da;
    border-radius: 0.25rem;
    background: #fafafa;
}

.sm-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2rem;
    margin: 0;
}

.sm-facts dt {
    font-size: 0.75rem;
    color: #555;
}

.sm-facts dd {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.sm-fact-alert {
    color: #2828da;
}

.sm-cols {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1.5rem;
}

.sm-group-title {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: none;
    color: #222;
    border-bottom: 1px solid #d0d0d0;
    padding-bottom: 0.25rem;
}

.sm-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

.sm-fields .sm-wide {
    grid-column: 1 / -1;
}

.sm-link-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.sm-link-row > .mud-input-control {
    flex: 1 1 auto;
}

.sm-open-link {
    color: #2828da;
    padding-bottom: 0.5rem;
}

.sm-timeline,
.sm-notes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sm-timeline li {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.sm-timeline time {
    color: #555;
}

.sm-notes li {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d8d8d8;
    border-radius: 0.25rem;
}

.sm-unsaved {
    font-style: italic;
}

.sm-note-meta {
    font-size: 0.75rem;
    color: #555;
}

.sm-note-text {
    white-space: pre-wrap;
}

.sm-note-add {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.sm-note-input {
    flex: 1 1 auto;
}

.sm-note-button {
    margin-top: 0.25rem;
    color: #2828da;
    border-color: #2828da;
}

.sm-empty {
    margin: 0.25rem 0;
    color: #555;
    font-size: 0.875rem;
}

.sm-tasks {
    max-height: 22rem;
    overflow: auto;
    border: 1px solid #d8d8d8;
    border-radius: 0.25rem;
}

.sm-error {
    font-weight: 600;
}

.sm-dialog .sm-save.mud-button-filled {
    background-color: #2828da;
    color: #fff;
}

.sm-dialog .sm-save.mud-button-filled.mud-disabled {
    background-color: #c8c8c8;
    color: #666;
}

/* Filter tabs with counts */
.sm-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.sm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.sm-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid #b0b0b0;
    border-radius: 1rem;
    background: #fff;
    color: #222;
    font: inherit;
    cursor: pointer;
}

.sm-filter-count {
    font-variant-numeric: tabular-nums;
    color: #555;
}

.sm-filter-on {
    border-color: #2828da;
    background: #2828da;
    color: #fff;
}

.sm-filter-on .sm-filter-count {
    color: #fff;
}

.sm-filter:focus-visible,
.sm-chain-link:focus-visible,
.sm-area-filter select:focus-visible {
    outline: 2px solid #2828da;
    outline-offset: 2px;
}

.sm-area-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.sm-area-filter select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #b0b0b0;
    border-radius: 0.25rem;
    font: inherit;
}

.sm-response {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.8125rem;
    color: #222;
    font-weight: 600;
}

.sm-unconfirmed {
    display: block;
    width: fit-content;
    margin-top: 0.1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #2828da;
    border: 1px solid #2828da;
    border-radius: 0.25rem;
    padding: 0 0.3rem;
}

.sm-checks {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 1.5rem;
}

.sm-chain {
    list-style: none;
    margin: 0 0 0.75rem;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.sm-chain li + li::before {
    content: "\2192";
    margin-right: 0.25rem;
    color: #555;
}

.sm-chain-current {
    font-weight: 700;
}

.sm-chain-link {
    border: 0;
    background: transparent;
    color: #2828da;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.sm-status-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.sm-response-large {
    display: inline;
    margin: 0;
    font-size: 0.9375rem;
}

.sm-filter {
    white-space: nowrap;
}

.sm-narrow-only {
    display: none;
}

.sm-num {
    font-weight: 600;
}

/* Secondary columns drop out as the tab narrows. Number, Status and Description always stay. */
@media (max-width: 90rem) {
    th.sm-col-3, td.sm-col-3 {
        display: none;
    }
}

@media (max-width: 62rem) {
    th.sm-col-2, td.sm-col-2 {
        display: none;
    }
}

.sm-grid th.tckrd-col-wrap,
.sm-grid td.tckrd-col-wrap {
    min-width: 10rem;
}

@media (max-width: 40rem) {
    th.sm-col-5, td.sm-col-5 {
        display: none;
    }

    .sm-narrow-only {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.15rem;
        margin-top: 0.15rem;
    }

    .sm-narrow-desc {
        font-size: 0.8125rem;
        color: #383434;
    }

    .sm-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        max-width: 100%;
        padding-bottom: 0.25rem;
    }

}

@media (max-width: 40rem) {
    .sm-cols {
        grid-template-columns: minmax(0, 1fr);
    }

    .sm-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .sm-note-add {
        flex-direction: column;
        align-items: stretch;
    }

    .sm-dialog.mud-dialog {
        width: 96vw;
        margin: 0.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sm-dialog,
    .sm-dialog * {
        animation: none !important;
        transition: none !important;
    }
}
