:root {
    --green: #004525;
    --green-2: #0b6b42;
    --green-soft: #eaf4ef;
    --red: #c62828;
    --red-soft: #fff0f0;
    --yellow: #f2c94c;
    --ink: #1d2420;
    --muted: #66736c;
    --line: #d8dfdb;
    --paper: #ffffff;
    --bg: #f2f5f3;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

body {
    -webkit-tap-highlight-color: transparent;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 86px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 22px;
    background: var(--green);
    box-shadow: 0 2px 12px rgba(0,0,0,.14);
}

.logo {
    width: 116px;
    height: 64px;
    object-fit: contain;
    display: block;
}

.brand-link { display: block; }

.header-text {
    color: white;
    line-height: 1.15;
}

.company-name {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .02em;
}

.app-name {
    margin-top: 4px;
    font-size: 15px;
    font-weight: 700;
    opacity: .86;
    letter-spacing: .08em;
}

.page {
    width: min(1050px, 100%);
    margin: 0 auto;
    padding: 28px 22px 52px;
}

.home-panel {
    max-width: 900px;
    margin: 46px auto;
    text-align: center;
}

.home-panel h1 {
    font-size: clamp(34px, 6vw, 54px);
    margin: 0;
}

.subtitle {
    color: var(--muted);
    font-size: 20px;
    margin: 10px 0 32px;
}

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

.home-button {
    min-height: 220px;
    border: 0;
    border-radius: 22px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-decoration: none;
    font-size: clamp(24px, 4vw, 34px);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0,0,0,.10);
}

.home-button.emergency {
    background: white;
    color: #424c47;
    border: 2px solid var(--line);
    opacity: 1;
}

.home-button.defect {
    background: white;
    color: #424c47;
    border: 2px solid var(--line);
    opacity: 1;
}

.home-button.job-list {
    background: white;
    color: #424c47;
    border: 2px solid var(--line);
    opacity: 1;
}

.button-icon {
    font-size: 52px;
    line-height: 1;
}

.page-heading {
    margin-bottom: 24px;
}

.page-heading h1 {
    font-size: clamp(30px, 5vw, 44px);
    margin: 10px 0 4px;
}

.page-heading p {
    margin: 0;
    font-size: 18px;
    color: var(--muted);
}

.back-link {
    color: var(--green-2);
    font-weight: 800;
    text-decoration: none;
    font-size: 17px;
}

.machine-section {
    margin: 28px 0 36px;
}

.machine-section h2 {
    font-size: 22px;
    margin-bottom: 14px;
}

.machine-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.machine-card {
    min-height: 116px;
    padding: 20px;
    border-radius: 16px;
    background: white;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: var(--ink);
    box-shadow: 0 5px 16px rgba(0,0,0,.05);
}

.machine-card strong {
    font-size: 21px;
}

.machine-card span {
    color: var(--muted);
}

.bottom-actions {
    margin-top: 28px;
    text-align: center;
}

.secondary-button, .small-button {
    border: 1px solid #b8c3bd;
    background: white;
    color: var(--ink);
    border-radius: 10px;
    padding: 12px 18px;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
}

.warning-box {
    margin: 18px 0 24px;
    padding: 18px 20px;
    border: 2px solid var(--red);
    border-radius: 12px;
    background: var(--red-soft);
    color: #871b1b;
    font-weight: 900;
    text-align: center;
    line-height: 1.35;
}

.error-box {
    margin: 16px 0;
    padding: 14px 18px;
    background: #fff4df;
    border: 1px solid #e0a321;
    border-radius: 10px;
    font-weight: 700;
}

.auto-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.auto-info div {
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 15px 18px;
}

.auto-info span {
    display: block;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 3px;
}

.auto-info strong {
    font-size: 20px;
}

.check-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stop-card {
    position: relative;
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 14px;
    background: white;
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 4px 14px rgba(0,0,0,.045);
}

.stop-card.failed-stop {
    border-color: #e08888;
    background: #fffafa;
}

.stop-card.attention-stop {
    border-color: #e0a321;
}

.stop-number {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--green);
    color: white;
    font-size: 20px;
    font-weight: 900;
}

.stop-content h3 {
    margin: 6px 0 16px;
    font-size: 21px;
}

.result-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.result-choice {
    position: relative;
}

.result-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.result-choice span {
    min-height: 58px;
    border: 2px solid var(--line);
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    user-select: none;
}

.working-choice input:checked + span {
    background: #dff4e8;
    border-color: #1f8a53;
    color: #126038;
}

.failed-choice input:checked + span {
    background: #ffe4e4;
    border-color: var(--red);
    color: #971f1f;
}

.field-label {
    display: block;
    margin: 10px 0 7px;
    font-size: 15px;
    font-weight: 800;
}

textarea, .text-input, select {
    width: 100%;
    border: 1px solid #b9c4be;
    border-radius: 10px;
    padding: 13px 14px;
    background: white;
    font: inherit;
    font-size: 17px;
}

textarea {
    resize: vertical;
    min-height: 70px;
}

.field-error {
    border: 2px solid var(--red);
    background: var(--red-soft);
}

.signoff-card {
    margin-top: 8px;
    background: white;
    border-radius: 16px;
    padding: 22px;
    border: 1px solid var(--line);
}

.signoff-card h2 {
    margin-top: 0;
}

.signature-wrap {
    border: 2px solid #aeb9b3;
    border-radius: 12px;
    background: white;
    overflow: hidden;
}

#signatureCanvas {
    display: block;
    width: 100%;
    height: 190px;
    background: white;
    touch-action: none;
}

.signature-actions {
    margin-top: 10px;
}

.submit-button {
    width: 100%;
    min-height: 68px;
    margin-top: 8px;
    border: 0;
    border-radius: 14px;
    background: var(--green);
    color: white;
    font-size: 23px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0,69,37,.18);
}

.submit-button:disabled {
    opacity: .7;
    cursor: default;
}

.link-button {
    display: grid;
    place-items: center;
    text-decoration: none;
    max-width: 480px;
    margin: 24px auto 0;
}

.complete-panel {
    max-width: 760px;
    margin: 40px auto;
    text-align: center;
    background: white;
    border-radius: 20px;
    padding: 36px;
    border: 1px solid var(--line);
}

