/* Public report, approval and self-certification portals. Kept separate from the
   authenticated shell and Login styles so secure-link pages can evolve independently. */

.tim-portal {
    --portal-blue: #014c97;
    --portal-blue-dark: #01356b;
    --portal-blue-soft: #e8f1fa;
    --portal-orange: #ee750f;
    --portal-ink: #1a1d21;
    --portal-muted: #586575;
    --portal-border: #d8e0e8;
    --portal-surface: #ffffff;
    --portal-ground: #f4f7fa;
    --portal-success: #067647;
    --portal-success-soft: #ecfdf3;
    --portal-danger: #a52a24;
    --portal-danger-soft: #fff3f2;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: var(--portal-ground);
    color: var(--portal-ink);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.5;
}

.tim-portal *,
.tim-portal *::before,
.tim-portal *::after {
    box-sizing: border-box;
}

.tim-preserve-lines {
    white-space: pre-line;
}

.tim-portal a,
.tim-portal button,
.tim-portal input,
.tim-portal textarea {
    outline-offset: 3px;
}

.tim-portal a:focus-visible,
.tim-portal button:focus-visible,
.tim-portal input:focus-visible,
.tim-portal textarea:focus-visible,
.tim-portal canvas:focus-visible {
    outline: 3px solid var(--portal-blue) !important;
}

.tim-portal-skip {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1100;
    padding: 10px 14px;
    color: #fff;
    background: var(--portal-blue-dark);
    border-radius: 6px;
    transform: translateY(-150%);
    transition: transform .15s ease;
}

.tim-portal-skip:focus {
    color: #fff;
    transform: translateY(0);
}

.tim-portal-header {
    flex: 0 0 auto;
    background: var(--portal-surface);
    border-bottom: 1px solid var(--portal-border);
}

.tim-portal-header__inner,
.tim-portal-footer__inner {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.tim-portal-header__inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.tim-portal-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 18px;
}

.tim-portal-brand__logo {
    width: 154px;
    height: 48px;
    object-fit: contain;
    object-position: left center;
}

.tim-portal-brand__context {
    padding-left: 18px;
    border-left: 1px solid var(--portal-border);
    color: var(--portal-muted);
    font-size: .875rem;
    font-weight: 600;
}

.tim-portal-security {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--portal-success);
    font-size: .8125rem;
    font-weight: 700;
    white-space: nowrap;
}

.tim-portal-main {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 42px 0 56px;
    flex: 1 0 auto;
}

.tim-portal-main--narrow {
    width: min(820px, calc(100% - 40px));
}

.tim-portal-footer {
    flex: 0 0 auto;
    color: var(--portal-muted);
    background: var(--portal-surface);
    border-top: 1px solid var(--portal-border);
    font-size: .8125rem;
}

