/* One-driver: scan-from-photo layout tweaks (reuses app2 driver-app.css) */
.od-scan-row {
    flex-wrap: wrap;
}

.od-scan-card {
    cursor: pointer;
}

.od-scan-actions {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.od-scan-analyze-btn {
    min-width: 12rem;
}

.od-scan-msg {
    min-height: 1.25rem;
    text-align: center;
    font-size: 0.85rem;
}

.od-bulk-input-block {
    margin: 0.5rem 0 0.9rem;
}

.od-bulk-deliveries {
    min-height: 7.5rem;
    resize: vertical;
    line-height: 1.35;
}

.od-bulk-msg {
    margin-top: 0.45rem;
}

.od-tracking-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.od-tracking-input {
    flex: 1;
    min-width: 0;
}

.od-scan-tracking-btn {
    flex-shrink: 0;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
}

.od-barcode-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15, 23, 42, 0.72);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}

.od-barcode-overlay[hidden] {
    display: none !important;
}

.od-barcode-sheet {
    width: 100%;
    max-width: 28rem;
    max-height: min(92vh, 640px);
    background: var(--bg-primary, #fff);
    border-radius: 16px 16px 0 0;
    padding: 1rem 1rem 1.25rem;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
    overflow: auto;
}

.od-barcode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.od-barcode-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.od-barcode-desc {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary, #64748b);
    line-height: 1.4;
}

.od-barcode-reader {
    min-height: 220px;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    margin-bottom: 0.75rem;
}

.od-barcode-reader video {
    border-radius: 12px;
}

.od-barcode-cancel {
    margin-top: 0.25rem;
}

.od-scan-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0 0 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary, rgba(0, 0, 0, 0.04));
    border-radius: 12px;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}

.od-scan-thumb-wrap {
    flex: 0 0 auto;
    width: 96px;
    text-align: center;
}

.od-scan-thumb {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--border-color, rgba(0, 0, 0, 0.12));
    display: block;
    margin: 0 auto 0.35rem;
    background: var(--bg-primary, #fff);
}

.od-scan-thumb--pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b91c1c;
    font-size: 2.25rem;
    background: rgba(185, 28, 28, 0.08);
}

.od-scan-thumb-name {
    display: block;
    font-size: 0.65rem;
    line-height: 1.2;
    color: var(--text-secondary, #64748b);
    word-break: break-all;
    max-width: 96px;
}

/* Deliveries: pending geocode — editable row */
.od-delivery-item {
    align-items: flex-start;
}

.od-delivery-item-pending {
    flex-direction: column;
    gap: 0.5rem;
    border-left: 3px solid var(--warning-color, #d97706);
    padding-left: 0.75rem;
}

.od-delivery-pending-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.od-delivery-pending-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--warning-color, #b45309);
}

.od-item-address-input {
    width: 100%;
    box-sizing: border-box;
}

.od-delivery-pending-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.od-delivery-resolved-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.od-delivery-resolved-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.od-delivery-resolved-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.od-delivery-resolved-top .app2-item-label {
    flex: 1;
    min-width: 0;
}

.od-delivery-warn {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    line-height: 1.35;
    color: #92400E;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
}

.od-delivery-warn[hidden] {
    display: none !important;
}

.od-delivery-warn i {
    font-size: 0.7rem;
    flex-shrink: 0;
}

.od-delivery-warn-trk {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    margin-right: 0.15rem;
}

.od-delivery-tw-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.od-delivery-tw-appointment-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
}

.od-delivery-tw-appointment-label input {
    margin: 0;
}

.od-delivery-tw-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
}

.od-delivery-tw-inputs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.od-delivery-tw-inputs .od-item-tw-start,
.od-delivery-tw-inputs .od-item-tw-end {
    flex: 1 1 6.5rem;
    min-width: 5.5rem;
    max-width: 100%;
}

.od-delivery-tw-sep {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.od-tw-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#od-manual-tw-field > .od-delivery-tw-appointment-label {
    display: inline-flex;
    margin-bottom: 0.35rem;
}

#od-manual-tw-field > #od-manual-tw-label {
    display: block;
    margin-bottom: 0.25rem;
}

.od-manual-tw-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.od-manual-tw-row .app2-input {
    flex: 1 1 6.5rem;
    min-width: 5.5rem;
}

