:root {
    --page-bg: #f4f7fb;
    --panel-bg: #ffffff;
    --panel-border: #d7e1ec;
    --brand: #0b5d7a;
    --brand-dark: #083d50;
    --text: #1f2933;
    --muted: #637381;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(27, 151, 168, 0.15), transparent 28%),
        linear-gradient(180deg, #eaf6f8 0%, #f9fbfd 100%);
    color: var(--text);
}

.page-shell {
    max-width: 1320px;
    margin: 0 auto;
    padding: 24px 16px 32px;
    position: relative;
}

.hero-banner {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
    gap: 24px;
    padding: 24px clamp(18px, 3vw, 36px);
    margin-bottom: 18px;
    border-radius: 28px;
    background: linear-gradient(135deg, #0d778a 0%, #0b6879 54%, #09525e 100%);
    color: #fff;
    box-shadow: 0 24px 48px rgba(5, 53, 62, 0.22);
    overflow: hidden;
    position: relative;
}

.hero-banner::before,
.hero-banner::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.hero-banner::before {
    width: 260px;
    height: 260px;
    top: -90px;
    right: 15%;
}

.hero-banner::after {
    width: 180px;
    height: 180px;
    bottom: -80px;
    right: -40px;
}

.hero-copy,
.hero-sidecard {
    position: relative;
    z-index: 1;
}

.hero-version-badge {
    position: absolute;
    top: 14px;
    right: 16px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    backdrop-filter: blur(6px);
}

.hero-logo {
    display: block;
    width: min(180px, 34vw);
    max-width: 100%;
    margin-bottom: 14px;
}

.hero-kicker {
    display: inline-block;
    margin-bottom: 10px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-title {
    margin: 0 0 10px;
    font-size: clamp(1.65rem, 3.2vw, 2.8rem);
    line-height: 1.02;
    font-weight: 800;
    max-width: 23ch;
}

.hero-description {
    max-width: 62ch;
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.btn-hero-primary,
.btn-hero-secondary {
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
    border-width: 0;
}

.btn-hero-primary {
    background: #d4de46;
    color: #15414b;
    box-shadow: 0 10px 20px rgba(12, 49, 56, 0.18);
}

.btn-hero-primary:hover,
.btn-hero-primary:focus {
    background: #e0ea58;
    color: #15414b;
}

.btn-hero-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.btn-hero-secondary:hover,
.btn-hero-secondary:focus {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.hero-sidecard {
    align-self: end;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px);
}

.hero-sidecard-title {
    margin-bottom: 10px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.76);
}

.hero-step {
    padding: 9px 0;
    font-size: 0.92rem;
    line-height: 1.4;
}

.hero-step + .hero-step {
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.page-header {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.page-title {
    margin: 0;
    font-size: clamp(1.6rem, 2vw, 2.4rem);
    color: var(--brand-dark);
}

.page-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.status-card,
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    box-shadow: 0 10px 24px rgba(15, 40, 60, 0.06);
}

.status-card {
    min-width: 0;
    padding: 6px 10px;
    border-radius: 999px;
    box-shadow: 0 8px 18px rgba(15, 40, 60, 0.08);
}

.status-label {
    display: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 6px;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--muted);
}

#status-indicator {
    font-size: 0.62rem;
    padding: 0.28rem 0.42rem;
}

#status-text {
    line-height: 1;
}

.panel {
    padding: 16px;
    margin-bottom: 16px;
}

.consulta-filters-panel {
    padding: clamp(18px, 2vw, 24px);
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, #0b687940, transparent 24%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 249, 252, 0.98) 100%);
    box-shadow:
        0 18px 32px rgba(15, 40, 60, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.consulta-filters-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.consulta-filters-kicker {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(11, 93, 122, 0.1);
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.consulta-filters-title {
    margin: 10px 0 6px;
    font-size: clamp(1.25rem, 2.2vw, 1.9rem);
    line-height: 1.1;
    color: var(--brand-dark);
}

.consulta-filters-subtitle {
    margin: 0;
    max-width: 62ch;
    color: var(--muted);
    line-height: 1.55;
}

.consulta-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    align-items: stretch;
}

.consulta-filter-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(11, 93, 122, 0.1);
    box-shadow: 0 8px 18px rgba(15, 40, 60, 0.04);
}

.consulta-filter-label {
    margin: 0;
    color: var(--brand-dark);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.consulta-filter-label-hidden {
    visibility: hidden;
}

.consulta-filter-inputwrap,
.consulta-filter-inputgroup {
    display: flex;
    align-items: center;
    min-height: 54px;
    border-radius: 16px;
    border: 1px solid #d8e5ee;
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(15, 40, 60, 0.04);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.consulta-filter-inputwrap:focus-within,
.consulta-filter-inputgroup:focus-within {
    border-color: rgba(11, 93, 122, 0.45);
    box-shadow: 0 0 0 4px rgba(11, 93, 122, 0.1);
    transform: translateY(-1px);
}

.consulta-filter-input {
    border: 0;
    min-height: 54px;
    padding: 0 16px;
    font-size: 1rem;
    color: var(--text);
    background: transparent;
}

.consulta-filter-input:focus {
    box-shadow: none;
    background: transparent;
}

.consulta-filter-input::placeholder {
    color: #8aa0b2;
}

.consulta-filter-iconbtn {
    border: 0;
    border-left: 1px solid #d8e5ee;
    min-width: 56px;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #f9fcfe 0%, #eef5f9 100%);
    color: var(--brand);
    font-size: 1.1rem;
}

.consulta-filter-iconbtn:hover,
.consulta-filter-iconbtn:focus {
    background: linear-gradient(180deg, #eef7fb 0%, #e1eef5 100%);
    color: var(--brand-dark);
}

.consulta-filters-search {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
}

.consulta-filters-submit {
    width: 100%;
    min-height: 82px;
    border: 0;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #0f7e91 0%, #0b6879 54%, #084d58 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: 0 18px 28px rgba(11, 93, 122, 0.2);
}

.consulta-filters-submit:hover,
.consulta-filters-submit:focus {
    color: #fff;
    background: linear-gradient(135deg, #1291a5 0%, #0c7487 54%, #095762 100%);
}

@media (min-width: 1180px) {
    .consulta-filters-grid {
        grid-template-columns: minmax(120px, 0.75fr) minmax(130px, 0.8fr) minmax(185px, 1fr) minmax(185px, 1fr) minmax(120px, 0.72fr) minmax(140px, 0.82fr);
        gap: 12px;
    }

    .consulta-filter-card {
        min-width: 0;
        padding: 11px;
    }

    .consulta-filter-input {
        padding: 0 12px;
        font-size: 0.94rem;
    }

    .consulta-filters-submit {
        min-height: 76px;
        padding: 12px;
        font-size: 0.94rem;
    }
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.filters-search-action {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.form-label-hidden {
    visibility: hidden;
}

.btn-search-inline {
    width: 100%;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #0d778a 0%, #0b6879 54%, #09525e 100%);
    color: white;
}

.scanner-shell {
    position: relative;
    display: flex;
    justify-content: center;
    min-height: 0;
}

.scanner-shell-hidden {
    display: none;
}

#qr-reader {
    width: 100%;
    max-width: 768px;
    overflow: hidden;
    border-radius: 16px;
}

.scanner-actions {
    position: absolute;
    inset: 12px 12px auto 12px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.scanner-actions button {
    pointer-events: auto;
}

.results-summary {
    color: var(--muted);
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 12px;
}

.consulta-overview {
    padding: 18px 20px;
}

.overview-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.overview-kicker {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(11, 93, 122, 0.1);
    color: var(--brand);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.overview-title {
    margin: 10px 0 4px;
    font-size: clamp(1.4rem, 2vw, 2rem);
    color: var(--brand-dark);
}

.overview-description {
    margin: 0;
    color: var(--muted);
}

.overview-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.overview-pill {
    min-width: 120px;
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, #f7fbfd 0%, #edf5fb 100%);
    border: 1px solid #d7e5ef;
}

.overview-pill-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.78rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.overview-pill strong {
    font-size: 1.25rem;
    color: var(--brand-dark);
}

.results-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.results-stack .etiqueta-list {
    border: 1px solid #dce6ef;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 40, 60, 0.06);
    overflow: hidden;
}

.etiqueta-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.etiqueta-item + .etiqueta-item {
    border-top: 1px solid #e8eff5;
}

.etiqueta-item-match {
    animation: embalagemMatchFade 5s ease-out;
}

@keyframes embalagemMatchFade {
    0% {
        background: rgba(13, 119, 138, 0.2);
        box-shadow: inset 0 0 0 2px rgba(11, 104, 121, 0.48);
    }

    18% {
        background: rgba(13, 119, 138, 0.17);
        box-shadow: inset 0 0 0 2px rgba(11, 104, 121, 0.4);
    }

    38% {
        background: rgba(13, 119, 138, 0.13);
        box-shadow: inset 0 0 0 2px rgba(11, 104, 121, 0.3);
    }

    62% {
        background: rgba(13, 119, 138, 0.09);
        box-shadow: inset 0 0 0 2px rgba(11, 104, 121, 0.2);
    }

    82% {
        background: rgba(13, 119, 138, 0.04);
        box-shadow: inset 0 0 0 1px rgba(11, 104, 121, 0.1);
    }

    100% {
        background: #ffffff;
        box-shadow: inset 0 0 0 0 rgba(11, 104, 121, 0);
    }
}

.etiqueta-item-empty .etiqueta-header {
    justify-content: center;
    color: var(--muted);
}

.etiqueta-empty-state {
    padding: 28px 20px;
    text-align: center;
    color: var(--muted);
}

.etiqueta-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    flex-wrap: wrap;
}

.etiqueta-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.etiqueta-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 104px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(11, 93, 122, 0.09);
    color: var(--brand-dark);
    font-weight: 800;
    letter-spacing: 0.03em;
}

.etiqueta-id {
    color: var(--muted);
    font-size: 0.92rem;
}

.etiqueta-kits {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #eef7d7;
    color: #475514;
    font-weight: 700;
}

.produtos-list {
    list-style: none;
    margin: 0;
    padding: 0 20px 18px 20px;
    display: grid;
    gap: 10px;
}

.produto-item {
    display: grid;
    grid-template-columns: minmax(96px, 120px) minmax(0, 1fr);
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: #f9fbfd;
    border: 1px solid #e4edf4;
}

.produto-item-match {
    animation: produtoMatchFade 5s ease-out;
}

@keyframes produtoMatchFade {
    0% {
        background: rgba(13, 119, 138, 0.18);
        border-color: rgba(11, 104, 121, 0.5);
        box-shadow: 0 0 0 3px rgba(11, 104, 121, 0.24);
    }

    16% {
        background: rgba(13, 119, 138, 0.15);
        border-color: rgba(11, 104, 121, 0.42);
        box-shadow: 0 0 0 4px rgba(11, 104, 121, 0.18);
    }

    34% {
        background: rgba(13, 119, 138, 0.12);
        border-color: rgba(11, 104, 121, 0.32);
        box-shadow: 0 0 0 3px rgba(11, 104, 121, 0.14);
    }

    56% {
        background: rgba(13, 119, 138, 0.08);
        border-color: rgba(11, 104, 121, 0.22);
        box-shadow: 0 0 0 2px rgba(11, 104, 121, 0.1);
    }

    78% {
        background: rgba(13, 119, 138, 0.04);
        border-color: rgba(11, 104, 121, 0.12);
        box-shadow: 0 0 0 1px rgba(11, 104, 121, 0.06);
    }

    100% {
        background: #f9fbfd;
        border-color: #e4edf4;
        box-shadow: 0 0 0 0 rgba(11, 104, 121, 0);
    }
}

.produto-code {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.produto-details {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.produto-description {
    color: var(--text);
    line-height: 1.5;
    flex: 1 1 320px;
}

.produto-quantity {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef3f7;
}

.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar .btn-primary {
    min-width: 220px;
}

#loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(4, 24, 36, 0.45);
    z-index: 9999;
}

#toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
}

@media (max-width: 768px) {
    .hero-banner {
        grid-template-columns: 1fr;
        padding: 18px 16px;
    }

    .hero-version-badge {
        top: 10px;
        right: 10px;
        padding: 5px 8px;
        font-size: 0.72rem;
    }

    .hero-title {
        max-width: none;
        font-size: clamp(1.6rem, 8vw, 2.3rem);
    }

    .hero-description {
        font-size: 0.92rem;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .page-header {
        justify-content: flex-end;
    }

    .status-card {
        max-width: max-content;
        margin-left: auto;
    }

    .toolbar .btn-primary {
        width: 100%;
        min-width: 0;
    }

    .filters-search-action {
        grid-column: 1 / -1;
    }

    .consulta-filters-panel {
        padding: 16px;
        border-radius: 20px;
    }

    .consulta-filters-head {
        margin-bottom: 14px;
    }

    .consulta-filters-subtitle {
        font-size: 0.94rem;
    }

    .consulta-filters-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .consulta-filter-card {
        padding: 12px;
        border-radius: 16px;
    }

    .consulta-filters-submit {
        min-height: 58px;
        border-radius: 16px;
    }

    .overview-shell {
        align-items: flex-start;
    }

    .overview-totals {
        width: 100%;
    }

    .overview-pill {
        flex: 1 1 110px;
    }

    .etiqueta-header,
    .produtos-list {
        padding-left: 16px;
        padding-right: 16px;
    }

    .produto-item {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .produto-details {
        align-items: flex-start;
    }
}