.tim-portal-footer__inner {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* At the exact portrait-tablet boundary the desktop footer still fits, but its
   copyright was one word too wide and left "Ltd" orphaned on a second line. */
@media (min-width: 768px) and (max-width: 768px) {
    .tim-portal-footer__inner {
        gap: 16px;
    }

    .tim-portal-footer__inner > span:first-child {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

.tim-portal-card,
.tim-portal .tim-portal-report .card {
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, .05);
}

.tim-portal-card {
    padding: clamp(24px, 4vw, 42px);
}

/* style.css uses the generic .container class for a legacy radio control: it makes
   the element inline, pads it 35px on the left, gives it a pointer cursor, disables
   text selection and sets an ultra-light font weight. ClientPortal also uses Bootstrap's
   .container for the report wrapper, so restore the block container here (this used
   to be an inline style and an inline <style> rule in the view). */
.tim-portal .tim-portal-report {
    display: block;
    padding-top: 0;
    padding-left: 15px;
    margin-bottom: 0;
    cursor: auto;
    user-select: auto;
    font-weight: 400;
}

.tim-portal-eyebrow {
    margin: 0 0 8px;
    color: var(--portal-blue);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tim-portal-title {
    margin: 0;
    color: var(--portal-ink);
    font-size: clamp(1.7rem, 4vw, 2.35rem);
    font-weight: 720;
    letter-spacing: -.025em;
    line-height: 1.15;
}

.tim-portal-lead {
    max-width: 68ch;
    margin: 12px 0 0;
    color: var(--portal-muted);
    font-size: 1rem;
}

.tim-portal-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 18px;
    padding: 5px 10px;
    color: var(--portal-blue-dark);
    background: var(--portal-blue-soft);
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 750;
}

.tim-portal-status--success {
    color: var(--portal-success);
    background: var(--portal-success-soft);
}

.tim-portal-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin: 30px 0;
    border-top: 1px solid var(--portal-border);
    border-bottom: 1px solid var(--portal-border);
}

.tim-portal-summary__item {
    min-width: 0;
    padding: 17px 0;
    border-bottom: 1px solid var(--portal-border);
}

.tim-portal-summary__item:nth-child(odd) {
    padding-right: 28px;
}

.tim-portal-summary__item:nth-child(even) {
    padding-left: 28px;
    border-left: 1px solid var(--portal-border);
}

.tim-portal-summary__item:nth-last-child(-n+2) {
    border-bottom: 0;
}

.tim-portal-summary dt,
.tim-portal-summary dd {
    margin: 0;
}

.tim-portal-summary dt {
    color: var(--portal-muted);
    font-size: .76rem;
    font-weight: 750;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.tim-portal-summary dd {
    margin-top: 4px;
    color: var(--portal-ink);
    font-weight: 620;
    overflow-wrap: anywhere;
}

.tim-portal-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

.tim-portal-btn,
.tim-portal a.tim-portal-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 7px;
    cursor: pointer;
    font: inherit;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.tim-portal-btn--primary,
.tim-portal a.tim-portal-btn--primary {
    color: #fff;
    background: var(--portal-blue);
    border-color: var(--portal-blue);
}

.tim-portal-btn--primary:hover,
.tim-portal a.tim-portal-btn--primary:hover {
    color: #fff;
    background: var(--portal-blue-dark);
    border-color: var(--portal-blue-dark);
}

.tim-portal-btn--secondary,
.tim-portal a.tim-portal-btn--secondary {
    color: var(--portal-blue-dark);
    background: var(--portal-blue-soft);
    border-color: #9bbddd;
}

.tim-portal-btn--quiet {
    color: var(--portal-blue-dark);
    background: #fff;
    border-color: #aeb9c5;
}

.tim-portal-state {
    padding: clamp(28px, 5vw, 48px);
    text-align: center;
}

.tim-portal-state__icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    color: var(--portal-blue);
    background: var(--portal-blue-soft);
    border-radius: 50%;
    font-size: 1.45rem;
}

.tim-portal-state--success .tim-portal-state__icon {
    color: var(--portal-success);
    background: var(--portal-success-soft);
}

.tim-portal-state--error .tim-portal-state__icon {
    color: var(--portal-danger);
    background: var(--portal-danger-soft);
}

.tim-portal-state h1,
.tim-portal-state h2 {
    margin: 0;
    color: var(--portal-ink);
    font-size: clamp(1.45rem, 4vw, 1.9rem);
}

.tim-portal-state p {
    max-width: 58ch;
    margin: 10px auto 0;
    color: #455364;
    line-height: 1.65;
}

.tim-portal-state .tim-portal-eyebrow {
    margin: 0 0 8px;
    color: var(--portal-danger);
}

.tim-portal-state--success .tim-portal-eyebrow {
    color: var(--portal-success);
}

.tim-portal-state--error .tim-portal-state__summary {
    color: var(--portal-ink);
    font-size: 1rem;
    font-weight: 600;
}

.tim-portal-state--error .tim-portal-state__recovery {
    max-width: 52ch;
    margin-top: 18px;
    padding-top: 16px;
    color: #344054;
    border-top: 1px solid var(--portal-border);
    font-weight: 500;
}

.tim-portal-state__recovery strong {
    display: block;
    margin-bottom: 2px;
    color: var(--portal-ink);
}

.tim-portal-alert {
    margin: 0 0 24px;
    padding: 13px 15px;
    color: #78231f;
    background: var(--portal-danger-soft);
    border: 1px solid #e6b9b5;
    border-radius: 8px;
}

.tim-portal-field {
    margin-bottom: 20px;
}

.tim-portal-field > label,
.tim-portal-form .form-group > label {
    display: block;
    margin-bottom: 8px;
    color: var(--portal-ink);
    font-size: .875rem;
    font-weight: 700;
}

.tim-portal .form-control {
    min-height: 44px;
    color: var(--portal-ink);
    border-color: #aeb9c5;
    border-radius: 7px;
}

.tim-portal .form-control:focus {
    border-color: var(--portal-blue);
    box-shadow: 0 0 0 3px rgba(1, 76, 151, .14);
}

.tim-portal-help {
    display: block;
    margin: 6px 0 0;
    color: var(--portal-muted);
    font-size: .82rem;
}

.tim-portal-field-error {
    display: block;
    margin: 6px 0 0;
    color: var(--portal-danger);
    font-size: .82rem;
    font-weight: 650;
    line-height: 1.45;
}

.tim-portal-field-error[hidden] {
    display: none !important;
}

.tim-portal [aria-invalid="true"] {
    border-color: var(--portal-danger) !important;
    box-shadow: 0 0 0 3px var(--portal-danger-soft) !important;
}

.tim-portal-file-input:focus-visible + .tim-portal-file-label {
    outline: 3px solid var(--portal-blue);
    outline-offset: 3px;
}

.tim-portal-form__logo {
    max-width: 210px;
    max-height: 100px;
    display: block;
    margin: 0 auto 26px;
    object-fit: contain;
}

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

.tim-portal-rich-text > :last-child {
    margin-bottom: 0;
}

.tim-portal-form__questions {
    margin: 30px 0;
    padding: 28px 0 8px;
    border-top: 1px solid var(--portal-border);
    border-bottom: 1px solid var(--portal-border);
}

/* Report review: give the legacy data-heavy body the same shell and section rhythm without
   changing its API-backed conditional rendering. */
.tim-portal-report > .row > .col-sm-12 > h4.header-title,
.tim-portal-report > .row > .col-sm-12 > h4.mt-0.header-title {
    margin: 12px 0 12px !important;
    color: var(--portal-ink);
    font-size: 1.1rem;
    font-weight: 740;
}

.tim-portal .tim-portal-report .card {
    margin-bottom: 22px !important;
    overflow: hidden;
}

.tim-portal .tim-portal-report .card-header {
    padding: 15px 20px;
    background: #f8fafc;
    border-bottom-color: var(--portal-border);
}

.tim-portal .tim-portal-report .card-body {
    padding: clamp(16px, 2.5vw, 24px);
    overflow-wrap: anywhere;
}

.tim-portal .tim-portal-report .table {
    margin-bottom: 0;
    color: var(--portal-ink);
}

/* Legacy report sections do not all have enough data-label metadata to become
   stacked cards. Keep the table's native layout so its rows fill the card, and
   put horizontal overflow on a dedicated, keyboard-focusable region. */
.tim-portal .tim-portal-report .tim-portal-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.tim-portal .tim-portal-report .tim-portal-table-scroll:focus-visible {
    outline-offset: -3px !important;
}

.tim-portal .tim-portal-report .table.tim-portal-table--scroll {
    display: table;
    width: 100%;
    min-width: 100%;
}

.tim-portal .tim-portal-report .table th {
    color: #4c5968;
    background: #f8fafc;
    border-color: var(--portal-border);
    font-size: .76rem;
    font-weight: 760;
    letter-spacing: .025em;
}

.tim-portal .tim-portal-report .table td {
    border-color: var(--portal-border);
}

.tim-portal-client-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--portal-border);
}