.app2-field-hint {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    margin: 0.35rem 0 0;
    line-height: 1.35;
}

.od-summary-assumptions-title {
    margin: 0.75rem 0 0.35rem 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
}

.od-summary-assumptions-list {
    margin: 0 0 0.25rem 0;
    padding-left: 1.15rem;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-secondary, #475569);
}

.od-summary-assumptions-list li {
    margin-bottom: 0.35rem;
}

.od-summary-assumptions-list li:last-child {
    margin-bottom: 0;
}

.od-route-timing-note {
    margin: 0.6rem 0 0 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-secondary, #64748b);
}

.od-departure-block {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-secondary, rgba(15, 118, 110, 0.06));
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    border-radius: var(--radius-md, 12px);
}

.od-departure-title {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}

.od-departure-options {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.od-departure-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-primary, #334155);
}

.od-departure-time-input {
    max-width: 8rem;
    margin-bottom: 0.25rem;
}

.od-route-departure-line {
    margin: 0.5rem 0 0 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary, #0f766e);
}

/**
 * Blocco navigazione (La mia route): link Google Maps stile ex «Apri mappa consegne»,
 * sotto le istruzioni testuali turn-by-turn nello stesso riquadro.
 */
.od-route-nav-card {
    margin-top: 1rem;
    border-radius: var(--radius-md, 0.5rem);
    overflow: hidden;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-primary, #fff);
    box-shadow: var(--shadow-sm, 0 1px 2px rgb(0 0 0 / 0.06));
}

.od-route-nav-card .app2-google-maps-blocks {
    padding: 0.85rem 1rem 0.65rem;
    gap: 0.5rem;
}

.od-route-nav-card .od-route-show-directions {
    width: calc(100% - 2rem);
    margin: 0 1rem 0.75rem;
    box-sizing: border-box;
}

