.romaneios-hero {
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-soft) 100%);
    color: var(--text-primary);
}

.romaneios-hero p {
    color: var(--text-secondary);
}

.romaneio-builder-layout {
    margin-top: 20px;
}

#romaneios {
    padding-bottom: 96px;
}

.romaneios-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.romaneio-summary-card {
    padding: 18px;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 30px -24px rgba(15, 23, 42, .35);
}

.romaneio-summary-card span,
.romaneio-summary-card small {
    display: block;
    color: var(--text-secondary);
    font-size: .82rem;
}

.romaneio-summary-card strong {
    display: block;
    margin: 7px 0 4px;
    color: var(--text-primary);
    font-size: 1.7rem;
}

.romaneio-summary-card.warning strong {
    color: #d97706;
}

.romaneio-summary-card.success strong {
    color: #16a34a;
}

.romaneio-summary-card.primary strong {
    color: var(--accent);
}

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

.romaneios-history {
    margin-bottom: 96px;
}

.romaneios-history .history-filters .form-control {
    width: 220px;
    height: 40px;
    border-radius: 999px;
    font-weight: 700;
}

.romaneio-form-grid {
    align-items: start;
}

.romaneio-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 10px;
    align-items: stretch;
}

.romaneio-picker-add {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
}

.romaneio-picker-add i {
    font-size: 1.16rem;
}

.romaneio-choice-accordion {
    display: grid;
    gap: 6px;
}

.romaneio-choice-accordion details {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fff;
}

.romaneio-choice-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    padding: 0 12px;
    color: var(--text-primary);
    font-size: .86rem;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}

.romaneio-choice-accordion summary::-webkit-details-marker {
    display: none;
}

.romaneio-choice-accordion summary i {
    transition: transform .18s ease;
}

.romaneio-choice-accordion details[open] summary i {
    transform: rotate(180deg);
}

.romaneio-choice-options {
    display: grid;
    gap: 0;
    padding: 4px 0;
    border-top: 1px solid var(--border-light);
}

.romaneio-choice-options button {
    min-height: 38px;
    padding: 8px 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #334155;
    font-size: .84rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.romaneio-choice-options button:hover,
.romaneio-choice-options button.active {
    background: #eff6ff;
    color: #2563eb;
}

.romaneio-choice-custom {
    min-height: 40px;
}

.romaneio-side-card .side-total strong {
    font-size: 2rem;
}

.romaneio-hero-actions {
    position: fixed;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 1100;
    width: fit-content;
    max-width: calc(100vw - 28px);
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    align-self: center;
    justify-content: center;
    margin: 0;
    padding: 7px;
    border: 1px solid rgba(203, 213, 225, .8);
    border-radius: 16px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 18px 44px -32px rgba(15, 23, 42, .72), inset 0 1px 0 rgba(255, 255, 255, .9);
    backdrop-filter: blur(16px);
    transform: translateX(-50%);
}

.romaneio-hero-actions .budget-hero-action {
    position: relative;
    height: 38px;
    min-height: 38px;
    padding: 0 13px 0 10px;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: .84rem;
    font-weight: 850;
    white-space: nowrap;
    box-shadow: none;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
}

.romaneio-hero-actions .budget-hero-action i {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    font-size: 1.05rem;
    background: rgba(255, 255, 255, .76);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
}

.romaneio-hero-actions .budget-hero-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px -20px rgba(15, 23, 42, .62);
}

.romaneio-hero-actions .budget-hero-action:active {
    transform: translateY(0);
    box-shadow: none;
}

.romaneio-hero-actions #novo-romaneio {
    color: #075985;
    background: linear-gradient(180deg, #f0f9ff, #e0f2fe);
    border-color: #bae6fd;
}

.romaneio-hero-actions #preview-romaneio {
    color: #5b21b6;
    background: linear-gradient(180deg, #f5f3ff, #ede9fe);
    border-color: #ddd6fe;
}