.tim-portal-client-logos img {
    width: auto;
    max-width: 220px;
    height: 74px;
    object-fit: contain;
}

.tim-portal-signoff {
    margin: 26px 0 8px;
    padding: clamp(20px, 4vw, 34px);
    background: var(--portal-surface);
    border: 1px solid var(--portal-border);
    border-radius: 12px;
}

.tim-portal-signoff > h2 {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

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

.tim-portal-signoff > .tim-portal-actions {
    justify-content: flex-end;
    margin-top: 18px;
}

/* Signature control */
.tim-portal .signature-pad.tim-portal-signature {
    width: 100%;
    max-width: none;
    height: auto;
    max-height: none;
    margin-top: 24px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 1rem;
}

.tim-portal-signature::before,
.tim-portal-signature::after {
    display: none;
}

.tim-portal-signature__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.tim-portal-signature__heading h3,
.tim-portal-signature__heading p {
    margin: 0;
}

.tim-portal-signature__heading h3 {
    color: var(--portal-ink);
    font-size: 1.05rem;
}

.tim-portal-signature__heading p {
    margin-top: 4px;
    color: var(--portal-muted);
    font-size: .85rem;
}

.tim-portal-required {
    padding: 4px 8px;
    color: #8a3d00;
    background: #fff4e8;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
}

.tim-portal-signature__canvas-wrap {
    position: relative;
    width: 100%;
    height: 180px;
    background-color: #fff;
    background-image: linear-gradient(to bottom, transparent calc(100% - 42px), #d9e0e7 calc(100% - 41px), #d9e0e7 calc(100% - 40px), transparent calc(100% - 39px));
    border: 2px solid #9eabb8;
    border-radius: 8px;
    overflow: hidden;
}

.tim-portal-signature__canvas-wrap canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.tim-portal-signature__actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 12px;
}

.tim-portal-signature__status {
    min-height: 24px;
    margin: 12px 0 0;
    color: var(--portal-muted);
    font-size: .85rem;
    font-weight: 650;
}

.tim-portal-signature__status.is-success {
    color: var(--portal-success);
}

.tim-portal-signature__status.is-error {
    color: var(--portal-danger);
}

.tim-portal-loader {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(1, 35, 68, .4);
}

.tim-portal-loader.is-active {
    display: flex;
}

.tim-portal-loader__panel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    color: var(--portal-ink);
    background: #fff;
    border-radius: 9px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, .18);
    font-weight: 700;
}