.od-route-nav-card .app2-google-maps-blocks .app2-btn-route-block {
    background: linear-gradient(135deg, var(--primary-color, #0f766e), var(--primary-dark, #0d9488));
    color: #fff;
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(15, 118, 110, 0.28);
}

.od-route-nav-card .app2-google-maps-blocks .app2-btn-route-block:active {
    opacity: 0.92;
}

.od-route-nav-card .od-route-nav-instructions {
    margin-bottom: 0;
    border: none;
    border-radius: 0;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f0fdfa);
}

.od-route-nav-card .od-route-nav-instr-head {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(13, 148, 136, 0.08));
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.od-route-nav-card .app2-nav-instructions-list {
    max-height: min(48vh, 380px);
    background: var(--bg-primary, #fff);
}

/* Spazio per i FAB vocali fissi in basso a destra */
#od-root .app2-main {
    padding-bottom: calc(1rem + var(--safe-bottom, 0px) + 6.5rem);
}

/* Voce: due FAB tondi flottanti (integrati nella UI, fuori dal flusso del contenuto) */
.od-voice-fab-host {
    position: fixed;
    z-index: 1005;
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    bottom: max(1.5rem, calc(env(safe-area-inset-bottom, 0px) + 1rem));
    left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.45rem;
    pointer-events: none;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.od-voice-fab-host .od-voice-status-pill,
.od-voice-fab-host .od-voice-fab-stack,
.od-voice-fab-host .od-voice-fab {
    pointer-events: auto;
}

.od-voice-status-pill {
    max-width: min(11.5rem, calc(100vw - 5.5rem));
    padding: 0.28rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: right;
    color: #f8fafc;
    background: rgba(15, 23, 42, 0.82);
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(8px);
    min-height: 1.35rem;
    word-break: break-word;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.od-voice-status-pill.is-listening {
    background: rgba(127, 29, 29, 0.92);
    box-shadow: 0 0 0 2px rgba(252, 165, 165, 0.45), 0 6px 18px rgba(127, 29, 29, 0.35);
}

.od-voice-fab-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
}

.od-voice-fab {
    width: 3.2rem;
    height: 3.2rem;
    min-width: 3.2rem;
    min-height: 3.2rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.12rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease, filter 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 999px !important;
    line-height: 1;
    background-clip: padding-box;
}

.od-voice-fab:active {
    transform: scale(0.94);
}

.od-voice-fab i {
    font-size: 1.12rem;
    line-height: 1;
    pointer-events: none;
}

.od-voice-fab--speak {
    background: rgba(255, 255, 255, 0.95);
    color: #0f766e;
    border: 1.5px solid rgba(15, 118, 110, 0.35);
}

.od-voice-fab--speak.is-voice-disabled {
    opacity: 0.48;
    filter: grayscale(0.2);
}

.od-voice-fab--mic {
    background: linear-gradient(145deg, #0d9488 0%, #0f766e 100%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.55);
}

.od-voice-fab--mic.is-voice-disabled {
    opacity: 0.5;
    filter: grayscale(0.35);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}

.od-voice-fab--mic.is-listening {
    background: linear-gradient(145deg, #dc2626 0%, #991b1b 100%) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.35), 0 6px 20px rgba(127, 29, 29, 0.35);
    animation: od-voice-pulse 1.1s ease-in-out infinite;
}

/* Rinforzo quando il servizio nativo segnala registrazione attiva (popup: false) */
.od-voice-native-recording .od-voice-fab--mic.is-listening {
    animation: od-voice-pulse 0.85s ease-in-out infinite, od-voice-mic-ring 1.25s ease-out infinite;
}

@keyframes od-voice-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes od-voice-mic-ring {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55), 0 6px 20px rgba(127, 29, 29, 0.35); }
    70% { box-shadow: 0 0 0 14px rgba(220, 38, 38, 0), 0 6px 20px rgba(127, 29, 29, 0.25); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0), 0 6px 20px rgba(127, 29, 29, 0.35); }
}

/* Modale permesso microfono (Android / negazione persistente) */
.od-mic-perm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.od-mic-perm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.od-mic-perm-card {
    position: relative;
    max-width: 22rem;
    width: 100%;
    padding: 1.15rem 1.25rem;
    border-radius: 14px;
    background: #f8fafc;
    color: #0f172a;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(15, 118, 110, 0.2);
}

.od-mic-perm-title {
    margin: 0 0 0.5rem;
    font-size: 1.02rem;
    font-weight: 700;
    color: #0f766e;
}

.od-mic-perm-body {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    line-height: 1.45;
}

.od-mic-perm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.od-mic-perm-btn {
    border: none;
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}

.od-mic-perm-btn--secondary {
    background: #e2e8f0;
    color: #0f172a;
}

.od-mic-perm-btn--primary {
    background: linear-gradient(145deg, #0d9488 0%, #0f766e 100%);
    color: #fff;
}

.od-voice-sr-block {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.od-voice-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app2-stop-eta {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color, #0f766e);
}

.app2-nav-stack {
    flex-direction: column;
    align-items: stretch;
}

.app2-nav-stack .app2-btn {
    width: 100%;
}

.od-past-jobs-filters {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-secondary, rgba(0, 0, 0, 0.03));
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}

.od-past-jobs-filter-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.od-past-jobs-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

@media (max-width: 480px) {
    .od-past-jobs-dates {
        grid-template-columns: 1fr;
    }
}

.od-past-jobs-filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
}

.od-past-jobs-source-hint {
    font-size: 0.8rem;
    color: var(--warning-color, #b45309);
    margin: 0 0 0.75rem 0;
    padding: 0.5rem 0.75rem;
    background: rgba(217, 119, 6, 0.1);
    border-radius: 8px;
}

.od-past-jobs-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.od-history-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: var(--radius-md, 12px);
    align-items: stretch;
}

@media (min-width: 520px) {
    .od-history-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.od-history-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.od-history-card-date {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}

.od-history-card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary, #64748b);
}

.od-history-card-status {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    width: fit-content;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
}

.od-history-status-completed {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.od-history-status-failed,
.od-history-status-cancelled {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.od-history-status-processing,
.od-history-status-queued {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.od-history-status-unknown {
    background: var(--bg-tertiary, rgba(0, 0, 0, 0.06));
    color: var(--text-secondary, #64748b);
}

.od-past-jobs-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.od-past-jobs-pageinfo {
    font-size: 0.85rem;
    color: var(--text-secondary, #64748b);
    min-width: 8rem;
    text-align: center;
}

/* Google Places suggestions above sheets/modals */
.pac-container {
    z-index: 10050 !important;
}

/* Route view: delivery stop photos (IndexedDB, client-only) */
.od-stop-photo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}

.od-stop-photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.od-stop-photo-add {
    flex-shrink: 0;
    width: 3.5rem;
    height: 3.5rem;
    min-width: 3.5rem;
    min-height: 3.5rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 2px dashed rgba(15, 118, 110, 0.38);
    background: rgba(15, 118, 110, 0.07);
    color: #0f766e;
    font-size: 1.05rem;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.od-stop-photo-add:active {
    transform: scale(0.96);
    background: rgba(15, 118, 110, 0.12);
}

.od-stop-photo-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    align-items: center;
}

.od-stop-photo-thumb-wrap {
    width: 3.5rem;
    height: 3.5rem;
    flex-shrink: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-tertiary, rgba(0, 0, 0, 0.05));
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.1);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.od-stop-photo-thumb-wrap:focus-visible {
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.45), 0 2px 12px rgba(15, 23, 42, 0.12);
}

.od-stop-photo-thumb-wrap:active {
    transform: scale(0.96);
}

.od-stop-photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    user-select: none;
    vertical-align: middle;
}

.od-route-photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.od-route-photo-lightbox[hidden] {
    display: none !important;
}

.od-route-photo-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.88);
}

