/* RRV3 Delivery Module styles */
.rrv3-delivery-intro {
    border-left: 4px solid #0ea5e9;
}
.rrv3-delivery-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.rrv3-delivery-stat-card {
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    background: #ffffff;
    padding: 14px 16px;
    box-shadow: 0 3px 10px rgba(15,23,42,.05);
}
.rrv3-delivery-stat-card label {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.rrv3-delivery-stat-card strong {
    color: #0f172a;
    font-size: 22px;
}
.rrv3-delivery-status-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11.5px;
    font-weight: 800;
    line-height: 1.15;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.delivery-status-in-transit {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}
.delivery-status-delivered-pending-confirmation {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}
.delivery-status-received-confirmed {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.delivery-status-partial-issue,
.delivery-status-cancelled {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

/* Delivery dashboard tabs and detail page */
.rrv3-delivery-tabs {
    margin: 12px 0 16px;
}
.rrv3-delivery-task-table td small {
    color: #64748b;
    font-weight: 700;
}
.rrv3-delivery-detail-hero {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid #dbeafe;
    border-radius: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
    box-shadow: 0 10px 26px rgba(15,23,42,.08);
    margin-bottom: 16px;
}
.rrv3-delivery-detail-hero h2 {
    margin: 8px 0 4px;
    color: #0f172a;
}
.rrv3-delivery-detail-hero p {
    margin: 0;
    color: #475569;
    font-weight: 700;
}
.rrv3-delivery-detail-date {
    min-width: 160px;
    text-align: right;
}
.rrv3-delivery-detail-date label {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}
.rrv3-delivery-detail-date strong {
    color: #1e40af;
}
.rrv3-delivery-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.rrv3-delivery-kv {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid #e5edf7;
}
.rrv3-delivery-kv:last-child {
    border-bottom: 0;
}
.rrv3-delivery-kv label {
    color: #64748b;
    font-size: 11.5px;
    font-weight: 900;
}
.rrv3-delivery-timeline-route {
    margin: -4px 0 14px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 12px;
    font-weight: 750;
}
.rrv3-delivery-timeline-route strong {
    color: #1d4ed8;
}
.rrv3-delivery-timeline-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 26px;
}
.rrv3-delivery-timeline-pill {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    min-width: 160px;
    min-height: 54px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
}
.rrv3-delivery-timeline-pill:not(:last-child)::after {
    content: "→";
    position: absolute;
    right: -22px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-weight: 1000;
    font-size: 18px;
}
.rrv3-delivery-timeline-pill.is-complete {
    border-color: #86efac;
    background: #f0fdf4;
}
.rrv3-delivery-timeline-pill.is-complete strong {
    color: #166534;
}
.rrv3-delivery-timeline-pill strong {
    color: #334155;
    font-size: 12px;
}
.rrv3-delivery-timeline-pill small {
    color: #64748b;
    font-size: 11px;
    font-weight: 750;
}
.rrv3-delivery-proof-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.rrv3-delivery-proof-card {
    border: 1px solid #dbe3ef;
    border-radius: 14px;
    background: #ffffff;
    padding: 12px;
}
.rrv3-delivery-proof-card strong,
.rrv3-delivery-proof-card small,
.rrv3-delivery-proof-card a {
    display: block;
}
@media (max-width: 760px) {
    .rrv3-delivery-detail-hero,
    .rrv3-delivery-detail-grid {
        grid-template-columns: 1fr;
    }
    .rrv3-delivery-detail-hero {
        flex-direction: column;
    }
    .rrv3-delivery-detail-date {
        text-align: left;
    }
    .rrv3-delivery-kv {
        grid-template-columns: 1fr;
    }
    .rrv3-delivery-timeline-pills {
        gap: 24px;
    }
    .rrv3-delivery-timeline-pill {
        width: 100%;
        border-radius: 18px;
    }
    .rrv3-delivery-timeline-pill:not(:last-child)::after {
        content: "↓";
        right: 50%;
        top: auto;
        bottom: -23px;
        transform: translateX(50%);
    }
}

/* Delivery task creation */
.rrv3-delivery-create-page {
    max-width: 1060px;
    margin: 0 auto;
}
.rrv3-delivery-create-items {
    display: grid;
    gap: 10px;
}
.rrv3-delivery-create-item {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: #ffffff;
    cursor: pointer;
}
.rrv3-delivery-create-item:hover {
    border-color: #0ea5e9;
    background: #f0f9ff;
}
.rrv3-delivery-create-item input {
    margin-top: 4px;
}
.rrv3-delivery-create-item strong,
.rrv3-delivery-create-item em,
.rrv3-delivery-create-item small {
    display: block;
}
.rrv3-delivery-create-item strong {
    color: #0f172a;
}
.rrv3-delivery-create-item em {
    color: #334155;
    font-style: normal;
    font-weight: 700;
    margin-top: 2px;
}
.rrv3-delivery-create-item small {
    color: #64748b;
    margin-top: 3px;
    font-weight: 700;
}
.rrv3-delivery-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    padding: 14px 0 18px;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid #dbe3ef;
}
.rrv3-delivery-shortcut-panel {
    border-left: 4px solid #0ea5e9;
}
@media (max-width: 720px) {
    .rrv3-delivery-form-actions .rrv3-button {
        width: 100%;
        justify-content: center;
    }
}

/* Delivery movement actions */
.rrv3-delivery-action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.rrv3-delivery-action-grid .rrv3-button {
    min-height: 42px;
}
@media (max-width: 640px) {
    .rrv3-delivery-action-grid .rrv3-button {
        width: 100%;
        justify-content: center;
    }
}

/* Receiver confirmation link/share panel */
.rrv3-delivery-confirmation-share-panel {
    margin: 16px 0 18px;
    padding: 18px;
    border: 1px solid #bbf7d0;
    border-left: 5px solid #16a34a;
    border-radius: 18px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 78%);
    box-shadow: 0 10px 26px rgba(22, 163, 74, .10);
}
.rrv3-delivery-confirmation-share-panel h3 {
    margin: 0 0 8px;
    color: #166534;
}
.rrv3-delivery-confirmation-url,
.rrv3-delivery-confirmation-message {
    margin-top: 12px;
}
.rrv3-delivery-confirmation-url label,
.rrv3-delivery-confirmation-message label {
    display: block;
    margin-bottom: 5px;
    color: #475569;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.rrv3-delivery-confirmation-url input {
    width: 100%;
    min-height: 40px;
    border: 1px solid #86efac;
    border-radius: 10px;
    background: #ffffff;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}
.rrv3-delivery-confirmation-message pre {
    white-space: pre-wrap;
    overflow: auto;
    max-height: 280px;
    margin: 0;
    padding: 12px;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    font-size: 13px;
    line-height: 1.45;
}
.rrv3-delivery-confirmation-actions,
.rrv3-delivery-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 13px;
}
.rrv3-delivery-confirm-page {
    max-width: 980px;
    margin: 0 auto;
}
@media (max-width: 640px) {
    .rrv3-delivery-confirmation-actions .rrv3-button,
    .rrv3-delivery-confirm-actions .rrv3-button {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

/* Delivery proof upload and thumbnails */
.rrv3-delivery-proof-upload {
    margin-bottom: 16px;
    padding: 14px;
    border: 1px dashed #bfdbfe;
    border-radius: 14px;
    background: #f8fafc;
}
.rrv3-delivery-proof-card img {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e5edf7;
    margin: 8px 0;
}
.rrv3-delivery-proof-card p {
    margin: 8px 0 0;
    color: #334155;
    font-size: 12px;
}

/* Requisition item delivery tracking summary */
.rrv3-item-delivery-summary {
    margin: 10px 14px 0;
    padding: 10px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #eff6ff;
}
.rrv3-item-delivery-summary > strong {
    display: block;
    color: #1e3a8a;
    font-size: 12px;
    margin-bottom: 7px;
}
.rrv3-item-delivery-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    padding: 7px 8px;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: #ffffff;
    margin-top: 6px;
}
.rrv3-item-delivery-chip > span {
    font-weight: 900;
    color: #0f172a;
}
.rrv3-item-delivery-chip small {
    color: #475569;
    font-weight: 750;
}
@media (max-width: 640px) {
    .rrv3-item-delivery-chip .rrv3-button {
        width: 100%;
        justify-content: center;
    }
}

/* Delivery nested tabs - scoped so they do not interfere with main dashboard tabs */
.rrv3-delivery-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--rr-border, #dbe3ef);
    margin-bottom: 0;
    gap: 2px;
}
.rrv3-delivery-tab-button {
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--rr-text-muted, #64748b);
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
    margin-bottom: -1px;
    border-radius: 7px 7px 0 0;
}
.rrv3-delivery-tab-button:hover {
    color: var(--rr-text, #0f172a);
    background-color: var(--rr-bg, #f8fafc);
}
.rrv3-delivery-tab-button.active {
    color: var(--rr-blue, #2563eb);
    border-bottom-color: var(--rr-blue, #2563eb);
    background-color: var(--rr-white, #ffffff);
    font-weight: 800;
}
.rrv3-delivery-tab-content {
    display: none;
    animation: fadeIn 0.35s;
    background-color: var(--rr-white, #ffffff);
    border: 1px solid var(--rr-border, #dbe3ef);
    border-top: none;
    padding: 20px 22px;
    border-radius: 0 0 var(--rr-radius-lg, 14px) var(--rr-radius-lg, 14px);
}
.rrv3-delivery-tab-content.active {
    display: block;
}

/* Auto-created delivery task panel after PET/Purchasing actions */
.rrv3-delivery-auto-created-panel {
    border-left: 4px solid #16a34a;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 78%);
}
.rrv3-delivery-auto-created-panel h3 {
    margin-top: 0;
    color: #166534;
}
.rrv3-delivery-auto-created-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
@media (max-width: 640px) {
    .rrv3-delivery-auto-created-actions .rrv3-button {
        width: 100%;
        justify-content: center;
    }
}

/* Delivery issue alert cards on PET/Purchasing dashboards */
.rrv3-delivery-issue-alert-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 12px 0 16px;
    padding: 14px 16px;
    border: 1px solid #fecaca;
    border-left: 5px solid #dc2626;
    border-radius: 16px;
    background: #fff7ed;
    box-shadow: 0 8px 20px rgba(220, 38, 38, .08);
}
.rrv3-delivery-issue-alert-card strong {
    display: block;
    color: #991b1b;
    font-size: 16px;
}
.rrv3-delivery-issue-alert-card p {
    margin: 4px 0 0;
    color: #7c2d12;
    font-weight: 700;
}
@media (max-width: 720px) {
    .rrv3-delivery-issue-alert-card {
        flex-direction: column;
        align-items: stretch;
    }
    .rrv3-delivery-issue-alert-card .rrv3-button {
        width: 100%;
        justify-content: center;
    }
}

/* Requester dashboard delivery summary badge */
.rrv3-delivery-summary-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11.5px;
    font-weight: 850;
    line-height: 1.15;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    white-space: nowrap;
}
.delivery-summary-not-started {
    background: #f8fafc;
    color: #64748b;
    border-color: #cbd5e1;
}
.delivery-summary-pending,
.delivery-summary-in-delivery {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}
.delivery-summary-in-transit {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}
.delivery-summary-pending-confirmation {
    background: #fef3c7;
    color: #92400e;
    border-color: #f59e0b;
}
.delivery-summary-received {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}
.delivery-summary-issue {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

/* Delivery task edit mode */
.rrv3-delivery-edit-section {
    border-left: 4px solid #2563eb;
}
.rrv3-delivery-edit-section summary {
    cursor: pointer;
    font-weight: 900;
    color: #1e3a8a;
    list-style: none;
}
.rrv3-delivery-edit-section summary::-webkit-details-marker {
    display: none;
}
.rrv3-delivery-edit-section summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 7px;
    transition: transform .18s ease;
}
.rrv3-delivery-edit-section[open] summary::before {
    transform: rotate(90deg);
}
.rrv3-delivery-edit-body {
    margin-top: 14px;
}