/* Standalone report-photo viewer. The route shares the secure-link shell, while these
   selectors remain page-scoped so report, approval and self-certification portals do not move. */
.tim-portal-photo .tim-portal-main--photo {
    width: min(1080px, calc(100% - 40px));
}

.tim-portal-photo .tim-photo-card {
    padding: clamp(22px, 3.5vw, 36px);
}

.tim-portal-photo .tim-photo-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 24px;
}

.tim-portal-photo .tim-photo-card__header > div {
    min-width: 0;
}

.tim-portal-photo .tim-photo-card__header .tim-portal-title {
    font-size: clamp(1.45rem, 3vw, 2rem);
}

.tim-portal-photo .tim-photo-download {
    flex: 0 0 auto;
}

.tim-portal-photo .tim-photo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 30px;
    margin: 0 0 18px;
    padding: 14px 16px;
    color: var(--portal-muted);
    background: #f8fafc;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
}

.tim-portal-photo .tim-photo-meta > div {
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
}

.tim-portal-photo .tim-photo-meta dt,
.tim-portal-photo .tim-photo-meta dd {
    margin: 0;
}

.tim-portal-photo .tim-photo-meta dt {
    font-size: .74rem;
    font-weight: 760;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.tim-portal-photo .tim-photo-meta dd {
    color: var(--portal-ink);
    font-size: .875rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.tim-portal-photo .tim-photo-frame {
    min-height: 280px;
    display: grid;
    place-items: center;
    margin: 0;
    padding: clamp(10px, 2vw, 20px);
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid var(--portal-border);
    border-radius: 9px;
}

.tim-portal-photo .tim-photo-frame img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: min(72vh, 900px);
    object-fit: contain;
    border-radius: 6px;
}

.tim-portal-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #b8cee3;
    border-top-color: var(--portal-blue);
    border-radius: 50%;
    animation: tim-portal-spin .75s linear infinite;
}