.od-route-photo-lightbox-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: min(96vw, 900px);
    max-height: min(92vh, 920px);
    margin: 0.5rem;
}

.od-route-photo-lightbox-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    width: 100%;
    padding: 0 0.15rem 0.65rem;
    flex-shrink: 0;
}

.od-route-photo-lightbox-delete {
    margin-right: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    border: 1px solid rgba(252, 165, 165, 0.55);
    background: rgba(127, 29, 29, 0.35);
    color: #fecaca;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.od-route-photo-lightbox-delete:active {
    background: rgba(153, 27, 27, 0.55);
}

.od-route-photo-lightbox-close {
    position: static;
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95) !important;
    color: var(--text-primary, #0f172a) !important;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}

.od-route-photo-lightbox-frame {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md, 14px);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.od-route-photo-lightbox-img {
    display: block;
    max-width: 100%;
    max-height: min(78vh, 820px);
    width: auto;
    height: auto;
    object-fit: contain;
    vertical-align: middle;
}

body.od-route-photo-lightbox-open {
    overflow: hidden;
}

/* Flow One — CRM assistenza (/one-driver/chat) */
.od-chat-header-link {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.od-chat-page .od-chat-main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 4rem);
    max-width: 40rem;
    margin: 0 auto;
    width: 100%;
    padding: 0 1rem 1.5rem;
    box-sizing: border-box;
}

