#receiptExtractionModal.modal-backdrop-topmost{z-index:3700!important}
#receiptCameraModal.modal-backdrop-topmost{z-index:3800!important}
.receipt-extraction-modal{width:min(1100px,100%);max-height:calc(100dvh - 2rem);overflow:auto;text-align:left}
.quick-add-receipt-modal{width:min(660px,100%);max-height:calc(100dvh - 2rem);overflow:auto;text-align:left}
.quick-add-receipt-modal .form-grid{grid-template-columns:1fr}
.quick-receipt-capture{display:flex;flex-wrap:wrap;gap:10px;margin-top:16px;text-align:left}
.quick-receipt-capture input[type="file"]{position:absolute;width:1px;height:1px;clip-path:inset(50%);overflow:hidden}
.quick-receipt-capture label.secondary-button{display:inline-flex;align-items:center;cursor:pointer}
.quick-receipt-capture p{flex-basis:100%;margin:2px 0 0;color:#37516a;line-height:1.4}
.quick-receipt-file-name{margin:12px 0;overflow-wrap:anywhere;color:#153f3c}
.quick-receipt-history{margin-top:18px;padding-top:14px;border-top:1px solid #d3e0e8;text-align:left}
.quick-receipt-history h3{margin:0 0 8px}
.quick-receipt-history-row{display:flex;gap:12px;align-items:center;padding:10px 0;border-top:1px solid #e1e9ed}
.quick-receipt-history-row span{flex:1;min-width:0;overflow-wrap:anywhere}
.quick-receipt-history-row small{display:block;color:#37516a}
.saved-general-receipt-modal{width:min(800px,100%);max-height:calc(100dvh - 1rem);overflow:auto;text-align:left}
.saved-general-receipt-modal .receipt-extraction-image{max-height:72dvh}
.photo-gallery-group-title{grid-column:1/-1;margin:16px 0 2px;text-align:left;color:#173d39;font-size:1.15rem}
.photo-gallery-group-title small{font-size:.8rem;font-weight:600;color:#546675;margin-left:7px}
.receipt-preview-badge{display:inline-block!important;color:#174f4b!important;background:#eef8f6;border:1px solid #b7dad5;border-radius:6px;padding:4px 8px;margin-top:6px;font-weight:700}
.receipt-camera-modal .modal-actions,.receipt-extraction-modal .modal-actions{position:sticky;bottom:0;z-index:2;background:#fff;padding:12px 0;display:flex;flex-wrap:wrap;gap:8px}
.receipt-extraction-note{margin:12px 0;padding:12px;border:1px solid #b7dad5;border-radius:10px;background:#eef8f6;color:#153f3c}
.receipt-extraction-grid{display:grid;grid-template-columns:minmax(240px,1fr) minmax(300px,1fr);gap:18px;align-items:start}
.receipt-extraction-image{min-height:250px;max-height:65dvh;overflow:auto;background:#111827;border-radius:12px;text-align:center}
.receipt-extraction-image img{display:block;width:auto;max-width:100%;height:auto;max-height:none;margin:auto}
.receipt-extraction-review{min-width:0}
.receipt-extraction-review .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.receipt-extraction-results{margin-top:16px;overflow-wrap:anywhere}
.receipt-extraction-results strong{display:block;margin-top:12px}
.receipt-extraction-results ul{margin:8px 0;padding-left:22px}
.receipt-extraction-results li{margin-bottom:7px}
.receipt-line-item-review{margin-top:18px;text-align:left}
.receipt-line-item-review h3{margin:0 0 8px}
#receiptExtractionItems{list-style:none;margin:12px 0;padding:0}
#receiptExtractionItems .receipt-line-item{display:block;margin:10px 0;padding:12px;border:1px solid #cbd8df;border-radius:10px;background:#f7fafb}
#receiptExtractionItems .receipt-line-item.is-approved{border-color:#78b6a1;background:#eef8f2}
.receipt-line-fields{display:grid;grid-template-columns:minmax(0,1fr) 120px;gap:10px}
.receipt-line-fields .field{min-width:0}
.receipt-line-fields input{width:100%;box-sizing:border-box}
.receipt-line-actions,.receipt-line-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:10px}
.receipt-line-actions>span{flex:1;min-width:100px;font-weight:700;color:#37516a}
.receipt-line-item.is-approved .receipt-line-actions>span{color:#174f4b}
#receiptLineItemSummary{font-weight:700;color:#174f4b}
#receiptLineItemWarning{padding:10px;border:1px solid #e0c07c;border-radius:8px;background:#fff8e8}
#receiptAmountConfidence{padding:10px;border:1px solid #cbd8df;border-radius:8px;color:#37516a;background:#f7fafb;line-height:1.4}
#receiptAmountConfidence.is-matched{border-color:#78b6a1;background:#eef8f2;color:#174f4b}
.saved-receipt-line-items{text-align:left;margin-top:16px}
.saved-receipt-line-items ul{list-style:none;padding:0}
.saved-receipt-line-items li{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid #d3e0e8;overflow-wrap:anywhere}
.saved-receipt-line-items small{display:block;color:#174f4b}
@media(max-width:480px){.receipt-line-fields{grid-template-columns:1fr}.receipt-line-actions>span{flex-basis:100%}}
#receiptExtractionStatus{font-weight:700;color:#174f4b}
.receipt-upload-tools{padding:12px;border:1px solid #b7dad5;border-radius:10px;background:#eef8f6;text-align:left}
.receipt-upload-tools p{margin:8px 0 0}
.receipt-service-camera{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:8px 0}
.receipt-service-camera[hidden]{display:none!important}
.receipt-service-camera small{color:#37516a}
.receipt-quality-note{color:#37516a;line-height:1.4}
.receipt-camera-modal{width:min(680px,100%);max-height:calc(100dvh - 1rem);overflow:auto;text-align:left}
.receipt-camera-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:12px 0}
.receipt-camera-controls button{min-height:44px}
.receipt-camera-controls button[aria-pressed="true"]{background:#174f4b;color:#fff;border-color:#174f4b}
.receipt-camera-torch-status{flex:1 1 180px;font-size:.875rem;line-height:1.4;margin:0;color:#4b5563}
.receipt-camera-viewport{position:relative;width:100%;height:min(66dvh,640px);min-height:300px;overflow:hidden;border-radius:14px;background:#111827}
.receipt-camera-viewport video{display:block;width:100%;height:100%;object-fit:cover}
.receipt-camera-guide{position:absolute;inset:2.5% 4%;pointer-events:none;border:1px dashed rgba(255,255,255,.75);border-radius:8px}
.receipt-camera-guide span{position:absolute;width:30px;height:30px;border:4px solid #fff}
.receipt-camera-guide span:nth-child(1){top:-3px;left:-3px;border-right:0;border-bottom:0}
.receipt-camera-guide span:nth-child(2){top:-3px;right:-3px;border-left:0;border-bottom:0}
.receipt-camera-guide span:nth-child(3){bottom:-3px;left:-3px;border-right:0;border-top:0}
.receipt-camera-guide span:nth-child(4){bottom:-3px;right:-3px;border-left:0;border-top:0}
.receipt-camera-status{font-weight:700;min-height:1.5em;margin:12px 0;color:#174f4b}
.receipt-camera-status.is-blocked{color:#9b2432}
@media(max-width:720px){
  .quick-add-receipt-modal{max-height:calc(100dvh - 1rem - env(safe-area-inset-bottom,0px));padding-bottom:calc(16px + env(safe-area-inset-bottom,0px))}
  .receipt-extraction-modal{max-height:calc(100dvh - 1rem - env(safe-area-inset-bottom,0px));padding-bottom:calc(16px + env(safe-area-inset-bottom,0px))}
  .receipt-extraction-grid{grid-template-columns:1fr}
  .receipt-extraction-image{min-height:180px;max-height:38dvh}
  .receipt-extraction-review .form-grid{grid-template-columns:1fr 1fr}
  .receipt-camera-modal{max-height:calc(100dvh - env(safe-area-inset-bottom,0px));padding-bottom:calc(14px + env(safe-area-inset-bottom,0px))}
}
@media(max-width:420px){.receipt-extraction-review .form-grid{grid-template-columns:1fr}}
@media(max-width:460px){.quick-receipt-history-row{flex-wrap:wrap}.quick-receipt-history-row span{flex-basis:100%}}
/* Keep camera framing and capture controls together within the visible viewport. */
#receiptCameraModal{padding:8px;place-items:center}
#receiptCameraModal .receipt-camera-modal{box-sizing:border-box;height:min(850px,calc(100dvh - 16px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));max-height:none;padding:12px;display:flex;flex-direction:column;gap:8px;overflow:hidden;border-radius:16px}
.receipt-camera-modal>.details-modal-header{flex:none;align-items:center;margin:0;padding:0;background:transparent}
.receipt-camera-modal .section-kicker{display:none}
.receipt-camera-modal h2{font-size:1.125rem;line-height:1.25;margin:0}
.receipt-camera-help{flex:none;font-size:.8125rem;line-height:1.35;color:#37516a;max-height:100px;overflow:auto}
.receipt-camera-help summary{cursor:pointer;padding:4px 0}
.receipt-camera-help p{margin:6px 0}
.receipt-camera-modal .receipt-camera-controls{flex:none;margin:0;gap:8px}
.receipt-camera-modal .receipt-camera-torch-status{font-size:.75rem;line-height:1.25}
.receipt-camera-modal .receipt-camera-viewport{flex:1 1 0;height:auto;min-height:0}
.receipt-camera-modal .receipt-camera-status{flex:none;font-size:.8125rem;line-height:1.3;min-height:0;margin:0}
#receiptCameraModal .modal-actions{flex:none;position:static;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));margin:0;padding:0;gap:6px}
#receiptCameraModal button,.quick-add-receipt-modal button,.quick-receipt-capture label.secondary-button{box-sizing:border-box;min-height:44px;padding:8px 10px;font-size:.875rem;line-height:1.25}
#receiptCameraModal .modal-close{width:auto;flex:none}
#receiptCameraModal .modal-actions button{width:100%;min-width:0}
.quick-add-receipt-modal .modal-actions{gap:8px}
.quick-receipt-capture{gap:8px}
.quick-receipt-capture p{font-size:.875rem}
/* A portrait crop keeps long slips large while all four corners stay visible. */
.receipt-camera-stage{flex:1 1 0;min-height:0;min-width:0;display:grid;place-items:center;container-type:size;background:#eaf0f3;border-radius:14px}
.receipt-camera-modal .receipt-camera-viewport{flex:none;width:auto;height:100%;aspect-ratio:1 / 2.8;max-width:100%;max-height:100%;border-radius:10px}
@supports(width:1cqh){.receipt-camera-modal .receipt-camera-viewport{width:min(100%,calc(100cqh / 2.8));height:min(100cqh,280cqw)}}
.receipt-camera-modal:has(#receiptCameraShape option[value="extra-long"]:checked) .receipt-camera-viewport{aspect-ratio:1 / 4}
@supports(width:1cqh){.receipt-camera-modal:has(#receiptCameraShape option[value="extra-long"]:checked) .receipt-camera-viewport{width:min(100%,25cqh);height:min(100cqh,400cqw)}}
.receipt-camera-shape{display:flex;align-items:center;gap:6px;margin-left:auto;font-size:.75rem;color:#37516a}
.receipt-camera-shape select{width:auto;min-height:44px;font-size:.875rem;padding:8px}
#receiptPreviewProfit{grid-column:1/-1;text-align:left}