@keyframes tim-portal-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
    .tim-portal-header__inner,
    .tim-portal-footer__inner,
    .tim-portal-main,
    .tim-portal-main--narrow {
        width: min(100% - 28px, 1180px);
    }

    .tim-portal-header__inner {
        min-height: 64px;
    }

    .tim-portal-brand__logo {
        width: 128px;
        height: 42px;
    }

    .tim-portal-brand__context,
    .tim-portal-security span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .tim-portal-main {
        padding: 26px 0 38px;
    }

    .tim-portal-photo .tim-portal-main--photo {
        width: min(100% - 28px, 1080px);
    }

    .tim-portal-photo .tim-photo-card__header {
        flex-direction: column;
        gap: 18px;
    }

    .tim-portal-photo .tim-photo-download {
        width: 100%;
    }

    .tim-portal-photo .tim-photo-frame {
        min-height: 180px;
    }

    .tim-portal-footer__inner {
        min-height: 76px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 4px;
    }

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

    .tim-portal-summary__item,
    .tim-portal-summary__item:nth-child(odd),
    .tim-portal-summary__item:nth-child(even) {
        padding: 14px 0;
        border-left: 0;
        border-bottom: 1px solid var(--portal-border);
    }

    .tim-portal-summary__item:nth-last-child(2) {
        border-bottom: 1px solid var(--portal-border);
    }

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

    .tim-portal-signature__actions {
        justify-content: stretch;
    }

    .tim-portal-signature__actions .tim-portal-btn {
        flex: 1 1 170px;
    }

    .tim-portal-actions .tim-portal-btn,
    .tim-portal-actions a.tim-portal-btn {
        width: 100%;
    }

    .tim-portal-btn,
    .tim-portal a.tim-portal-btn,
    .tim-portal button,
    .tim-portal input:not([type="hidden"]),
    .tim-portal select,
    .tim-portal textarea {
        min-height: 44px;
    }

    /* The landlord sign-off is framed inside the report card. On a phone a second frame's
       padding would squeeze the signature pad below a signable width, so it keeps only a
       divider above it and gives the pad the card's full content width. */
    .tim-portal-card .tim-portal-signoff {
        padding: 20px 0 0;
        border-width: 1px 0 0;
        border-radius: 0;
    }

    .tim-portal .tim-portal-report .table.tim-portal-table--stack thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .tim-portal .tim-portal-report .table.tim-portal-table--stack tbody,
    .tim-portal .tim-portal-report .table.tim-portal-table--stack tr,
    .tim-portal .tim-portal-report .table.tim-portal-table--stack td[data-th] {
        display: block !important;
        width: 100% !important;
    }

    .tim-portal .tim-portal-report .table.tim-portal-table--stack tr {
        margin-bottom: 12px;
        padding: 8px 0;
        border: 1px solid var(--portal-border);
        border-radius: 8px;
    }

    .tim-portal .tim-portal-report .table.tim-portal-table--stack td[data-th] {
        padding: 10px 12px;
        border: 0;
    }

    .tim-portal .tim-portal-report .table.tim-portal-table--stack td[data-th]::before {
        content: attr(data-th);
        display: block;
        float: none;
        margin-bottom: 4px;
        color: var(--portal-muted);
        font-size: .7rem;
        font-weight: 760;
        letter-spacing: .035em;
        text-transform: uppercase;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tim-portal *,
    .tim-portal *::before,
    .tim-portal *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    .tim-portal-header,
    .tim-portal-footer,
    .tim-portal-skip,
    .tim-portal-loader,
    .tim-portal-signature__actions,
    .tim-portal-actions {
        display: none !important;
    }

    .tim-portal,
    .tim-portal-main {
        width: 100%;
        padding: 0;
        background: #fff;
    }

    .tim-portal-card,
    .tim-portal .tim-portal-report .card {
        box-shadow: none;
    }
}

/* ---------------------------------------------------------------------------
   Tenant review: report body refresh. Flat cards and tables, one filled action
   (Sign and submit), outlined row actions, sentence-case headings, and stacked
   rows on phones instead of the old width hacks.
   ------------------------------------------------------------------------- */
.tim-portal-card,
.tim-portal .tim-portal-report .card {
    box-shadow: none;
}

.tim-portal-report > .row > .col-sm-12 > h4.header-title,
.tim-portal-report > .row > .col-sm-12 > h4.mt-0.header-title {
    margin: 10px 0 12px !important;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.tim-portal .tim-portal-report .card-header {
    padding: 14px 20px;
    background: transparent;
    border-bottom: 1px solid var(--portal-border);
}

.tim-portal .tim-portal-report .card-header h4.header-title {
    margin: 0;
    color: var(--portal-ink);
    font-size: 1rem;
    font-weight: 600;
}

.tim-portal .tim-portal-report .table {
    border: 0;
}

.tim-portal .tim-portal-report .table th,
.tim-portal .tim-portal-report .table td {
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--portal-border);
    background: transparent;
    vertical-align: top;
}