.od-chat-banner {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md, 12px);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.od-chat-banner--warn {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.od-chat-setup .app2-step-header,
.od-chat-webhook-panel .app2-step-header {
    margin-bottom: 1rem;
}

.od-chat-webhook-notice {
    font-size: 0.9rem !important;
    color: var(--text-muted, #64748b) !important;
}

.od-chat-thread {
    flex: 1;
    min-height: 12rem;
    max-height: min(52vh, 420px);
    overflow-y: auto;
    padding: 0.75rem;
    border-radius: var(--radius-md, 12px);
    background: var(--bg-muted, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    margin-bottom: 0.75rem;
}

.od-chat-thread--local {
    max-height: min(40vh, 360px);
}

.od-chat-msg {
    display: flex;
    margin-bottom: 0.5rem;
}

.od-chat-msg--user {
    justify-content: flex-end;
}

.od-chat-msg--other {
    justify-content: flex-start;
}

.od-chat-msg-bubble {
    max-width: 85%;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
}

.od-chat-msg--user .od-chat-msg-bubble {
    background: #0f766e;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.od-chat-msg--other .od-chat-msg-bubble {
    background: #fff;
    color: var(--text-primary, #0f172a);
    border: 1px solid var(--border-color, #e2e8f0);
    border-bottom-left-radius: 4px;
}

.od-chat-composer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.od-chat-composer--live {
    position: sticky;
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: linear-gradient(to top, var(--bg-primary, #fff) 70%, transparent);
}

.od-chat-textarea {
    resize: vertical;
    min-height: 2.75rem;
    font-family: inherit;
}

.od-chat-composer-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.od-chat-file-label {
    cursor: pointer;
    margin: 0;
}

.od-chat-live-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.od-chat-live-title {
    font-family: var(--font-display, "Outfit", sans-serif);
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary, #0f172a);
}

.od-chat-end-btn {
    flex-shrink: 0;
}

.od-chat-error {
    color: #b91c1c;
    font-size: 0.88rem;
    margin-top: 0.5rem;
}

.od-chat-page .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Referral program promo (Flow One driver home) */
.od-referral-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.85rem;
    margin: 0 0 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg, 12px);
    border: 1px solid var(--border-color, #e2e8f0);
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 55%, #f8fafc 100%);
}

.od-referral-strip-icon {
    color: var(--primary-color, #0f766e);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.od-referral-strip-text {
    flex: 1 1 200px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.od-referral-strip-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary, #0f172a);
}

.od-referral-strip-desc {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-secondary, #64748b);
}

.od-referral-strip-link {
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-color, #0f766e);
    text-decoration: none;
    white-space: nowrap;
}

.od-referral-strip-link:hover {
    text-decoration: underline;
}

/* ===== POD sheet (proof of delivery) ===== */
.od-pod-overlay .od-pod-sheet {
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}
.od-pod-body {
    overflow-y: auto;
    flex: 1 1 auto;
}
.od-pod-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.od-pod-photo-add {
    width: 72px;
    height: 72px;
    border: 1.5px dashed var(--border-color, #cbd5e1);
    border-radius: 0.6rem;
    background: #f8fafc;
    color: var(--text-secondary, #64748b);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-size: 0.65rem;
    cursor: pointer;
}
.od-pod-photo-add i { font-size: 1.1rem; }
.od-pod-photo-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 0.6rem;
    overflow: hidden;
    border: 1px solid var(--border-color, #e2e8f0);
}
.od-pod-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.od-pod-photo-del {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.od-pod-sign-wrap {
    position: relative;
    border: 1.5px solid var(--border-color, #e2e8f0);
    border-radius: 0.6rem;
    background: #fff;
    height: 160px;
    touch-action: none;
}
.od-pod-sign-wrap canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 0.6rem;
}
.od-pod-sign-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}
.od-pod-note {
    resize: vertical;
    min-height: 2.5rem;
}
.od-pod-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.85rem 1rem 1.1rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: #fff;
}
.od-pod-foot .app2-btn {
    flex: 1 1 auto;
    min-width: 0;
}
.od-pod-foot #od-pod-save {
    flex: 1 1 100%;
}
.app2-stop-event-time {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #059669;
    margin-top: 0.2rem;
}

/* ===== Flow One courier redesign (2026-09) ===== */

.od-stepper {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    margin: 0 0 1rem;
    padding: 0.35rem;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 999px;
    box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));
}

.od-stepper-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.4rem;
    padding: 0.35rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary, #475569);
    border: none;
    background: transparent;
    font-family: inherit;
}

.od-stepper-item.is-active {
    background: linear-gradient(135deg, var(--primary-color, #0b5f59), var(--primary-dark, #0f766e));
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.od-stepper-item.is-done {
    color: var(--primary-color, #0b5f59);
    background: var(--primary-light, #ccfbf1);
}

.od-stepper-num {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.08);
}

.od-stepper-item.is-active .od-stepper-num {
    background: rgba(255, 255, 255, 0.22);
}

.od-stepper-item.is-done .od-stepper-num {
    background: rgba(15, 118, 110, 0.15);
}

.od-card {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-xl, 1.25rem);
    box-shadow: var(--shadow-card, 0 4px 16px -4px rgba(15, 118, 110, 0.14));
    padding: 1rem 1.1rem;
    margin-bottom: 0.9rem;
}

.od-card-title {
    margin: 0 0 0.65rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #0f172a);
}

.od-card-muted {
    background: linear-gradient(180deg, #f8fffc 0%, #ffffff 100%);
}

.od-card-secondary .app2-field:last-child {
    margin-bottom: 0;
}

.od-referral-strip {
    margin-bottom: 0.85rem;
    border-radius: var(--radius-xl, 1.25rem);
    padding: 0.75rem 0.9rem;
    background: linear-gradient(135deg, #fff7ed 0%, #ecfdf5 100%);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.od-bulk-accordion {
    margin: 0.35rem 0 1rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-xl, 1.25rem);
    background: var(--bg-primary, #fff);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.od-bulk-accordion > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.95rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary, #0f172a);
    -webkit-tap-highlight-color: transparent;
}

.od-bulk-accordion > summary::-webkit-details-marker {
    display: none;
}

.od-bulk-accordion > summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary, #475569);
    transition: transform 0.15s ease;
}

.od-bulk-accordion[open] > summary::after {
    transform: rotate(180deg);
}

.od-bulk-accordion-body {
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

.od-delivery-item {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-xl, 1.25rem);
    box-shadow: var(--shadow-card, 0 4px 16px -4px rgba(15, 118, 110, 0.12));
    padding: 0.9rem 1rem;
    margin-bottom: 0.65rem;
}

.od-delivery-item-pending {
    border-color: rgba(245, 158, 11, 0.55);
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 70%);
}

.od-nav-primary {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.od-nav-primary .app2-btn-primary {
    width: 100%;
    flex: none;
    min-width: 0;
}

.od-nav-primary .app2-btn-outline {
    width: 100%;
}

.od-route-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.25rem 0 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-lg, 1rem);
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    font-size: 0.9rem;
    font-weight: 600;
}

.od-route-progress-bar {
    flex: 1;
    height: 0.45rem;
    border-radius: 999px;
    background: var(--bg-tertiary, #f1f5f9);
    overflow: hidden;
}

.od-route-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color, #0b5f59), var(--accent-amber, #f59e0b));
    border-radius: inherit;
    transition: width 0.25s ease;
}

.od-next-hero {
    background: linear-gradient(145deg, #0b5f59 0%, #0f766e 55%, #134e4a 100%);
    color: #fff;
    border-radius: var(--radius-xl, 1.25rem);
    padding: 1.05rem 1.1rem 1.15rem;
    margin-bottom: 0.9rem;
    box-shadow: 0 12px 28px -12px rgba(11, 95, 89, 0.55);
}

.od-next-hero[hidden] {
    display: none !important;
}

.od-next-hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(245, 158, 11, 0.95);
    color: #1c1917;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    margin-bottom: 0.55rem;
}

.od-next-hero-addr {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    font-weight: 650;
    line-height: 1.3;
    margin: 0 0 0.35rem;
}

.od-next-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.85rem;
    font-size: 0.86rem;
    opacity: 0.92;
    margin-bottom: 0.85rem;
}

.od-next-hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.od-next-hero-actions .app2-btn {
    width: 100%;
    box-shadow: none;
}

.od-next-hero-actions .app2-btn-primary {
    background: #fff;
    color: var(--primary-color, #0b5f59);
}

.od-next-hero-actions .app2-btn-outline {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

.od-next-hero-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.od-sync-banner {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0 0 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-lg, 1rem);
    background: var(--accent-amber-soft, #fffbeb);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #92400e;
    font-size: 0.86rem;
    font-weight: 500;
}

.od-sync-banner[hidden] {
    display: none !important;
}

.od-sync-banner i {
    color: var(--accent-amber, #f59e0b);
}

.app2-stop-done-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.od-voice-fab-host {
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    gap: 0.4rem;
}

.od-voice-fab {
    width: 2.65rem;
    height: 2.65rem;
    font-size: 0.95rem;
}

.od-voice-status-pill {
    font-size: 0.72rem;
    max-width: 9.5rem;
    opacity: 0.9;
}

.od-map-toggle {
    width: 100%;
    margin-bottom: 0.55rem;
}

.od-map-wrap.is-collapsed .app2-map-container {
    display: none;
}

.app2-login-page {
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(15, 118, 110, 0.18), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgba(245, 158, 11, 0.12), transparent 50%),
        var(--bg-secondary, #ecfdf8);
}

.app2-login-card {
    border-radius: var(--radius-xl, 1.25rem) !important;
    box-shadow: var(--shadow-md, 0 8px 24px -8px rgba(15, 23, 42, 0.18)) !important;
    border-color: rgba(15, 118, 110, 0.12) !important;
}

.app2-login-card .app2-btn-primary {
    width: 100%;
    flex: none;
}

/* Address suggestions must float above cards/sheets */
.od-card,
.od-card-muted,
.od-delivery-item,
.od-delivery-pending-body,
.od-pending-address-field,
.app2-sheet,
.app2-sheet-body {
    overflow: visible;
}

.app2-sheet-body .app2-suggestions,
.od-item-suggestions {
    z-index: 10060;
}

.od-pending-address-field {
    position: relative;
    margin-bottom: 0.35rem;
}