.romaneio-hero-actions #salvar-romaneio {
    color: #fff;
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 255, 255, .34), transparent 30%),
        linear-gradient(135deg, #1d4ed8 0%, #2563eb 45%, #06b6d4 100%);
    border-color: rgba(37, 99, 235, .28);
    box-shadow: 0 14px 28px -22px rgba(37, 99, 235, .95), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.romaneio-hero-actions #salvar-romaneio:hover {
    box-shadow: 0 18px 32px -20px rgba(14, 165, 233, .95), inset 0 1px 0 rgba(255, 255, 255, .26);
}

.romaneio-hero-actions #salvar-enviar-romaneio {
    color: #fff;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border-color: rgba(22, 163, 74, .28);
    box-shadow: 0 14px 28px -22px rgba(22, 163, 74, .9);
}

.romaneio-hero-actions #salvar-enviar-romaneio:hover {
    box-shadow: 0 18px 32px -20px rgba(22, 163, 74, .95);
}

.romaneio-hero-actions #salvar-romaneio i,
.romaneio-hero-actions #salvar-enviar-romaneio i {
    color: #fff;
    background: rgba(255, 255, 255, .2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28);
}

.romaneio-card {
    padding: 18px;
    border: 1px solid var(--border-light);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.romaneio-card-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.romaneio-card-header strong {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-size: 1rem;
}

.romaneio-card-header small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
}

.romaneio-volume {
    min-width: 88px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    text-align: center;
    font-weight: 900;
}

.romaneio-volume span {
    display: block;
    color: var(--text-secondary);
    font-size: .68rem;
    text-transform: uppercase;
}

.romaneio-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 10px;
}

.romaneio-meta span,
.romaneio-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 9px;
    border-radius: 999px;
    background: var(--bg-gray);
    color: var(--text-secondary);
    font-size: .78rem;
    font-weight: 800;
}

.romaneio-status.separacao {
    background: #fef3c7;
    color: #b45309;
}

.romaneio-status.transito {
    background: #dbeafe;
    color: #1d4ed8;
}

.romaneio-status.entregue {
    background: #dcfce7;
    color: #15803d;
}

.romaneio-status.cancelado {
    background: #fee2e2;
    color: #dc2626;
}

.romaneio-object {
    margin: 0 0 14px;
    color: var(--text-secondary);
}

.romaneio-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Histórico de romaneios no mesmo padrão visual dos cartões de orçamento. */
#lista-romaneios.romaneios-list {
    display: grid;
    gap: 16px;
}

#lista-romaneios .romaneio-card {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 14px 22px;
    padding: 20px 18px 16px 22px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 18px 46px -38px rgba(15, 23, 42, .55);
    overflow: hidden;
}

#lista-romaneios .romaneio-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #f59e0b;
}

#lista-romaneios .romaneio-card.status-transito::before { background: #2563eb; }
#lista-romaneios .romaneio-card.status-entregue::before { background: #16a34a; }
#lista-romaneios .romaneio-card.status-cancelado::before { background: #ef4444; }

#lista-romaneios .romaneio-card-header {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 16px;
    padding-left: 8px;
}

#lista-romaneios .romaneio-card-header strong { font-size: 1rem; }
#lista-romaneios .romaneio-volume {
    min-height: 76px;
    padding: 16px 18px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eff6ff, #f8fbff);
    color: var(--accent);
    text-align: left;
    box-sizing: border-box;
}

#lista-romaneios .romaneio-volume span { margin-bottom: 5px; font-size: .74rem; font-weight: 700; }
#lista-romaneios .romaneio-meta {
    grid-column: 1;
    margin: 0;
    padding-left: 8px;
    align-content: start;
}

#lista-romaneios .romaneio-meta span { border: 1px solid #dbe3ee; background: linear-gradient(180deg, #fff, #f8fafc); }
#lista-romaneios .romaneio-status.separacao { border-color: #fde68a; }
#lista-romaneios .romaneio-status.transito { border-color: #bfdbfe; }
#lista-romaneios .romaneio-status.entregue { border-color: #bbf7d0; }
#lista-romaneios .romaneio-status.cancelado { border-color: #fecaca; }

