* {
    box-sizing: border-box;
}

:root {
    --bg: #eef2f7;
    --card: #ffffff;
    --card-soft: #f8fafc;
    --text: #152033;
    --muted: #667085;
    --line: #dbe2ea;
    --primary: #ad1a05;
    --primary-dark: #8d1504;
    --secondary: #0f172a;
    --success: #0f9f6e;
    --danger: #d92d20;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
    color: var(--text);
}

body {
    min-height: 100vh;
}

a {
    text-decoration: none;
}

.page-shell {
    max-width: 1560px;
    margin: 0 auto;
    padding: 24px;
}

.page-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #d43f29);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: .08em;
    box-shadow: var(--shadow);
}

.brand-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    min-height: 82px;
    background: #fff;
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(219, 226, 234, 0.7);
}

.brand-logo {
    max-width: 120px;
    max-height: 60px;
    display: block;
    object-fit: contain;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
}

.brand-subtitle {
    color: var(--muted);
    font-size: 13px;
}

.top-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hero-card,
.bloco,
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(219, 226, 234, 0.65);
}

.hero-card {
    padding: 28px;
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.hero-badge {
    display: inline-flex;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(173, 26, 5, 0.1);
    color: var(--primary);
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 10px;
}

.hero-card h1 {
    margin: 0 0 8px 0;
    font-size: 32px;
}

.hero-card p {
    margin: 0;
    color: var(--muted);
    max-width: 760px;
    line-height: 1.5;
}

.hero-steps {
    display: grid;
    gap: 10px;
    min-width: 220px;
}

.step-item {
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--card-soft);
    border: 1px solid var(--line);
    font-weight: 700;
    color: var(--muted);
}

.step-item.active {
    background: rgba(173, 26, 5, 0.08);
    border-color: rgba(173, 26, 5, 0.25);
    color: var(--primary);
}

.layout-grid {
    display: grid;
    grid-template-columns: 420px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.bloco,
.card {
    padding: 22px;
    margin-bottom: 20px;
}

.destaque-bloco {
    border-top: 4px solid var(--primary);
}

.section-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.section-title h2,
.topo-tabela h2,
.empty-panel h2 {
    margin: 0;
    font-size: 22px;
}

.section-tag {
    display: inline-flex;
    padding: 7px 12px;
    border-radius: 999px;
    background: #eef2ff;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.section-tag.success {
    background: rgba(15, 159, 110, 0.12);
    color: var(--success);
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    color: #223046;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    padding: 15px 16px;
    font-size: 16px;
    outline: none;
    color: var(--text);
    transition: .2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: rgba(173, 26, 5, 0.4);
    box-shadow: 0 0 0 4px rgba(173, 26, 5, 0.08);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.bloqueado {
    background: #edf1f5;
    color: #667085;
    cursor: not-allowed;
}

#qrProduto.bloqueado {
    background: #f3f4f6;
    cursor: not-allowed;
}

.status {
    margin-top: 10px;
    min-height: 22px;
    font-weight: 700;
    color: #344054;
    line-height: 1.4;
}

.hidden {
    display: none !important;
}

.grid-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 14px;
}

.info-box {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
}

.info-box span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.info-box strong {
    display: block;
    font-size: 16px;
    color: var(--text);
    line-height: 1.35;
}

.topo-tabela {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.subtle-text,
.empty-panel p,
.modal-text {
    margin: 6px 0 0 0;
    color: var(--muted);
    line-height: 1.5;
}

.empty-panel {
    min-height: 290px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, rgba(173, 26, 5, 0.03), rgba(15, 23, 42, 0.03));
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
    background: #fff;
}

table thead th {
    background: #f8fafc;
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    color: #344054;
    font-size: 14px;
}

table tbody td {
    padding: 13px 12px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
    font-size: 14px;
}

table tbody tr:hover {
    background: #fcfcfd;
}

.btn-principal,
.btn-secundario,
.btn-remover,
.opcao-epc,
.btn-link {
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: 0.2s ease;
    font-weight: 700;
}

.btn-principal {
    background: linear-gradient(135deg, var(--primary), #cf3e27);
    color: #fff;
    padding: 14px 18px;
    font-size: 15px;
    box-shadow: 0 12px 25px rgba(173, 26, 5, 0.18);
}

.btn-principal:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--primary-dark), #c3321b);
}

.btn-secundario,
.btn-link {
    background: #111827;
    color: #fff;
    padding: 11px 15px;
    font-size: 14px;
}

.btn-secundario:hover,
.btn-link:hover {
    background: #020617;
}

.btn-secundario.ativo-leitura {
    background: #1f2937;
    color: #fff;
    border-color: #1f2937;
    box-shadow: 0 12px 25px rgba(15, 23, 42, 0.18);
}

.btn-remover {
    background: var(--danger);
    color: #fff;
    padding: 9px 12px;
    font-size: 13px;
}

.btn-remover:hover {
    background: #b42318;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.modal-content {
    width: 100%;
    max-width: 620px;
    background: #ffffff;
    border-radius: 22px;
    padding: 26px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(219, 226, 234, 0.7);
}

.modal-content h2 {
    margin: 0 0 6px 0;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.lista-opcoes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.opcao-epc {
    width: 100%;
    text-align: left;
    background: #f9fafb;
    border: 1px solid var(--line);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text);
}

.opcao-epc:hover {
    background: #fff5f3;
    border-color: rgba(173, 26, 5, 0.25);
}

.acoes-finais {
    margin-top: 20px;
    display: grid;
    gap: 12px;
}

.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-row > * {
    flex: 1;
}

.action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.badge-status {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-status.ativo {
    background: rgba(15, 159, 110, 0.12);
    color: var(--success);
}

.badge-status.devolvido {
    background: rgba(217, 45, 32, 0.1);
    color: var(--danger);
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.checkbox-inline input {
    width: auto;
    transform: scale(1.15);
}

.footer-note {
    margin-top: 10px;
    font-size: 13px;
    color: var(--muted);
}

.linha-leitura-produto {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.linha-leitura-produto input {
    flex: 1;
    min-width: 260px;
}

#modalInsercaoManual input,
#modalInsercaoManual select {
    width: 100%;
    margin-bottom: 12px;
}

@media (max-width: 1100px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }

    .hero-card {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-steps {
        min-width: 0;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .page-shell {
        padding: 16px;
    }

    .page-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .grid-info {
        grid-template-columns: 1fr;
    }

    .topo-tabela,
    .modal-buttons,
    .action-row,
    .filter-row,
    .top-actions {
        flex-direction: column;
    }

    .hero-card h1 {
        font-size: 28px;
    }

    .brand-block {
        align-items: flex-start;
    }

    .brand-logo-wrap {
        min-width: 72px;
        min-height: 72px;
    }

    .linha-leitura-produto {
        flex-direction: column;
        align-items: stretch;
    }

    .linha-leitura-produto input {
        min-width: 0;
    }
}