.complete-icon {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 18px;
    font-size: 50px;
    font-weight: 900;
}

.complete-pass .complete-icon {
    background: #dff4e8;
    color: #116a3b;
}

.complete-fail .complete-icon {
    background: #ffe1e1;
    color: var(--red);
}

.complete-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 20px;
    color: var(--muted);
}

.complete-details strong {
    color: var(--ink);
    font-size: 21px;
}

.history-filter {
    margin-bottom: 16px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-row {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    text-decoration: none;
    color: var(--ink);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.history-row > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.history-row span {
    color: var(--muted);
}

.history-right {
    align-items: flex-end;
}

.status-pill {
    display: inline-block;
    width: fit-content;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 900;
}

.status-pass {
    background: #dff4e8;
    color: #116a3b !important;
}

.status-fail {
    background: #ffe1e1;
    color: #a01f1f !important;
}

.empty-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
    color: var(--muted);
}

.detail-summary {
    margin-bottom: 16px;
}

.detail-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-item {
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.failed-detail {
    border-color: #e5a0a0;
    background: #fffafa;
}

.detail-item p {
    margin: 8px 0 0;
    color: var(--muted);
}

@media (max-width: 780px) {
    .topbar {
        min-height: 74px;
        padding: 8px 14px;
    }

    .logo {
        width: 92px;
        height: 54px;
    }

    .company-name {
        font-size: 15px;
    }

    .app-name {
        font-size: 12px;
    }

    .page {
        padding: 20px 14px 44px;
    }

    .home-grid,
    .machine-grid {
        grid-template-columns: 1fr;
    }

    .home-button {
        min-height: 150px;
    }

    .machine-card {
        min-height: 92px;
    }

    .stop-card {
        grid-template-columns: 42px 1fr;
        padding: 14px;
        gap: 10px;
    }

    .stop-number {
        width: 36px;
        height: 36px;
        font-size: 17px;
    }

    .result-choice span {
        min-height: 62px;
    }

    .history-row {
        flex-direction: column;
    }

    .history-right {
        align-items: flex-start;
    }
}


.machine-card.machine-current { border-left: 7px solid #1f8a53; }
.machine-card.machine-due { border-left: 7px solid #c62828; }

.last-checked { margin-top: 5px; font-size: 15px; font-weight: 900; }
.last-current { color: #126038 !important; }
.last-due { color: #a01f1f !important; }

.history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 14px 0;
    padding: 12px 14px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.select-all-label { display: flex; align-items: center; gap: 9px; font-weight: 800; }
.select-all-label input, .history-checkbox input { width: 22px; height: 22px; }
.print-selected-button { cursor: pointer; }

.history-select-row {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 8px;
    align-items: stretch;
}

.history-checkbox {
    display: grid;
    place-items: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
}

.history-row-with-checkbox { width: 100%; }

.signature-view-card {
    margin-top: 22px;
    padding: 20px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.signature-view-card h2 { margin-top: 0; }

.signature-image-wrap {
    background: white;
    border: 1px solid #b9c4be;
    border-radius: 10px;
    padding: 10px;
    overflow: hidden;
}

.signature-image-wrap img {
    display: block;
    width: 100%;
    max-width: 620px;
    height: 180px;
    object-fit: contain;
    object-position: left center;
    background: white;
}

.single-print-form { margin-top: 16px; }
.single-print-form button { cursor: pointer; }

@media (max-width: 780px) {
    .history-toolbar { align-items: stretch; flex-direction: column; }
    .history-select-row { grid-template-columns: 42px 1fr; }
}


@media (max-width: 1050px) and (min-width: 781px) {
    .home-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 14px;
    }

    .home-button {
        min-height: 185px;
        padding: 20px 12px;
        font-size: clamp(21px, 3vw, 28px);
    }
}


.last-updated {
    display: block;
    margin-top: 10px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    opacity: 0.78;
}


.home-button.emergency-alert {
    background: #fff0f0;
    border: 3px solid #b32020;
    color: #8f1818;
    box-shadow: 0 0 0 4px rgba(179, 32, 32, 0.08);
}

.home-alert-text {
    display: block;
    margin-top: 10px;
    font-size: 15px;
    font-weight: 900;
    line-height: 1.25;
}

.failure-alert-banner {
    margin: 0 0 22px;
    padding: 16px 18px;
    border: 2px solid #b32020;
    border-radius: 12px;
    background: #fff0f0;
    color: #821717;
    font-size: 17px;
}

.machine-card.machine-failed {
    border: 3px solid #b32020;
    border-left-width: 9px;
    background: #fff0f0;
    color: #801717;
    box-shadow: 0 3px 12px rgba(179, 32, 32, 0.12);
}

.failure-action-text {
    margin-top: 6px;
    font-size: 16px;
    font-weight: 900;
    color: #a01f1f !important;
}

.last-failed {
    color: #8b1b1b !important;
}

.history-outstanding {
    border: 2px solid #b32020 !important;
    background: #fff4f4 !important;
}

.history-small {
    font-size: 12px;
    color: var(--muted);
}

.outstanding-failure-box {
    margin-bottom: 18px;
    padding: 18px;
    border: 3px solid #b32020;
    border-radius: 14px;
    background: #fff0f0;
    color: #821717;
}

.rectified-box {
    margin-bottom: 18px;
    padding: 18px;
    border: 3px solid #198754;
    border-radius: 14px;
    background: #effaf4;
    color: #155f3c;
}

.rectification-form-card {
    margin-top: 22px;
    padding: 20px;
    background: white;
    border: 2px solid #b32020;
    border-radius: 14px;
}

.rectification-form-card form {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.rectification-form-card label {
    display: grid;
    gap: 7px;
    font-weight: 800;
}

.rectification-form-card input,
.rectification-form-card textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #aeb9b3;
    border-radius: 9px;
    font: inherit;
    background: white;
}

.rectify-button {
    border: 0;
    border-radius: 10px;
    padding: 14px 18px;
    background: #198754;
    color: white;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
}

.recheck-button {
    display: inline-block;
    margin-top: 14px;
}

.form-error {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 9px;
    background: #ffe1e1;
    color: #8b1717;
    font-weight: 800;
}


.working-status-text {
    margin-top: 6px;
    font-size: 16px;
    font-weight: 900;
    color: #198754 !important;
}

.rectified-detail {
    border-left: 7px solid #198754 !important;
    background: #effaf4 !important;
}


.detail-item-main {
    flex: 1;
    min-width: 0;
}

.has-rectify-form {
    align-items: flex-start;
}

.inline-rectify-form {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #edc1c1;
}

.inline-rectify-grid {
    display: grid;
    grid-template-columns: minmax(180px, .7fr) minmax(260px, 1.3fr);
    gap: 12px;
    margin-bottom: 12px;
}

.inline-rectify-form label {
    display: grid;
    gap: 6px;
    font-weight: 800;
}

.inline-rectify-form input,
.inline-rectify-form textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #b9c4be;
    border-radius: 9px;
    font: inherit;
    background: white;
}

.inline-rectify-form .rectify-button {
    width: 100%;
}

.rectified-meta {
    font-size: 13px;
    color: #47725c !important;
}

.recheck-panel {
    margin-top: 20px;
    padding: 16px 18px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.recheck-panel p {
    margin: 0 0 14px;
    color: var(--muted);
}

@media (max-width: 780px) {
    .inline-rectify-grid {
        grid-template-columns: 1fr;
    }

    .has-rectify-form {
        flex-direction: column;
    }
}


.rectification-signature-field {
    margin-top: 4px;
}

.rectification-signature-field > label {
    margin-bottom: 7px;
}

.signature-help {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.rectification-signature-canvas {
    display: block;
    width: 100%;
    height: 150px;
    border: 2px solid #aeb9b3;
    border-radius: 10px;
    background: white;
    touch-action: none;
    cursor: crosshair;
}

.clear-rectification-signature {
    margin-top: 8px;
    border: 1px solid #aeb9b3;
    border-radius: 8px;
    padding: 8px 12px;
    background: white;
    color: #424c47;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.rectification-signature-display {
    margin-top: 10px;
    max-width: 430px;
}

.rectification-signature-display span {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 800;
    color: #47725c;
}

.rectification-signature-display img {
    display: block;
    width: 100%;
    max-width: 360px;
    height: 95px;
    object-fit: contain;
    object-position: left center;
    border: 1px solid #b9c4be;
    border-radius: 8px;
    background: white;
}


.rectification-signature-canvas {
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: contain;
}


.external-login-body {
    min-height: 100vh;
    margin: 0;
    background: #eef2ef;
}

.external-login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.external-login-card {
    width: min(100%, 430px);
    padding: 30px;
    border: 1px solid #d0dad4;
    border-radius: 18px;
    background: white;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.10);
    text-align: center;
}

.external-login-logo {
    display: block;
    width: min(100%, 250px);
    max-height: 85px;
    object-fit: contain;
    margin: 0 auto 18px;
}

.external-login-card h1 {
    margin: 0;
    font-size: 30px;
    color: #18382a;
}

.external-login-subtitle {
    margin: 5px 0 22px;
    color: #66736d;
    font-size: 16px;
    font-weight: 700;
}

.external-login-form {
    display: grid;
    gap: 10px;
    text-align: left;
}

.external-login-form label {
    font-weight: 800;
    color: #263d32;
}

.external-login-form input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 15px;
    border: 2px solid #b8c5be;
    border-radius: 10px;
    background: white;
    font: inherit;
    font-size: 24px;
    letter-spacing: 5px;
    text-align: center;
}

.external-login-form input:focus {
    outline: 3px solid rgba(23, 111, 67, 0.14);
    border-color: #176f43;
}

.external-login-form button {
    margin-top: 5px;
    padding: 14px 18px;
    border: 0;
    border-radius: 10px;
    background: #176f43;
    color: white;
    font: inherit;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
}

.external-login-error {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #d99090;
    border-radius: 9px;
    background: #fff0f0;
    color: #8a1f1f;
    font-weight: 700;
    text-align: left;
}

.external-login-note {
    margin: 18px 0 0;
    color: #68756f;
    font-size: 13px;
    line-height: 1.45;
}


.local-admin-links {
    margin-top: 22px;
    text-align: center;
}

.local-admin-links a {
    display: inline-block;
    padding: 10px 15px;
    border: 1px solid #b7c3bc;
    border-radius: 9px;
    background: white;
    color: #315142;
    font-weight: 800;
    text-decoration: none;
}

.session-admin-actions {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 16px;
}

.kick-all-button,
.kick-session-button {
    border: 0;
    border-radius: 9px;
    padding: 11px 16px;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.kick-all-button {
    background: #7e1d1d;
    color: white;
}

.kick-session-button {
    background: #a32323;
    color: white;
    white-space: nowrap;
}

.session-list {
    display: grid;
    gap: 14px;
}

.session-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid #cbd5cf;
    border-radius: 13px;
    background: white;
}

.session-active {
    border-left: 7px solid #198754;
}

.session-ended {
    opacity: 0.75;
}

.session-card-main {
    flex: 1;
    min-width: 0;
}

.session-heading-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.session-heading-row h2 {
    margin: 0;
    color: #203a2e;
}

.session-status {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.session-status-active {
    background: #e5f6ec;
    color: #14653d;
}

.session-status-ended {
    background: #ecefed;
    color: #5c6661;
}

.session-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 18px;
    margin: 14px 0 0;
}

.session-details div {
    min-width: 0;
}

.session-details dt {
    font-size: 12px;
    font-weight: 900;
    color: #68756f;
    text-transform: uppercase;
}

.session-details dd {
    margin: 3px 0 0;
    color: #24382f;
    overflow-wrap: anywhere;
}

@media (max-width: 780px) {
    .session-card {
        align-items: stretch;
        flex-direction: column;
    }

    .session-details {
        grid-template-columns: 1fr 1fr;
    }

    .kick-session-button {
        width: 100%;
    }
}


.session-device-friendly {
    margin-top: 5px;
    color: #5f6f67;
    font-weight: 700;
}


.admin-logout-link {
    display: inline-flex;
    align-items: center;
    margin-right: auto;
    padding: 10px 14px;
    border: 1px solid #b7c3bc;
    border-radius: 9px;
    background: white;
    color: #315142;
    font-weight: 800;
    text-decoration: none;
}


/* V24 Defect Log */

.home-button.defect {
    text-decoration: none;
}

.home-button.defect-alert {
    border-color: #cf3939;
    background: #fff4f4;
    color: #8b1e1e;
}

.defect-home-count {
    font-size: 15px;
    font-weight: 900;
    letter-spacing: .04em;
    color: #51605a;
}

.defect-heading-row,
.defect-detail-title-row,
.defect-section-toolbar,
.completed-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.primary-action-button,
.defect-submit-button,
.complete-defect-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 14px 20px;
    background: var(--green);
    color: white;
    text-decoration: none;
    font: inherit;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(0, 69, 37, .16);
}

.defect-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 26px;
}

.defect-summary-card {
    min-height: 92px;
    padding: 15px 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0,0,0,.035);
}

.defect-summary-card span {
    color: var(--muted);
    font-weight: 800;
}

.defect-summary-card strong {
    font-size: 34px;
}

.summary-high {
    border-left: 6px solid #c62828;
}

.summary-medium {
    border-left: 6px solid #d38a00;
}

.summary-low {
    border-left: 6px solid #358156;
}

.defect-section-toolbar {
    margin: 8px 0 14px;
}

.defect-section-toolbar h2 {
    margin: 0;
}

.defect-list,
.completed-defect-list {
    display: grid;
    gap: 13px;
}

.defect-card {
    min-height: 150px;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    border: 1px solid var(--line);
    border-left-width: 7px;
    border-radius: 16px;
    background: white;
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 5px 16px rgba(0,0,0,.05);
}

.defect-card.priority-high {
    border-left-color: #c62828;
}

.defect-card.priority-medium {
    border-left-color: #d38a00;
}

.defect-card.priority-low {
    border-left-color: #358156;
}

.defect-card-image-wrap {
    width: 180px;
    min-height: 150px;
    flex: 0 0 180px;
    background: #e8ece9;
}

.defect-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.defect-card-content {
    flex: 1;
    min-width: 0;
    padding: 18px 20px;
}

.defect-card-topline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.priority-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .04em;
}

.priority-pill.priority-high {
    background: #fde4e4;
    color: #9b1717;
}

.priority-pill.priority-medium {
    background: #fff1d2;
    color: #885600;
}

.priority-pill.priority-low {
    background: #e3f3e9;
    color: #276b45;
}

.defect-record-id {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.defect-card h3 {
    margin: 10px 0 5px;
    font-size: 22px;
}

.defect-card p {
    margin: 0;
    color: #48564f;
    font-size: 17px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.defect-card-footer {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.defect-card-arrow {
    align-self: center;
    padding: 18px;
    font-size: 38px;
    color: #809089;
}

.defect-empty-state {
    padding: 50px 24px;
    border: 2px dashed #cfd7d3;
    border-radius: 18px;
    background: white;
    text-align: center;
}

.defect-empty-state h2 {
    margin: 8px 0 5px;
}

.defect-empty-state p {
    margin: 0 0 22px;
    color: var(--muted);
}

.defect-empty-icon {
    font-size: 44px;
    color: #2f8555;
}

.defect-form {
    display: grid;
    gap: 16px;
}

.defect-form-card,
.defect-detail-card,
.defect-complete-panel,
.defect-completed-card {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: white;
    box-shadow: 0 5px 16px rgba(0,0,0,.045);
}

.form-field {
    margin-bottom: 20px;
}

.form-field:last-child {
    margin-bottom: 0;
}

.form-field > label:first-child,
.defect-section-label {
    display: block;
    margin-bottom: 7px;
    color: #33423b;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .02em;
}

.form-field input[type="text"],
.form-field select,
.form-field textarea {
    width: 100%;
    border: 2px solid #c7d0cb;
    border-radius: 11px;
    padding: 13px 14px;
    background: white;
    color: var(--ink);
    font: inherit;
    font-size: 17px;
}

.form-field textarea {
    resize: vertical;
}

.form-field input[type="text"]:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: 3px solid rgba(11, 107, 66, .12);
    border-color: var(--green-2);
}

.optional-label {
    color: var(--muted);
    font-weight: 600;
}

.priority-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.priority-choice {
    position: relative;
}

.priority-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.priority-choice span {
    min-height: 58px;
    display: grid;
    place-items: center;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: white;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
}

.priority-choice-low input:checked + span {
    border-color: #358156;
    background: #e3f3e9;
    color: #276b45;
}

.priority-choice-medium input:checked + span {
    border-color: #d38a00;
    background: #fff1d2;
    color: #885600;
}

.priority-choice-high input:checked + span {
    border-color: #c62828;
    background: #fde4e4;
    color: #9b1717;
}

.camera-upload-button {
    min-height: 86px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 !important;
    border: 2px dashed #8ca99a;
    border-radius: 14px;
    background: #f5faf7;
    color: var(--green);
    font-size: 17px !important;
    font-weight: 900 !important;
    cursor: pointer;
}

.camera-icon {
    font-size: 28px;
}

.hidden-photo-input {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
}

.photo-preview-wrap {
    margin-top: 12px;
}

.photo-preview {
    display: block;
    width: min(100%, 520px);
    max-height: 420px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 13px;
    margin-bottom: 10px;
    background: #eef2ef;
}

.defect-submit-button,
.complete-defect-button {
    width: 100%;
    min-height: 58px;
    font-size: 19px;
}

.defect-detail-grid {
    display: grid;
    gap: 18px;
}

.defect-problem-full,
.action-taken-text {
    margin: 4px 0 0;
    font-size: 19px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.defect-photo-section {
    margin-top: 22px;
}

.defect-detail-photo {
    display: block;
    width: min(100%, 700px);
    max-height: 620px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #edf1ef;
}

.defect-complete-panel > h2 {
    margin: 0 0 4px;
}

.defect-complete-panel > p {
    margin: 0 0 22px;
    color: var(--muted);
}

.completed-info-block {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.completed-info-block p {
    white-space: pre-wrap;
}

.completed-by-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.completed-by-grid div {
    padding: 14px 16px;
    border-radius: 11px;
    background: #f2f5f3;
}

.completed-by-grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.completed-by-grid strong {
    font-size: 17px;
}

.defect-signature-card {
    margin-top: 20px;
}

.defect-signature-card h3 {
    margin-top: 0;
}

.completed-defect-row {
    display: grid;
    grid-template-columns: 64px 1fr auto auto;
    align-items: center;
    gap: 15px;
    min-height: 106px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    color: var(--ink);
    text-decoration: none;
    box-shadow: 0 4px 13px rgba(0,0,0,.04);
}

.completed-history-id {
    color: var(--muted);
    font-weight: 900;
}

.completed-history-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.completed-history-main p {
    margin: 5px 0;
    color: #48564f;
}

.completed-history-meta {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.completed-history-thumb {
    width: 82px;
    height: 70px;
    object-fit: cover;
    border-radius: 9px;
    border: 1px solid var(--line);
}

@media (max-width: 760px) {
    .defect-heading-row,
    .defect-detail-title-row,
    .defect-section-toolbar,
    .completed-heading-row {
        align-items: stretch;
        flex-direction: column;
    }

    .defect-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .defect-card {
        min-height: 0;
        flex-wrap: wrap;
    }

    .defect-card-image-wrap {
        width: 100%;
        height: 210px;
        flex: 0 0 100%;
    }

    .defect-card-arrow {
        padding: 10px 18px;
    }

    .priority-choice-grid {
        grid-template-columns: 1fr;
    }

    .completed-by-grid {
        grid-template-columns: 1fr;
    }

    .completed-defect-row {
        grid-template-columns: 52px 1fr auto;
    }

    .completed-history-thumb {
        display: none;
    }

    .primary-action-button {
        width: 100%;
    }
}


/* V25 defect submission confirmation */

.success-message {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 0 0 20px;
    padding: 15px 17px;
    border: 1px solid #93c8a7;
    border-left: 6px solid #2f8555;
    border-radius: 12px;
    background: #edf9f1;
    color: #215c3b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .035);
    opacity: 1;
    transition: opacity .35s ease, transform .35s ease;
}

.success-message-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #2f8555;
    color: white;
    font-size: 20px;
    font-weight: 900;
}

.success-message strong,
.success-message span {
    display: block;
}

.success-message strong {
    margin-bottom: 2px;
    font-size: 16px;
}

.success-message span {
    font-size: 14px;
    color: #4d6b59;
}

.success-message-hide {
    opacity: 0;
    transform: translateY(-4px);
}


/* V26 automatic photo compression */

.photo-compression-status {
    margin-top: 9px;
    padding: 9px 11px;
    border-radius: 9px;
    background: #eef5f1;
    color: #4c6658;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}


/* V28 completed defect history link moved to the bottom */

.defect-history-bottom {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.defect-history-bottom-button {
    min-width: 260px;
    text-align: center;
}


/* V29 compact defect cards */

.defect-card {
    min-height: 112px;
}

.defect-card-image-wrap {
    width: 120px;
    min-height: 112px;
    flex: 0 0 120px;
}

.defect-card-content {
    padding: 13px 15px;
}

.defect-card h3 {
    margin: 7px 0 3px;
    font-size: 19px;
}

.defect-card p {
    font-size: 15px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.defect-card-footer {
    margin-top: 8px;
    font-size: 12px;
}

.defect-card-arrow {
    padding: 10px 13px;
    font-size: 30px;
}

.priority-pill {
    min-height: 24px;
    padding: 3px 8px;
    font-size: 11px;
}

@media (max-width: 760px) {
    .defect-card {
        min-height: 98px;
        flex-wrap: nowrap;
        align-items: stretch;
    }

    .defect-card-image-wrap {
        width: 92px;
        height: auto;
        min-height: 98px;
        flex: 0 0 92px;
    }

    .defect-card-content {
        padding: 10px 11px;
    }

    .defect-card h3 {
        margin: 5px 0 2px;
        font-size: 17px;
    }

    .defect-card p {
        font-size: 14px;
        line-height: 1.28;
        -webkit-line-clamp: 2;
    }

    .defect-card-footer {
        margin-top: 6px;
        gap: 8px;
        font-size: 11px;
    }

    .defect-card-arrow {
        align-self: center;
        padding: 8px 9px;
        font-size: 26px;
    }

    .defect-record-id {
        font-size: 11px;
    }

    .priority-pill {
        min-height: 22px;
        padding: 2px 7px;
        font-size: 10px;
    }
}


/* V31 defect printing */

.defect-print-toolbar,
.defect-print-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.defect-print-actions {
    margin-left: auto;
}

.completed-print-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
}

.defect-select-all {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #425149;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.defect-select-all input,
.defect-row-checkbox input {
    width: 19px;
    height: 19px;
    accent-color: #176f43;
}

.defect-print-button {
    cursor: pointer;
}

.defect-select-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
}

.defect-row-checkbox {
    display: grid;
    place-items: center;
    min-height: 44px;
    cursor: pointer;
}

.defect-select-row .defect-card,
.defect-select-row .completed-defect-row {
    width: 100%;
}

.defect-detail-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 760px) {
    .defect-print-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .defect-print-actions {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
    }

    .completed-print-toolbar {
        justify-content: space-between;
    }

    .defect-select-row {
        grid-template-columns: 27px minmax(0, 1fr);
        gap: 4px;
    }

    .defect-row-checkbox input {
        width: 18px;
        height: 18px;
    }

    .defect-detail-actions {
        justify-content: flex-start;
    }

    .defect-detail-actions .secondary-button {
        width: 100%;
        text-align: center;
    }
}







/* V39 refresh timestamp in grey page area */

.page-refresh-grey {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 18px;
    margin: -4px 0 4px;
    padding: 0 2px;
    color: #68716c;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .page-refresh-grey {
        min-height: 14px;
        margin: -2px 0 3px;
        padding-right: 1px;
        font-size: 9px;
        font-weight: 600;
    }
}

/* V40 local and external device access administration */
.admin-access-section {
    margin-top: 22px;
}

.admin-section-heading {
    margin-bottom: 14px;
}

.admin-section-heading h2 {
    margin: 0 0 5px;
    color: #203a2e;
}

.admin-section-heading p {
    margin: 0;
    color: #617069;
}

.external-session-section {
    margin-top: 34px;
    padding-top: 24px;
    border-top: 2px solid #d8dfdb;
}

.device-list {
    display: grid;
    gap: 14px;
}

.device-card {
    padding: 18px;
    border: 1px solid #cbd5cf;
    border-left: 7px solid #aab5af;
    border-radius: 13px;
    background: white;
}

.device-card.device-recent {
    border-left-color: #198754;
}

.device-card-top,
.device-name-row,
.device-name-controls {
    display: flex;
    align-items: center;
}

.device-card-top {
    justify-content: space-between;
    gap: 16px;
}

.device-name-row {
    gap: 9px;
    flex-wrap: wrap;
}

.device-name-row h3 {
    margin: 0;
    color: #203a2e;
    font-size: 21px;
}

.device-id-text {
    margin-top: 4px;
    color: #6a7770;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
}

.access-type-badge,
.recent-device-badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
}

.access-local {
    background: #e7eef9;
    color: #284f82;
}

.access-external {
    background: #f6ead8;
    color: #80541c;
}

.recent-device-badge {
    background: #e5f6ec;
    color: #14653d;
}

.device-name-form {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #e2e7e4;
}

.device-name-form label {
    display: block;
    margin-bottom: 7px;
    color: #46574f;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.device-name-controls {
    gap: 9px;
}

.device-name-controls input {
    flex: 1;
    min-width: 0;
    border: 1px solid #aebbb4;
    border-radius: 9px;
    padding: 11px 12px;
    font: inherit;
}

.device-name-controls button {
    border: 0;
    border-radius: 9px;
    padding: 11px 15px;
    background: #315142;
    color: white;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .device-details {
        grid-template-columns: 1fr;
    }

    .device-name-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .device-name-controls button {
        width: 100%;
    }
}


/* V41: direct naming controls for external access sessions */
.external-session-controls {
    width: min(360px, 100%);
    flex: 0 0 auto;
}

.external-device-name-form {
    margin-top: 0;
    margin-bottom: 12px;
    padding-top: 0;
    border-top: 0;
}

.external-session-controls .kick-session-button {
    width: 100%;
}

@media (max-width: 780px) {
    .external-session-controls {
        width: 100%;
    }
}


/* V42 Job List */
.home-button.job-list {
    text-decoration: none;
}

.job-home-count {
    font-size: 15px;
    font-weight: 900;
    letter-spacing: .04em;
    color: #51605a;
}

.job-heading-row,
.job-section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.job-section-toolbar {
    margin: 8px 0 14px;
}

.job-section-toolbar h2 {
    margin: 0 0 3px;
}

.job-section-toolbar p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.job-list,
.completed-job-list {
    display: grid;
    gap: 14px;
}

.job-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-left: 7px solid var(--green);
    border-radius: 16px;
    background: white;
    box-shadow: 0 5px 16px rgba(0,0,0,.05);
}

.job-card-image-wrap {
    width: 180px;
    min-height: 160px;
    background: #e8ece9;
}

.job-card-image-wrap a {
    display: block;
    width: 100%;
    height: 100%;
}

.job-card-image {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 160px;
    object-fit: cover;
}

.job-card-content {
    min-width: 0;
    padding: 20px;
}

.job-card-topline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.job-number {
    color: #315142;
    font-weight: 900;
}

.job-description {
    margin: 14px 0 18px;
    color: #34433c;
    font-size: 20px;
    line-height: 1.45;
    font-weight: 750;
    white-space: pre-wrap;
}

.job-assigned-row {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    padding: 8px 11px;
    border-radius: 10px;
    background: #eef5f1;
    color: #315142;
}

.job-assigned-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.job-complete-form {
    display: flex;
    align-items: stretch;
    margin: 0;
}

.job-complete-button {
    min-width: 170px;
    border: 0;
    border-left: 1px solid #d6ded9;
    background: #f0f7f3;
    color: #245b38;
    padding: 20px;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.job-complete-button:hover {
    background: #e1efe7;
}

.job-complete-tick {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--green);
    color: white;
    font-size: 24px;
}

.job-history-bottom {
    margin-top: 28px;
    text-align: center;
}

.job-history-button {
    min-width: 220px;
}

.job-auto-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 12px;
    background: #f4f6f5;
    color: #425049;
}

.job-auto-date span {
    font-weight: 900;
}

.job-auto-date strong {
    color: var(--muted);
    font-size: 14px;
    text-align: right;
}

.field-help {
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.job-card-completed {
    grid-template-columns: auto minmax(0, 1fr);
    border-left-color: #74827b;
}

.job-completed-pill {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e3f3e9;
    color: #276b45;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .05em;
}

.job-history-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.job-history-meta > div {
    padding: 10px 12px;
    border-radius: 10px;
    background: #f5f7f6;
}

.job-history-meta span,
.job-history-meta strong {
    display: block;
}

.job-history-meta span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.job-history-meta strong {
    color: #33423b;
    font-size: 14px;
}

@media (max-width: 780px) {
    .job-heading-row {
        align-items: stretch;
        flex-direction: column;
    }

    .job-card {
        grid-template-columns: 1fr;
    }

    .job-card-image-wrap {
        width: 100%;
        min-height: 210px;
    }

    .job-card-image {
        min-height: 210px;
        max-height: 320px;
    }

    .job-complete-button {
        width: 100%;
        min-width: 0;
        min-height: 76px;
        border-left: 0;
        border-top: 1px solid #d6ded9;
        flex-direction: row;
    }

    .job-history-meta {
        grid-template-columns: 1fr;
    }

    .job-auto-date {
        align-items: flex-start;
        flex-direction: column;
    }

    .job-auto-date strong {
        text-align: left;
    }
}


/* V43: Job List usability and loading feedback */
.global-loading-overlay[hidden],
.job-photo-modal[hidden] {
    display: none !important;
}

.global-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(1px);
}

.global-loading-card {
    min-width: 190px;
    max-width: 320px;
    padding: 24px 26px;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
    text-align: center;
    font-size: 18px;
}

.global-loading-spinner {
    width: 46px;
    height: 46px;
    margin: 0 auto 14px;
    border: 5px solid #d9e4dc;
    border-top-color: #1f6b3c;
    border-radius: 50%;
    animation: global-loading-spin 0.8s linear infinite;
}

@keyframes global-loading-spin {
    to { transform: rotate(360deg); }
}

.page-is-loading {
    cursor: progress;
}

.info-message {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 0 0 20px;
    padding: 14px 16px;
    border: 1px solid #b9d6e8;
    border-radius: 10px;
    background: #eef8ff;
}

.info-message strong,
.info-message span {
    display: block;
}

.job-photo-open {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.job-assignment-form {
    margin-top: 14px;
}

.job-assignment-form label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #56625a;
}

.job-assignment-controls {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.job-assignment-controls input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid #cbd3ce;
    border-radius: 8px;
    background: #ffffff;
    font: inherit;
}

.job-assignment-save {
    flex: 0 0 auto;
    min-width: 84px;
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: #315f43;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.job-assignment-save:disabled {
    opacity: 0.55;
    cursor: progress;
}

.job-photo-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    background: rgba(0, 0, 0, 0.86);
}

.job-photo-modal-card {
    width: min(1100px, 100%);
    max-height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    background: #151515;
}

.job-photo-modal-toolbar {
    flex: 0 0 auto;
    padding: 10px;
    background: #ffffff;
}

.job-photo-close {
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: #315f43;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.job-photo-large {
    display: block;
    width: 100%;
    max-height: calc(100vh - 92px);
    object-fit: contain;
    background: #151515;
}

.job-photo-is-open {
    overflow: hidden;
}

@media (max-width: 680px) {
    .job-assignment-controls {
        flex-direction: column;
    }

    .job-assignment-save {
        width: 100%;
    }

    .global-loading-card {
        min-width: 160px;
    }
}


/* V44: faster, more compact Job List */
.global-loading-overlay {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 100000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: none !important;
}

.global-loading-overlay[hidden] {
    display: none !important;
}

.global-loading-card {
    min-width: 210px;
    padding: 22px 24px;
    border-radius: 14px;
    font-size: 19px;
}

.job-list,
.completed-job-list {
    gap: 9px;
}

.job-card,
.job-card-completed {
    grid-template-columns: minmax(0, 1fr) auto;
    border-left-width: 5px;
    border-radius: 11px;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.job-card-content {
    padding: 12px 14px;
}

.job-card-topline {
    gap: 8px;
    font-size: 12px;
}

.job-description {
    margin: 7px 0 8px;
    font-size: 16px;
    line-height: 1.32;
}

.job-assignment-form {
    margin-top: 8px;
}

.job-assignment-form label {
    margin-bottom: 4px;
    font-size: 12px;
}

.job-assignment-controls {
    gap: 6px;
}

.job-assignment-controls input {
    padding: 7px 9px;
    min-height: 36px;
}

.job-assignment-save {
    min-width: 72px;
    padding: 7px 11px;
    min-height: 36px;
}

.job-complete-button {
    min-width: 135px;
    padding: 12px 14px;
    gap: 5px;
    font-size: 14px;
}

.job-complete-tick {
    width: 30px;
    height: 30px;
    font-size: 19px;
}

.job-photo-compact-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 7px;
    padding: 6px 9px;
    border: 1px solid #cfd8d2;
    border-radius: 7px;
    background: #f6f8f7;
    color: #315142;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.job-photo-compact-button:hover {
    background: #edf3ef;
}

.job-photo-loading {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #ffffff;
}

.job-photo-loading[hidden],
.job-photo-large[hidden] {
    display: none !important;
}

.job-photo-loading-spinner {
    width: 42px;
    height: 42px;
    border: 5px solid rgba(255,255,255,.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: global-loading-spin 0.8s linear infinite;
}

.job-history-meta {
    gap: 7px;
}

.job-history-meta > div {
    padding: 7px 9px;
    border-radius: 8px;
}

@media (max-width: 780px) {
    .job-card,
    .job-card-completed {
        grid-template-columns: 1fr;
    }

    .job-card-content {
        padding: 11px 12px;
    }

    .job-complete-button {
        width: 100%;
        min-height: 54px;
        flex-direction: row;
        border-left: 0;
        border-top: 1px solid #d6ded9;
    }

    .job-description {
        font-size: 15px;
    }
}


/* V45: make assignment obvious and show lightweight photo thumbnails */
.job-assigned-highlight {
    padding: 12px;
    border: 2px solid #b8cdbf;
    border-radius: 10px;
    background: #f5faf6;
}

.job-assigned-highlight label {
    font-size: 16px;
    font-weight: 800;
}

.job-card-bodyline {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 7px;
}

.job-card-main {
    flex: 1 1 auto;
    min-width: 0;
}

.job-thumbnail-button {
    flex: 0 0 92px;
    width: 92px;
    height: 68px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #cbd5cf;
    border-radius: 8px;
    background: #eef3f0;
    color: #315142;
    cursor: zoom-in;
    position: relative;
}

.job-thumbnail-image {
    display: block;
    width: 92px;
    height: 68px;
    object-fit: cover;
}

.job-thumbnail-placeholder {
    display: block;
    margin-top: 9px;
    font-size: 24px;
    line-height: 1;
}

.job-thumbnail-label {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    font-weight: 800;
}

.job-assignment-prominent {
    margin-top: 7px;
    padding: 8px 9px;
    border-radius: 8px;
    background: #f3f7f4;
    border: 1px solid #d6e1da;
}

.job-assignment-prominent label {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: baseline;
    color: #2e4f3b;
    font-size: 13px;
    font-weight: 800;
}

.job-assignment-help {
    font-size: 10px;
    font-weight: 500;
    color: #748078;
}

.job-history-thumbnail {
    margin: 7px 0 4px;
}

@media (max-width: 600px) {
    .job-card-bodyline {
        gap: 8px;
    }

    .job-thumbnail-button,
    .job-thumbnail-image {
        width: 78px;
        height: 60px;
    }

    .job-thumbnail-button {
        flex-basis: 78px;
    }

    .job-assignment-help {
        display: none;
    }
}


/* V46: compact Job List with edit-on-demand assignment */
.job-card-v46 {
    display: block !important;
    border-left-width: 4px !important;
    border-radius: 8px !important;
    min-height: 0 !important;
}

.job-card-content-v46 {
    padding: 8px 10px !important;
}

.job-card-v46 .job-card-topline {
    margin-bottom: 4px !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
}

.job-compact-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.job-thumbnail-button-v46 {
    flex: 0 0 60px;
    width: 60px;
    height: 46px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #c7d1cb;
    border-radius: 6px;
    background: #eef3f0;
    cursor: zoom-in;
}

.job-thumbnail-image-v46 {
    display: block;
    width: 60px;
    height: 46px;
    object-fit: cover;
}

.job-compact-main {
    flex: 1 1 auto;
    min-width: 0;
}

.job-description-v46 {
    margin: 0 0 4px !important;
    font-size: 14px !important;
    line-height: 1.22 !important;
    font-weight: 700;
}

.job-assignment-summary {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    font-size: 11px;
    line-height: 1.1;
    color: #5b675f;
}

.job-assignment-summary-label {
    font-weight: 700;
    white-space: nowrap;
}

.job-assignment-summary-value {
    min-width: 16px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #26382e;
    font-weight: 700;
}

.job-assignment-edit-button,
.job-assignment-cancel-button {
    padding: 3px 7px;
    border: 1px solid #cbd5cf;
    border-radius: 5px;
    background: #ffffff;
    color: #315142;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.job-assignment-edit-form[hidden] {
    display: none !important;
}

.job-assignment-edit-form {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
}

.job-assignment-edit-form input {
    flex: 1 1 auto;
    min-width: 120px;
    height: 30px;
    padding: 4px 7px;
    border: 1px solid #cbd5cf;
    border-radius: 5px;
    font-size: 12px;
}

.job-assignment-save-v46 {
    height: 30px;
    padding: 4px 9px;
    border: 0;
    border-radius: 5px;
    background: #315f43;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.job-complete-form-v46 {
    flex: 0 0 auto;
    margin: 0;
}

.job-complete-button-v46 {
    min-width: 92px;
    height: 36px;
    padding: 5px 9px;
    border: 0;
    border-radius: 6px;
    background: #2f6a43;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.job-card-v46 + .job-card-v46 {
    margin-top: 6px;
}

.job-list {
    gap: 6px !important;
}

@media (max-width: 650px) {
    .job-compact-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .job-compact-main {
        flex: 1 1 calc(100% - 70px);
    }

    .job-complete-form-v46 {
        width: 100%;
        padding-left: 68px;
    }

    .job-complete-button-v46 {
        width: 100%;
        height: 34px;
    }

    .job-assignment-summary-value {
        max-width: 120px;
    }
}


/* V47: slightly larger job photo thumbnails */
.job-thumbnail-button-v46 {
    flex-basis: 82px !important;
    width: 82px !important;
    height: 62px !important;
}

.job-thumbnail-image-v46 {
    width: 82px !important;
    height: 62px !important;
}

@media (max-width: 650px) {
    .job-thumbnail-button-v46,
    .job-thumbnail-image-v46 {
        width: 76px !important;
        height: 58px !important;
    }

    .job-thumbnail-button-v46 {
        flex-basis: 76px !important;
    }

    .job-compact-main {
        flex: 1 1 calc(100% - 86px) !important;
    }

    .job-complete-form-v46 {
        padding-left: 84px !important;
    }
}


/* V48: Job List area tabs */
.job-area-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin: 0 0 14px;
    padding: 5px;
    border: 1px solid #d6ded9;
    border-radius: 10px;
    background: #edf1ee;
}

.job-area-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #415048;
    background: transparent;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
}