#lista-romaneios .romaneio-object {
    grid-column: 1;
    margin: 0 0 0 8px;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #475569;
    font-size: .85rem;
}

#lista-romaneios .romaneio-actions {
    grid-column: 2;
    grid-row: 2 / span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-self: start;
}

#lista-romaneios .romaneio-actions .btn {
    min-width: 0;
    height: 42px;
    padding: 0 10px;
    position: relative;
    overflow: hidden;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
    box-shadow: 0 12px 24px -16px currentColor, 0 1px 0 rgba(255, 255, 255, .34) inset;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

#lista-romaneios .romaneio-actions .btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 58%);
    pointer-events: none;
}

#lista-romaneios .romaneio-actions .btn i { position: relative; z-index: 1; color: #fff; }
#lista-romaneios .romaneio-actions .btn:hover { transform: translateY(-1px); box-shadow: 0 16px 28px -16px currentColor, 0 1px 0 rgba(255, 255, 255, .38) inset; }
#lista-romaneios .romaneio-actions .btn:active { transform: translateY(1px) scale(.96); filter: saturate(1.08); }
#lista-romaneios .romaneio-actions .btn-primary { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
#lista-romaneios .romaneio-actions .btn-whatsapp { background: linear-gradient(135deg, #16a34a, #22c55e); }
#lista-romaneios .romaneio-actions .btn-secondary { background: linear-gradient(135deg, #64748b, #94a3b8); }
#lista-romaneios .romaneio-actions .btn-secondary:nth-of-type(3) { background: linear-gradient(135deg, #7c3aed, #a855f7); }
#lista-romaneios .romaneio-actions .btn-danger { grid-column: 1 / -1; }
#lista-romaneios .romaneio-actions .btn-danger { background: linear-gradient(135deg, #dc2626, #ef4444); }

.romaneio-mobile-actionbar { display: none; }

@media (max-width: 760px) {
    #lista-romaneios .romaneio-card { grid-template-columns: 1fr; padding: 14px 12px 14px 16px; }
    #lista-romaneios .romaneio-card-header { grid-template-columns: 1fr; padding-left: 6px; }
    #lista-romaneios .romaneio-volume { min-height: auto; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }
    #lista-romaneios .romaneio-volume span { margin: 0; }
    #lista-romaneios .romaneio-meta,
    #lista-romaneios .romaneio-object { grid-column: 1; margin-left: 6px; padding-left: 0; }
    #lista-romaneios .romaneio-object { padding: 12px; }
    #lista-romaneios .romaneio-actions { display: none; }
    #lista-romaneios .romaneio-mobile-actionbar {
        grid-column: 1;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        margin: 4px -12px -14px;
        border-top: 1px solid #e2e8f0;
    }
    #lista-romaneios .romaneio-mobile-actionbar > button,
    #lista-romaneios .romaneio-mobile-more > summary {
        width: 100%;
        min-width: 0;
        height: 58px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 0;
        border: 0;
        border-right: 1px solid #e2e8f0;
        background: #fff;
        color: #0f172a;
        cursor: pointer;
        font-size: .74rem;
        font-weight: 800;
    }
    #lista-romaneios .romaneio-mobile-actionbar > button i,
    #lista-romaneios .romaneio-mobile-more > summary i { color: var(--accent); font-size: 1.28rem; }
    #lista-romaneios .romaneio-mobile-actionbar > button:nth-child(3) i { color: #16a34a; }
    #lista-romaneios .romaneio-mobile-more { position: relative; }
    #lista-romaneios .romaneio-mobile-more > summary { list-style: none; border-right: 0; }
    #lista-romaneios .romaneio-mobile-more > summary::-webkit-details-marker { display: none; }
    #lista-romaneios .romaneio-mobile-more[open] > summary { background: #eff6ff; }
    #lista-romaneios .romaneio-mobile-menu {
        position: absolute;
        z-index: 30;
        right: 6px;
        bottom: calc(100% + 6px);
        display: grid;
        gap: 6px;
        min-width: 180px;
        padding: 8px;
        border: 1px solid #cbd5e1;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 24px 48px -32px rgba(15, 23, 42, .78);
    }
    #lista-romaneios .romaneio-mobile-menu button {
        min-height: 42px;
        display: flex;
        align-items: center;
        gap: 10px;
        border: 0;
        border-radius: 9px;
        background: #f8fafc;
        color: #0f172a;
        cursor: pointer;
        font-weight: 800;
        text-align: left;
        padding: 0 10px;
    }
    #lista-romaneios .romaneio-mobile-menu button i { color: var(--accent); font-size: 1.1rem; }
    #lista-romaneios .romaneio-mobile-menu button.danger,
    #lista-romaneios .romaneio-mobile-menu button.danger i { color: #dc2626; }
}