.tim-portal .tim-portal-report .table thead th {
    padding-top: 4px;
    color: var(--portal-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tim-portal .tim-portal-report .table tbody tr:last-child th,
.tim-portal .tim-portal-report .table tbody tr:last-child td,
.tim-portal .tim-portal-report .table.tim-portal-table--plain td {
    border-bottom: 0;
}

.tim-portal .tim-portal-report .table.tim-portal-table--plain td {
    padding-right: 0;
    padding-left: 0;
}

.tim-portal .tim-portal-report .tim-portal-table--kv th {
    width: 300px;
    color: var(--portal-muted);
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.tim-portal .tim-portal-report .tim-portal-col-comments {
    width: 200px;
}

.tim-portal .tim-portal-report .tim-portal-col-condition {
    width: 260px;
}

.tim-portal .tim-portal-report .tim-portal-item-title {
    color: var(--portal-ink);
    font-weight: 600;
}

.tim-portal .tim-portal-report .tim-portal-item-subtext {
    display: block;
    margin-top: 2px;
    color: var(--portal-muted);
    font-size: .875rem;
    font-weight: 400;
}

.tim-portal .tim-portal-report td .bold {
    color: var(--portal-muted);
    font-weight: 600;
}

.tim-portal .tim-portal-report .tim-portal-item-title .bold {
    color: var(--portal-ink);
}

.tim-portal .tim-portal-report tr.tim-portal-group-start td {
    border-top: 2px solid var(--portal-border);
}

.tim-portal .tim-portal-report tbody tr:first-child.tim-portal-group-start td {
    border-top: 0;
}

.tim-portal-subheading {
    margin: 20px 0 8px;
    color: var(--portal-ink);
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.3;
}

.tim-portal-subheading:first-child {
    margin-top: 0;
}

.tim-portal-subheading--minor {
    margin-top: 12px;
    color: var(--portal-muted);
    font-size: .8125rem;
}

.tim-portal-prose .tim-portal-prose__title {
    margin: 18px 0 4px;
    color: var(--portal-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.tim-portal-prose .tim-portal-prose__title:first-child {
    margin-top: 0;
}

.tim-portal-prose .tim-portal-prose__subtitle {
    margin: 0 0 6px;
    color: var(--portal-ink);
    font-size: 1rem;
    font-weight: 600;
}

.tim-portal-prose p {
    margin: 0 0 12px;
    line-height: 1.55;
}

.tim-portal-prose p:last-child {
    margin-bottom: 0;
}

.tim-portal-help--lead {
    margin: 0 0 14px;
    font-size: .875rem;
}

.tim-portal .tim-portal-report .tim-portal-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

/* Report photos (#320): one grid per item, general notes, key or Inspection answer, so a row
   holds as many thumbnails as its cell fits, up to 4: 4 in a desktop item cell, 2 on a 390px
   phone and 2 in an Inspection answer's fixed 300px Item column. Each thumbnail is a square of the
   column's width, never narrower than the 96px phone thumbnail.

   The wrapper caps the grid at four of those. Without a cap a table cell's preferred width
   follows the photos' natural size, so a phone photo (4032px) widened its column and squeezed the
   neighbours to almost nothing. The cap sits on a wrapper, not on the grid: a definite max-width
   on an auto-fill grid makes its intrinsic minimum four tracks (408px), which pushed phone cells
   past a 390px screen. The wrapper leaves the grid's minimum at one 96px track.

   The grid's gap spaces the thumbnails, so the link's standalone margin is dropped here. */
.tim-portal .tim-portal-report .tim-portal-thumbs {
    max-width: calc(4 * 96px + 3 * 8px);
    margin-top: 8px;
}

.tim-portal .tim-portal-report .tim-portal-thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}

.tim-portal .tim-portal-report .tim-portal-thumb-grid .tim-portal-thumb-link {
    display: block;
    margin: 0;
}

.tim-portal .tim-portal-report .tim-portal-thumb-grid .tim-portal-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
}

.tim-portal .tim-portal-report .tim-portal-thumb-link {
    display: inline-block;
    margin: 8px 8px 0 0;
    color: var(--portal-ink);
    text-decoration: none;
    vertical-align: top;
}

.tim-portal .tim-portal-report .tim-portal-thumb-link .img-responsive {
    display: block;
}

.tim-portal .tim-portal-report .tim-portal-thumb {
    display: block;
    width: 120px;
    height: 120px;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    background: #fff;
    object-fit: cover;
}

.tim-portal .tim-portal-report .tim-portal-thumb-link:focus-visible .tim-portal-thumb {
    border-color: var(--portal-blue);
    outline: 3px solid var(--portal-blue-soft);
}

.tim-portal .tim-portal-report .tim-portal-thumb-caption {
    display: block;
    max-width: 120px;
    margin-top: 4px;
    color: var(--portal-muted);
    font-size: .75rem;
    line-height: 1.3;
}

.tim-portal-btn--compact {
    min-height: 36px;
    padding: 0 12px;
    font-size: .875rem;
}

.tim-portal .tim-portal-report .tim-portal-comment-action {
    margin-bottom: 8px;
}

.tim-portal .tim-portal-report .tim-portal-comment-action--end {
    display: flex;
    justify-content: flex-end;
    margin: 12px 0 0;
}

.tim-portal .tim-portal-report td .card {
    margin: 0 !important;
    padding: 10px 12px;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    background: #f8fafc;
    box-shadow: none;
}

.tim-portal .tim-portal-report td .card .card-body {
    padding: 0;
}

.tim-portal .tim-portal-report td .card p {
    margin: 0 0 6px;
    color: var(--portal-ink);
    font-size: .875rem;
}

.tim-portal .tim-portal-report td .card img.rounded {
    width: 96px !important;
    height: 96px !important;
    margin: 4px 6px 0 0 !important;
    border: 1px solid var(--portal-border);
    border-radius: 8px !important;
    object-fit: cover !important;
}

.tim-portal .tim-portal-report textarea.form-control {
    min-height: 120px;
    padding: 10px 12px;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
}

.tim-portal .tim-portal-report textarea.form-control:focus {
    border-color: var(--portal-blue);
    box-shadow: 0 0 0 3px var(--portal-blue-soft);
}

.tim-portal .tim-portal-report label[for="txtAdditionalComment"] {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

@media (max-width: 767px) {
    .tim-portal .tim-portal-report .tim-portal-table--kv tr {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid var(--portal-border);
    }

    .tim-portal .tim-portal-report .tim-portal-table--kv tr:last-child {
        border-bottom: 0;
    }

    .tim-portal .tim-portal-report .tim-portal-table--kv th,
    .tim-portal .tim-portal-report .tim-portal-table--kv td {
        display: block;
        width: 100% !important;
        padding: 2px 0;
        border: 0;
    }

    .tim-portal .tim-portal-report .tim-portal-table--kv th {
        font-size: .75rem;
        letter-spacing: .035em;
        text-transform: uppercase;
    }

    .tim-portal .tim-portal-report .tim-portal-col-comments,
    .tim-portal .tim-portal-report .tim-portal-col-condition {
        width: auto;
    }

    .tim-portal .tim-portal-report .tim-portal-thumb {
        width: 96px;
        height: 96px;
    }

    .tim-portal .tim-portal-report .tim-portal-comment-action .tim-portal-btn {
        width: 100%;
    }
}

/* Public workflows retain their simpler reading flow and share the form rhythm. */
.tim-portal .form-control {
    font-size: 15px;
    border-radius: 8px;
}
.tim-portal .form-control:focus,
.tim-portal .tim-portal-report textarea.form-control:focus {
    border-color: var(--portal-blue);
    outline: 3px solid var(--portal-blue-soft) !important;
    outline-offset: 0;
    box-shadow: none;
}
.tim-portal .form-control[aria-invalid="true"]:focus {
    outline-color: var(--portal-danger-soft) !important;
    box-shadow: none !important;
}
.tim-portal .form-control:is(:disabled, [readonly]) {
    color: var(--portal-muted);
    background: var(--portal-ground);
    opacity: 1;
}
.tim-portal .tim-portal-dialog .modal-header { padding: 20px 24px; }
.tim-portal .tim-portal-dialog .modal-body { padding: 24px; }
.tim-portal .tim-portal-dialog .modal-title {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.tim-portal .tim-portal-dialog .modal-header .close {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
}
.tim-portal .tim-portal-dialog .modal-body label:not(.tim-portal-file-label) {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
}
.tim-portal .tim-portal-dialog .modal-content > .modal-footer {
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 16px 24px;
    border-top: 1px solid var(--portal-border);
    background: var(--portal-ground);
}
.tim-portal .tim-portal-dialog .modal-footer .tim-portal-btn { margin: 0; }
.tim-portal .tim-portal-photo-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 16px;
}
.tim-portal .tim-portal-photo-controls .tim-portal-file-label { margin: 0; }
.tim-portal-summary__item dd,
.tim-portal-signature__heading,
.tim-portal-field > label { overflow-wrap: anywhere; }
@media (max-width: 600px) {
    .tim-portal .tim-portal-dialog .modal-header,
    .tim-portal .tim-portal-dialog .modal-body,
    .tim-portal .tim-portal-dialog .modal-content > .modal-footer { padding: 16px; }
    .tim-portal .form-control { font-size: 16px; }
}