.job-area-tab:hover {
    background: #f8faf9;
}

.job-area-tab.active {
    border-color: #2f6a43;
    background: #ffffff;
    color: #245437;
    box-shadow: 0 2px 7px rgba(0, 0, 0, .08);
}

.job-area-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 23px;
    height: 23px;
    padding: 0 6px;
    border-radius: 999px;
    background: #d9e2dc;
    color: #425249;
    font-size: 11px;
    line-height: 1;
}

.job-area-tab.active .job-area-count {
    background: #2f6a43;
    color: #ffffff;
}

.job-area-choice-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}

.job-area-choice {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 8px;
    border: 2px solid #d4ddd7;
    border-radius: 8px;
    background: #f5f8f6;
    color: #3f4f46;
    font-size: 13px;
    font-weight: 800;
    text-align: center;
    cursor: pointer;
}

.job-area-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.job-area-choice.selected,
.job-area-choice:has(input:checked) {
    border-color: #2f6a43;
    background: #eaf3ed;
    color: #245437;
}

.job-history-current-area {
    margin: 0 0 10px;
    font-size: 15px;
    color: #34463c;
}

@media (max-width: 620px) {
    .job-area-tab {
        min-height: 40px;
        padding: 6px 4px;
        gap: 4px;
        font-size: 11px;
    }

    .job-area-count {
        min-width: 19px;
        height: 19px;
        padding: 0 4px;
        font-size: 9px;
    }

    .job-area-choice {
        min-height: 44px;
        padding: 6px 3px;
        font-size: 11px;
    }
}