.romaneio-items-editor {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.romaneio-item-row {
    display: grid;
    grid-template-columns: minmax(180px, 1.3fr) 100px 78px 92px 92px 98px 110px 38px;
    gap: 8px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--bg-gray);
}

.romaneio-item-row label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: .72rem;
    font-weight: 800;
}

.romaneio-item-row .form-control {
    min-height: 38px;
    padding: 9px 10px;
    font-size: .86rem;
}

.romaneio-item-row .custom-select-wrapper .search-icon {
    top: calc(50% + 10px);
}

.romaneio-remove-item {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
}

.romaneio-product-summary { grid-column: 1 / -1; min-width: 0; padding: 10px 12px; display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 11px; border: 1px solid #dfe8f4; border-radius: 11px; background: linear-gradient(145deg, #fff, #f8fbff); box-shadow: 0 9px 22px -22px rgba(15,23,42,.55); }
.romaneio-product-summary.is-empty { display: none; }
.romaneio-product-media { width: 46px; height: 46px; overflow: hidden; display: grid; place-items: center; border-radius: 11px; background: #eaf2ff; color: #1670f8; font-size: 1.25rem; }
.romaneio-product-media img { width: 100%; height: 100%; object-fit: cover; }
.romaneio-product-copy { min-width: 0; display: grid; gap: 4px; }
.romaneio-product-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.romaneio-product-title strong { overflow: hidden; color: #172033; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.romaneio-product-title small { flex: 0 0 auto; padding: 3px 6px; border-radius: 6px; background: #eff6ff; color: #2563eb; font-size: .59rem; font-weight: 800; }
.romaneio-product-copy p { margin: 0; overflow: hidden; color: #64748b; font-size: .67rem; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.romaneio-product-tags { display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.romaneio-product-tags::-webkit-scrollbar { display: none; }
.romaneio-product-tags span { flex: 0 0 auto; padding: 3px 7px; display: inline-flex; align-items: center; gap: 4px; border: 1px solid #e3eaf3; border-radius: 999px; background: #fff; color: #53637a; font-size: .59rem; font-weight: 700; }
.romaneio-product-tags i { color: #1670f8; font-size: .68rem; }

.romaneio-notes-grid {
    margin-top: 18px;
}

@media (max-width: 980px) {
    .romaneios-summary-grid {
        grid-template-columns: 1fr;
    }

    .romaneio-item-row {
        grid-template-columns: 1fr 1fr;
    }

    .romaneios-history .history-filters,
    .romaneios-history .history-filters .form-control {
        width: 100%;
    }
}

@media (max-width: 640px) {
    #romaneios {
        padding-bottom: 92px;
    }

    .romaneio-card-header {
        flex-direction: column;
    }

    .romaneio-item-row {
        grid-template-columns: 1fr;
    }

    .romaneio-hero-actions {
        display: grid;
        grid-template-columns: repeat(4, 44px);
        gap: 10px;
        width: auto;
        max-width: calc(100vw - 28px);
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        margin: 0;
        padding: 9px;
        border: 1px solid rgba(255, 255, 255, .72);
        border-radius: 20px;
        background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(248, 250, 252, .94));
        box-shadow: 0 22px 55px -28px rgba(15, 23, 42, .72), 0 1px 0 rgba(255, 255, 255, .92) inset;
        backdrop-filter: blur(18px);
    }

    .romaneio-hero-actions .budget-hero-action {
        width: 44px;
        min-height: 0;
        height: 44px;
        aspect-ratio: auto;
        position: relative;
        overflow: hidden;
        flex-direction: column;
        gap: 0;
        padding: 0;
        text-align: center;
        white-space: normal;
        color: #fff;
        background: var(--accent);
        border-color: transparent;
        border-width: 0;
        border-radius: 14px;
        font-size: 0;
        box-shadow: 0 12px 24px -16px currentColor, 0 1px 0 rgba(255, 255, 255, .34) inset;
    }

    .romaneio-hero-actions .budget-hero-action::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 58%);
        pointer-events: none;
    }

    .romaneio-hero-actions .budget-hero-action i {
        position: relative;
        z-index: 1;
        width: auto;
        height: auto;
        font-size: 1.18rem;
        line-height: 1;
        color: #fff;
        background: transparent;
        box-shadow: none;
    }

    .romaneio-hero-actions #novo-romaneio {
        color: #fff;
        background: linear-gradient(135deg, #2563eb, #0ea5e9);
    }

    .romaneio-hero-actions #preview-romaneio {
        color: #fff;
        background: linear-gradient(135deg, #7c3aed, #a855f7);
    }

    .romaneio-hero-actions #salvar-romaneio {
        color: #fff;
        background:
            radial-gradient(circle at 18% 18%, rgba(255, 255, 255, .34), transparent 30%),
            linear-gradient(135deg, #1d4ed8 0%, #2563eb 45%, #06b6d4 100%);
    }

    .romaneio-hero-actions #salvar-enviar-romaneio {
        color: #fff;
        background: linear-gradient(135deg, #16a34a, #22c55e);
    }
}

/* Mantém as ações flutuantes acima da navegação inferior no mobile. */
@media (max-width: 768px) {
    #romaneios {
        padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px));
        scroll-padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px));
    }

    .romaneio-hero-actions {
        bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    }
}

