body {
    background: #f5f7fb;
}

.card {
    border: 0;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.select2-container {
    width: 100% !important;
}

button,
.btn {
    touch-action: manipulation;
}

input.form-control,
textarea.form-control,
select.form-select,
.select2-container .select2-selection,
.select2-container .select2-search__field {
    font-size: 16px;
}

/* Sticky PWA tray, below Bootstrap's modal/backdrop layers. */
.pwa-tray {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #fff;
    padding-top: env(safe-area-inset-top, 0px);
    border-bottom: 1px solid #dce1e8;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);
}

.pwa-tray-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 760px;
    margin: 0 auto;
    padding: 10px 12px;
}

.pwa-tray .btn {
    flex-shrink: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pwa-tray .btn[hidden] {
    display: none;
}

.pwa-user {
    flex: 1;
    min-width: 0;
}

.pwa-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-heading {
    border-bottom: 1px solid #dce1e8;
    padding-bottom: 12px;
}

/* Alternating product/material rows. */
.procedure-row {
    border: 1px solid #dce1e8;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
    background: #f3f4f6;
}

.procedure-row:nth-child(even) {
    background: #e5e7eb;
    border-color: #d0d5dc;
}

/* Unfinished work cards. */
.draft-list {
    display: grid;
    gap: 10px;
}

.draft-item {
    display: block;
    width: 100%;
    padding: 14px;
    text-align: left;
    color: #212529;
    background: #fff;
    border: 1px solid #dce1e8;
    border-radius: 12px;
}

.draft-item:nth-child(even) {
    background: #eef0f3;
}

.draft-item:active {
    background: #dfe5ed;
}

.draft-item:focus-visible {
    outline: 3px solid #86b7fe;
    outline-offset: 2px;
}

.draft-heading {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 6px;
}

.draft-heading strong {
    overflow-wrap: anywhere;
}

.draft-open {
    flex-shrink: 0;
    font-size: 13px;
    color: #0d6efd;
}

.draft-products {
    font-size: 14px;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}

.draft-meta {
    font-size: 12px;
    color: #59636f;
    line-height: 1.6;
}

/* Quantity and time controls. */
.quantity-field .form-label,
.time-field .form-label {
    margin-bottom: 6px;
}

.quantity-field .form-control,
.time-field .form-control {
    min-height: 44px;
    text-align: center;
}

.quantity-buttons {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.quantity-buttons button:nth-child(3) {
    margin-right: 3px;
}

.quantity-buttons button:nth-child(4) {
    margin-left: 3px;
}

.quantity-buttons .btn,
.time-buttons .btn,
.time-field .input-group .btn {
    min-height: 44px;
    padding: 8px 2px;
    font-size: 16px;
    font-weight: 500;
}

.time-buttons {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.time-field .input-group .btn {
    min-width: 52px;
}

.scanner {
    width: 100%;
    max-height: 55vh;
    object-fit: cover;
    background: #111;
    border-radius: 12px;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eee;
}

@media (max-width: 359px) {
    .quantity-buttons {
        gap: 4px;
    }

    .quantity-buttons .btn {
        font-size: 15px;
    }

    .pwa-tray-inner {
        gap: 6px;
    }

    .pwa-tray .btn {
        padding-left: 8px;
        padding-right: 8px;
        font-size: 14px;
    }
}
/* Mobile work/archive switch. */
.pwa-view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    max-width: 736px;
    margin: 0 auto;
    padding: 0 12px 10px;
}

.pwa-view-switch button {
    min-height: 44px;
    border: 1px solid #dce1e8;
    border-radius: 10px;
    background: #f3f4f6;
    color: #394452;
    font-size: 16px;
    font-weight: 600;
}

.pwa-view-switch button.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.archive-filter {
    padding: 12px;
    border-radius: 12px;
    background: #eef0f3;
}

.archive-filter-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.archive-filter input,
.archive-filter select,
.archive-filter .btn,
.archive-pagination .btn {
    min-height: 44px;
    min-width: 0;
}

.archive-filter input {
    width: 100%;
}

.archive-list,
.archive-detail-list {
    display: grid;
    gap: 12px;
}

.archive-item,
.archive-detail-row {
    width: 100%;
    padding: 14px;
    border: 1px solid #dce1e8;
    border-radius: 12px;
    background: #fff;
    color: #212529;
    text-align: left;
    overflow-wrap: anywhere;
}

.archive-item:nth-child(even),
.archive-detail-row:nth-child(even) {
    background: #eef0f3;
}

.archive-item:active {
    background: #dfe5ed;
}

.archive-item:focus-visible,
.pwa-view-switch button:focus-visible {
    outline: 3px solid #86b7fe;
    outline-offset: 2px;
}

.archive-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
}

.archive-stat-label {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    color: #59636f;
}

.archive-comment {
    white-space: pre-wrap;
}

.archive-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
}

.archive-pagination > span {
    flex-shrink: 0;
    font-size: 14px;
}

@media (max-width: 359px) {
    .archive-filter-fields {
        grid-template-columns: 1fr;
    }

    .archive-pagination .btn {
        font-size: 13px;
        padding: 8px;
    }
}

.view-toggle {
    font-weight: 600;
    white-space: nowrap;
}

.price-panel {
    padding: 16px;
    background: #fff5d6;
    border: 1px solid #e8ca70;
    border-radius: 12px;
}

.price-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 14px;
}

.price-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
}

#final-price {
    min-height: 48px;
    font-size: 20px;
}

@media (max-width: 420px) {
    .pwa-tray-inner { gap: 6px; }
    .pwa-tray .btn { padding-left: 7px; padding-right: 7px; font-size: 14px; }
    .pwa-email { font-size: 11px; }
}