/* V49 Admin dashboard and device housekeeping */
.admin-dashboard-panel {
    max-width: 760px;
    margin: 0 auto;
}

.admin-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.admin-dashboard-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 120px;
    padding: 20px;
    border: 1px solid #c8d3cd;
    border-radius: 14px;
    background: #ffffff;
    color: #244536;
    font-size: 24px;
    font-weight: 900;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .05);
}

.admin-dashboard-button:hover {
    border-color: #315142;
    background: #f7faf8;
}

.device-delete-form {
    margin-top: 10px;
}

.delete-device-button,
.delete-session-button {
    border: 0;
    border-radius: 9px;
    padding: 10px 14px;
    background: #7e1d1d;
    color: #ffffff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.delete-session-button {
    width: 100%;
    margin-top: 9px;
    background: #6f3030;
}

@media (max-width: 700px) {
    .admin-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .admin-dashboard-button {
        min-height: 90px;
        font-size: 21px;
    }

    .delete-device-button {
        width: 100%;
    }
}

/* Cloudflare Job List printing */
.job-select-row .job-card {
    width: 100%;
}

.job-print-actions form,
.job-history-print-toolbar form {
    margin: 0;
}

.job-inline-print-link {
    margin-left: auto;
    color: #176f43;
    font-size: 12px;
    font-weight: 900;
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (max-width: 760px) {
    .job-print-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .job-print-actions,
    .job-history-print-toolbar {
        width: 100%;
        justify-content: space-between;
    }

    .job-inline-print-link {
        margin-left: 0;
    }
}