/* Editor de itens no mesmo padrão de adição e tabela do orçamento. */
.romaneio-quick-add { align-items: end; margin-bottom: 14px; }
.romaneio-quick-add .rom-item-produto-list { z-index: 80; }
.romaneio-table-wrap { margin-top: 0; }
.romaneio-items-table { min-width: 860px; }
.romaneio-items-table .romaneio-item-row { display: table-row; padding: 0; border: 0; border-radius: 0; background: transparent; }
.romaneio-items-table .romaneio-item-row > td { padding: 11px 9px; vertical-align: middle; }
.romaneio-items-table .romaneio-item-row label { display: none; }
.romaneio-items-table .budget-inline-input { width: 74px; min-height: 34px; padding: 7px 8px; }
.romaneio-items-table td:nth-child(1) { min-width: 250px; }
.romaneio-items-table td:nth-child(2) { min-width: 82px; }
.romaneio-items-table td:last-child { width: 42px; text-align: right; }
.romaneio-table-product-icon { overflow: hidden; }
.romaneio-table-product-icon img { width: 100%; height: 100%; object-fit: cover; }
.romaneio-items-table .budget-table-item small { max-width: 310px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.romaneio-items-table .romaneio-remove-item { width: 34px; min-width: 34px; height: 34px; padding: 0; }

@media (max-width: 700px) {
    .romaneio-quick-add { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .romaneio-quick-add .quick-add-input.flex-fill,
    .romaneio-quick-add .quick-add-btn { grid-column: 1 / -1; width: 100%; }
    .romaneio-quick-add .budget-catalog-picker { grid-template-columns: minmax(0, 1fr) 44px; }
}
