/* =========================================================
   SISTEMA DE CONTROLE R&M ESTILO E ACESSÓRIOS
   CSS principal
   ========================================================= */

/* ---------- Configurações gerais ---------- */

:root {
    --cor-fundo: #f5f5f5;
    --cor-escura: #222222;
    --cor-menu: #333333;
    --cor-menu-hover: #454545;
    --cor-dourada: #c5a23b;
    --cor-dourada-hover: #d7b84f;
    --cor-texto: #333333;
    --cor-texto-secundario: #737373;
    --cor-borda: #dedbd2;
    --cor-branca: #ffffff;
    --sombra: 0 5px 18px rgb(34 34 34 / 6%);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--cor-fundo);
    color: var(--cor-texto);
    line-height: 1.5;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

/* ---------- Cabeçalho ---------- */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    min-height: 106px;
    padding: 12px 20px;
    position: relative;
    z-index: 10;
    background: var(--cor-escura);
    color: #ffffff;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.site-logo {
    display: block;
    flex: 0 0 auto;
    width: 180px;
    height: 82px;
    padding: 5px 8px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 3px;
}

.site-header h1 {
    margin: 0;
    padding: 0;
    color: #ffffff;
    font-size: 1.5rem;
    line-height: 1.25;
}

.site-header-actions,
.site-header-actions form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
}

.site-header-actions {
    flex-shrink: 0;
}

.site-user {
    color: #f1f1f1;
    font-size: 0.94rem;
}

/* ---------- Botões do cabeçalho ---------- */

.header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid var(--cor-dourada);
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 150ms ease, color 150ms ease;
}

.header-action-login {
    color: #222222;
    background: var(--cor-dourada);
}

.header-action-login:hover {
    color: #171717;
    background: var(--cor-dourada-hover);
}

.header-action-logout {
    color: #f5f5f5;
    background: transparent;
    cursor: pointer;
}

.header-action-logout:hover {
    color: #222222;
    background: var(--cor-dourada);
}

/* ---------- Menu principal ---------- */

nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    position: relative;
    z-index: 9;
    padding: 12px 20px;
    background: var(--cor-menu);
    color: #ffffff;
}

nav a,
nav summary {
    color: #ffffff;
    text-decoration: none;
}

nav .nav-link,
nav .nav-group > summary {
    cursor: pointer;
    list-style: none;
}

.nav-group > summary::marker {
    content: "";
}

.nav-group > summary::-webkit-details-marker {
    display: none;
}

.nav-group > summary::after {
    content: "\25BC";
    display: inline-block;
    margin-left: 6px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.8em;
    line-height: 1;
    color: #ffffff;
    transition: transform 150ms ease;
}

.nav-group[open] > summary::after {
    transform: rotate(180deg);
}

.nav-group {
    position: relative;
}

.nav-submenu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 20;
    display: grid;
    min-width: 210px;
    padding: 6px;
    background: var(--cor-menu);
    border: 1px solid #555555;
    border-radius: 6px;
    box-shadow: 0 8px 18px rgb(0 0 0 / 22%);
}

.nav-submenu a {
    display: block;
    padding: 10px 12px;
    border-radius: 4px;
    white-space: nowrap;
}

.nav-submenu a:hover {
    background: var(--cor-menu-hover);
    text-decoration: none;
}

nav > a:hover,
.nav-submenu a:hover {
    text-decoration: underline;
}

/* ---------- Responsividade ---------- */

@media (max-width: 640px) {
    .site-header {
        flex-wrap: wrap;
        gap: 12px;
        padding: 10px 14px;
    }

    .site-brand {
        gap: 12px;
    }

    .site-logo {
        width: 145px;
        height: 66px;
    }

    .site-header h1 {
        font-size: 1.35rem;
    }

    .site-header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    nav {
        gap: 10px 16px;
        padding: 12px 14px;
    }
}

@media (max-width: 380px) {
    .site-brand {
        gap: 9px;
    }

    .site-logo {
        width: 112px;
        height: 52px;
    }

    .site-header h1 {
        font-size: 1.08rem;
    }
}

/* ---------- Linha separadora ---------- */

hr {
    display: none;
}

/* ---------- Conteúdo principal ---------- */

main {
    position: relative;
    isolation: isolate;
    z-index: 0;
    flex: 1 0 auto;
    width: 100%;
    min-width: 0;
    padding: 30px;
}

main::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: url("../marca_dagua.jpg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.04;
}

main > * {
    position: relative;
    z-index: 1;
}

/* ---------- Rodapé ---------- */

.site-footer {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    width: 100%;
    padding: 18px 20px;
    background: var(--cor-escura);
    border-top: 2px solid var(--cor-dourada);
    color: #f1f1f1;
}

.site-footer-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 30px;
    max-width: 1280px;
    margin: 0 auto;
}

.site-footer-version {
    position: absolute;
    right: 20px;
    bottom: 6px;
    color: #d1d1d1;
    font-size: 0.72rem;
    line-height: 1.2;
    white-space: nowrap;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--cor-dourada-hover);
    text-decoration: underline;
}

@media (max-width: 640px) {
    .site-footer {
        padding-bottom: 14px;
    }

    .site-footer-version {
        position: static;
        display: block;
        margin: 10px 0 0 auto;
        text-align: right;
    }
}

/* ---------- Dashboard ---------- */

.dashboard {
    max-width: 1280px;
    margin: 0 auto;
}

.dashboard-heading,
.dashboard-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.dashboard-heading h2,
.dashboard-section-heading h3 {
    margin: 0;
    color: #252525;
}

.dashboard-heading h2 {
    font-size: 1.8rem;
}

.dashboard-heading p,
.dashboard-section-heading p {
    margin: 7px 0 0;
    color: var(--cor-texto-secundario);
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    min-height: 150px;
    padding: 22px 24px;
    background: rgb(255 255 255 / 90%);
    border: 1px solid #e8e5dc;
    border-top: 4px solid #b99318;
    border-radius: 10px;
    box-shadow: var(--sombra);
}

.dashboard-card-label {
    color: #5f5b50;
    font-size: 0.94rem;
    font-weight: 600;
}

.dashboard-card-value {
    margin-top: 16px;
    color: #252525;
    font-size: 2.35rem;
    line-height: 1;
}

.dashboard-card-detail {
    margin-top: 9px;
    color: #818181;
    font-size: 0.85rem;
}

.dashboard-activity {
    padding: 24px;
    background: rgb(255 255 255 / 90%);
    border: 1px solid #e8e5dc;
    border-radius: 10px;
    box-shadow: var(--sombra);
}

.dashboard-section-heading {
    margin-bottom: 18px;
}

.dashboard-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.dashboard-table {
    min-width: 720px;
}

.dashboard-table th {
    color: #4d493e;
    background: #f4f1e8;
    font-size: 0.84rem;
    white-space: nowrap;
}

.dashboard-table td {
    font-size: 0.92rem;
}

.movement-type {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.movement-type-entrada {
    color: #24633b;
    background: #e7f3e9;
}

.movement-type-saida {
    color: #8a3732;
    background: #f8e9e7;
}

.dashboard-empty {
    padding: 28px;
    color: var(--cor-texto-secundario);
    text-align: center;
}

/* ---------- Área de clientes ---------- */

.clients-page,
.client-form-page,
.client-detail-page {
    max-width: 1150px;
    margin: 0 auto;
}

.client-page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 22px;
}

.client-page-heading h2,
.client-detail-page h2 {
    margin: 0;
}

.client-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--cor-dourada);
    border-radius: 6px;
    background: var(--cor-dourada);
    color: #222222;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.client-button:hover {
    background: var(--cor-dourada-hover);
}

.client-button-secondary {
    border-color: #777777;
    background: #555555;
    color: #ffffff;
}

.client-button-secondary:hover {
    background: #666666;
}

.client-button-danger {
    border-color: #c52222;
    background: #c52222;
    color: #ffffff;
}

.client-button-danger:hover {
    background: #a91c1c;
}

.client-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border-radius: 8px;
}

.client-message {
    margin: 0 0 16px;
    padding: 11px 14px;
    border-radius: 6px;
}

.client-message-success {
    border: 1px solid #8ab795;
    background: #edf7ef;
    color: #245b31;
}

.client-message-error {
    border: 1px solid #d79a9a;
    background: #fff0f0;
    color: #812525;
}

.client-message-warning {
    border: 1px solid #d8c77e;
    background: #fff9de;
    color: #5d4d13;
}

.client-table {
    width: 100%;
    min-width: 720px;
}

.client-actions,
.client-page-actions,
.catalog-page-actions,
.catalog-form-page .client-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ---------- Formulários ---------- */

.client-form-card,
.client-detail-card {
    padding: 24px;
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    background: rgb(255 255 255 / 92%);
    color: #333333;
}

.client-form-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.client-form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.client-form-field-wide {
    grid-column: 1 / -1;
}

.client-form-field label {
    color: #353228;
    font-weight: 600;
}

.client-form-control {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #cfcfcf;
    border-radius: 5px;
    background: #ffffff;
    color: #333333;
}

textarea.client-form-control {
    min-height: 105px;
    resize: vertical;
}

.client-field-error,
.client-form-errors {
    color: #a32222;
}

.client-field-error {
    margin: 0;
    font-size: 0.9rem;
}

.client-form-errors {
    margin: 0 0 18px;
    padding-left: 20px;
}

.client-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.client-detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 28px;
    margin: 22px 0;
}

.client-detail-item {
    margin: 0;
    overflow-wrap: anywhere;
}

.client-detail-item dt {
    margin-bottom: 5px;
    color: #6b665b;
    font-size: 0.9rem;
    font-weight: 600;
}

.client-detail-item dd {
    margin: 0;
}

/* ---------- Produtos e catálogo ---------- */

.movement-page,
.movement-form-page {
    max-width: 1150px;
    margin: 0 auto;
}

.catalog-page-heading,
.movement-page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.catalog-page-heading h2,
.movement-page-heading h2 {
    margin: 0;
}

.catalog-page-heading p,
.movement-page-heading p {
    margin-bottom: 0;
}

.catalog-form-page {
    max-width: 880px;
    margin: 0 auto;
}

.catalog-form-page .client-form-card {
    margin: 0;
}

.catalog-table {
    margin-bottom: 18px;
}

.catalog-results-summary {
    margin: 0 0 10px;
    color: #6b665b;
    font-size: 0.92rem;
}

.catalog-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.catalog-pagination > span {
    padding: 0 6px;
    font-weight: 600;
}

.movement-page-heading {
    margin-bottom: 22px;
}

.movement-history-table {
    min-width: 760px;
}

.movement-form-page .client-form-card {
    max-width: 880px;
}

.movement-form-page small {
    color: #6b665b;
}

/* ---------- Operação de vendas ---------- */

.sale-page {
    max-width: 1250px;
    margin: 0 auto;
}

.sale-page .client-detail-card {
    margin-bottom: 18px;
}

.sale-client-card h3,
.sale-cart-card h3 {
    margin-top: 0;
}

.sale-client-search {
    max-width: 560px;
}

.sale-client-search label,
.sale-client-card > label,
.sale-scan-form > label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
}

.sale-client-results {
    display: grid;
    gap: 5px;
    margin-top: 6px;
}

.product-lookup-page > h2 {
    margin-bottom: 18px;
}

.product-lookup-card {
    margin-bottom: 18px;
}

.product-lookup-card label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.product-lookup-results {
    display: grid;
    gap: 5px;
    margin-top: 6px;
}

.product-lookup-option {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--cor-borda);
    border-radius: 5px;
    background: #ffffff;
    color: #333333;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.product-lookup-option:hover,
.product-lookup-option:focus-visible {
    border-color: var(--cor-dourada);
    background: #f5f0e2;
}

.product-lookup-status:empty {
    display: none;
}

.product-lookup-status {
    margin: 8px 0 0;
}

.sale-client-result {
    padding: 9px 11px;
    border: 1px solid var(--cor-borda);
    border-radius: 5px;
    background: #ffffff;
    color: #333333;
    text-align: left;
    cursor: pointer;
}

.sale-client-result:hover {
    background: #f5f0e2;
}

.sale-new-client-toggle {
    margin-top: 12px;
}

.sale-quick-client {
    margin-top: 16px;
    background: rgb(255 255 255 / 96%);
}

.is-hidden {
    display: none !important;
}

.sale-scan-row,
.sale-quantity-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sale-scan-row input {
    max-width: 620px;
}

.sale-scan-form small {
    display: block;
    margin-top: 8px;
    color: #625f58;
}

.sale-cart-table {
    min-width: 980px;
}

.sale-quantity-form input {
    width: 85px;
}

.sale-total {
    margin: 20px 0 12px;
    font-size: 1.3rem;
    font-weight: 700;
}

.sale-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 14px 22px;
    max-width: 720px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #ece9e0;
}

.sale-summary > p {
    margin: 0;
}

.report-screen-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1cm;
    margin-bottom: 16px;
}

/* ---------- Tabelas gerais ---------- */

table {
    width: 100%;
    border-collapse: collapse;
    background: rgb(255 255 255 / 96%);
}

th,
td {
    padding: 12px;
    border: 1px solid #dddddd;
    text-align: left;
    vertical-align: top;
}

th {
    background: #eeeeee;
}

button {
    padding: 8px 15px;
}

input,
select,
textarea {
    max-width: 100%;
}

:focus-visible {
    outline: 2px solid #98770d;
    outline-offset: 2px;
}

/* ---------- Responsividade ---------- */

@media (max-width: 900px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 850px) {
    .manual-date-filter,
    .sales-report-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reports-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sales-report-filter .manual-date-filter button {
        justify-self: start;
    }
}

@media (max-width: 760px) {
    nav {
        align-items: stretch;
        gap: 4px;
    }

    nav .nav-link,
    nav .nav-group {
        flex: 1 1 calc(50% - 8px);
    }

    nav .nav-group > summary {
        width: 100%;
        box-sizing: border-box;
    }

    .nav-submenu {
        position: absolute;
        width: 100%;
        min-width: 0;
        margin-top: 4px;
        box-shadow: none;
    }

    .nav-submenu a {
        white-space: normal;
    }
}

@media (max-width: 650px) {
    .movement-page-heading,
    .catalog-page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .sale-scan-row,
    .sale-quantity-form {
        align-items: stretch;
        flex-direction: column;
    }

    .sale-scan-row .client-button,
    .sale-quantity-form .client-button {
        align-self: flex-start;
    }

    .sale-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .sale-confirmed-totals {
        margin-left: 0;
        text-align: left;
    }

    .client-page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .client-form-card,
    .client-detail-card {
        padding: 18px 14px;
    }

    .client-form-fields,
    .client-detail-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .client-form-field-wide {
        grid-column: auto;
    }
}

@media (max-width: 640px) {
    .site-header {
        gap: 12px;
        padding: 10px 14px;
    }

    .site-brand {
        gap: 12px;
    }

    .site-logo {
        width: 145px;
        height: 66px;
    }

    .site-header h1 {
        font-size: 1.25rem;
    }

    .site-header-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 600px) {
    main {
        padding: 20px 14px;
    }

    .dashboard-cards,
    .reports-card-grid,
    .manual-date-filter,
    .sales-report-filter {
        grid-template-columns: minmax(0, 1fr);
    }

    .dashboard-cards {
        gap: 12px;
    }

    .dashboard-card {
        min-height: 130px;
        padding: 18px 20px;
    }

    .dashboard-activity {
        padding: 18px 14px;
    }

    .movement-report-filters {
        padding: 16px 14px;
    }

    .manual-date-filter button {
        justify-self: start;
    }

    .sales-report-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .sales-report-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .site-footer {
        padding: 16px 14px;
    }

    .site-footer-content {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        text-align: center;
    }
}

@media (max-width: 420px) {
    nav .nav-link,
    nav .nav-group {
        flex-basis: 100%;
    }
}

@media (max-width: 380px) {
    .site-brand {
        gap: 9px;
    }

    .site-logo {
        width: 112px;
        height: 52px;
    }

    .site-header h1 {
        font-size: 1.08rem;
    }
}

/* =========================================================
   IMPRESSÃO: etiquetas de produtos
   ========================================================= */

@media print {
    @page {
        size: A4 portrait;
        margin: 8mm;
    }

    body {
        display: block;
        margin: 0;
        background: #ffffff !important;
        color: #111111 !important;
    }

    .site-header,
    body > nav,
    .site-footer,
    .product-label-print,
    .bulk-label-print-controls,
    hr,
    .no-print {
        display: none !important;
    }

    main {
        width: 100%;
        padding: 0 !important;
        background: #ffffff !important;
    }

    main::before {
        display: none !important;
    }

    main > * {
        position: static;
        z-index: auto;
    }

    .product-label-page {
        max-width: none;
        margin: 0;
    }

    .product-label {
        width: 31.28mm;
        height: 6mm;
        margin: 0 auto;
        border: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .product-label img {
        display: block;
        width: auto;
        height: 6mm;
        max-width: 31.28mm;
        object-fit: contain;
    }

    .bulk-label-sheets {
        display: block;
    }

    .bulk-label-sheet {
        width: 198mm;
        height: 270mm;
        margin: 0 auto;
        background: #ffffff;
        break-inside: avoid;
        page-break-inside: avoid;
        break-after: page;
        page-break-after: always;
    }

    .bulk-label-sheet-last {
        break-after: auto;
        page-break-after: auto;
    }
}

/* =========================================================
   IMPRESSÃO: relatórios
   ========================================================= */

@media print {
    @page {
        size: A4 landscape;
        margin: 1.5cm;
    }

    body {
        display: block;
        margin: 0;
        background: #ffffff !important;
        color: #111111 !important;
        font-size: 10pt;
    }

    .site-header,
    body > nav,
    .site-footer,
    .no-print,
    .report-screen-actions,
    .sales-report-pagination,
    .sales-report-heading,
    .movement-report-filters,
    .quick-period-buttons,
    .manual-date-filter,
    hr {
        display: none !important;
    }

    main {
        width: 100%;
        padding: 0 !important;
        background: #ffffff !important;
    }

    main::before {
        display: none !important;
    }

    main > * {
        position: static;
        z-index: auto;
    }

    .report-print-header {
        display: flex !important;
        align-items: center;
        gap: 12mm;
        padding-bottom: 5mm;
        margin-bottom: 5mm;
        border-bottom: 1px solid #999999;
        break-inside: avoid;
    }

    .report-print-header img {
        display: block;
        width: 38mm;
        height: 22mm;
        object-fit: contain;
    }

    .report-print-header h1 {
        margin: 0 0 2mm;
        font-size: 14pt;
    }

    .report-print-header h2 {
        margin: 0 0 1mm;
        font-size: 12pt;
        letter-spacing: 0.04em;
    }

    .report-print-header p {
        margin: 0;
        font-size: 9pt;
    }

    .report-print-filters {
        display: flex !important;
        flex-wrap: wrap;
        gap: 2mm 8mm;
        padding: 3mm 0;
        margin-bottom: 4mm;
        border-bottom: 1px solid #cccccc;
        font-size: 9pt;
        break-inside: avoid;
    }

    .report-print-filters div {
        display: flex;
        gap: 1.5mm;
    }

    .report-print-filters dt {
        font-weight: 700;
    }

    .report-print-filters dd {
        margin: 0;
    }

    .report-print-summary {
        display: flex !important;
        flex-wrap: wrap;
        gap: 3mm 10mm;
        margin-bottom: 4mm;
        break-inside: avoid;
    }

    .report-print-summary p {
        margin: 0;
    }

    .sales-report-summary {
        break-inside: avoid;
        page-break-inside: avoid;
        border-top: 1px solid #999999;
        margin-top: 5mm;
        padding-top: 3mm;
    }

    .client-table-wrap {
        width: 100% !important;
        overflow: visible !important;
    }

    .sales-report-page table,
    .sales-report-table,
    main > table {
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: collapse;
        table-layout: auto;
        font-size: 9pt;
    }

    .sales-report-page th,
    .sales-report-page td,
    .sales-report-table th,
    .sales-report-table td,
    main > table th,
    main > table td {
        padding: 4px 6px;
        border: 1px solid #999999;
        color: #111111 !important;
        background: #ffffff !important;
        text-align: left;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: normal;
        hyphens: auto;
        overflow: visible !important;
    }

    .sales-report-page thead,
    .sales-report-table thead,
    main > table thead {
        display: table-header-group;
    }

    .sales-report-page tr,
    .sales-report-table tr,
    main > table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-print-footer {
        display: flex !important;
        justify-content: space-between;
        gap: 4mm;
        margin-top: 7mm;
        padding-top: 3mm;
        border-top: 1px solid #999999;
        font-size: 8.5pt;
        break-inside: avoid;
    }

    a {
        color: #111111 !important;
        text-decoration: none !important;
    }
}

/* ===== RELATÓRIOS: VISUALIZAÇÃO NORMAL ===== */

.reports-hub,
.sales-report-page,
.movement-page {
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
}

.sales-report-heading,
.movement-page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.sales-report-heading h2,
.movement-page-heading h2 {
    margin: 0;
}

.movement-report-filters {
    display: block;
    margin: 22px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e8e5dc;
    border-radius: 10px;
}

main > table,
.sales-report-page table,
.movement-page table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

main > table th,
main > table td,
.sales-report-page table th,
.sales-report-page table td,
.movement-page table th,
.movement-page table td {
    padding: 10px 12px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}

main > table th,
.sales-report-page table th,
.movement-page table th {
    background: #f4f1e8;
    color: #333;
}

main > table th,
main > table td {
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    .sales-report-heading,
    .movement-page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .movement-report-filters {
        padding: 14px;
    }
}

/* ===== IMPRESSÃO: ESCONDER ELEMENTOS DA TELA ===== */

@media print {
    .site-header,
    nav,
    .site-footer,
    .no-print,
    .report-screen-actions,
    .sales-report-heading,
    .movement-page-heading {
        display: none !important;
    }

    main {
        padding: 0 !important;
        background: #fff !important;
    }

    main::before {
        display: none !important;
    }

    .report-print-header,
    .report-print-filters,
    .report-print-summary,
    .report-print-footer {
        display: block !important;
    }

    .client-table-wrap,
    .dashboard-table-wrap {
        overflow: visible !important;
    }

    table {
        width: 100%;
        border-collapse: collapse;
    }

    th,
    td {
        border: 1px solid #999;
        padding: 5px;
        color: #111 !important;
        background: #fff !important;
    }

    thead {
        display: table-header-group;
    }

    tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* =========================================
   CENTRAL DE RELATÓRIOS
   ========================================= */

.reports-hub {
    width: 100%;
    max-width: 1250px;
    margin: 0 auto;
    padding: 10px 0 30px;
    box-sizing: border-box;
}

.reports-heading {
    margin-bottom: 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e3dfd4;
}

.reports-heading h2 {
    margin: 0 0 8px;
    color: #292929;
    font-size: 1.9rem;
    line-height: 1.25;
}

.reports-heading p {
    margin: 0;
    color: #737373;
    font-size: 1rem;
    line-height: 1.6;
}

.reports-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 22px;
}

.reports-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    box-sizing: border-box;
    padding: 26px 24px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e5e0d4;
    border-top: 4px solid #c5a23b;
    border-radius: 10px;
    box-shadow: 0 5px 18px rgb(34 34 34 / 6%);
    transition:
        transform 160ms ease,
        box-shadow 160ms ease;
}

.reports-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 24px rgb(34 34 34 / 10%);
}

.reports-card h3 {
    margin: 0 0 10px;
    color: #292929;
    font-size: 1.15rem;
    line-height: 1.4;
}

.reports-card p {
    flex: 1;
    margin: 0 0 22px;
    color: #737373;
    font-size: 0.95rem;
    line-height: 1.6;
}

.reports-card .client-button {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    justify-content: center;
    padding: 10px 14px;
    background: #c5a23b;
    border: 1px solid #c5a23b;
    border-radius: 6px;
    color: #222;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: background-color 150ms ease;
}

.reports-card .client-button:hover {
    background: #d7b84f;
    border-color: #d7b84f;
}

.reports-card .client-button:focus-visible {
    outline: 3px solid #8a6a0a;
    outline-offset: 3px;
}

/* Tablets */
@media (max-width: 900px) {
    .reports-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}

/* Celulares */
@media (max-width: 600px) {
    .reports-hub {
        padding: 4px 0 20px;
    }

    .reports-heading {
        margin-bottom: 20px;
        padding-bottom: 14px;
    }

    .reports-heading h2 {
        font-size: 1.55rem;
    }

    .reports-heading p {
        font-size: 0.92rem;
    }

    .reports-card-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }

    .reports-card {
        padding: 21px 18px;
    }

    .reports-card p {
        margin-bottom: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reports-card,
    .reports-card .client-button {
        transition: none;
    }

    .reports-card:hover {
        transform: none;
    }
}


/* =========================================================
   AJUSTES LOCALIZADOS — RELATÓRIOS E FORMULÁRIOS
   Estas regras ficam no final para prevalecer sobre regras antigas.
   ========================================================= */

/* O cabeçalho destinado à impressão não deve ocupar a página normal. */
.report-print-header,
.report-print-filters,
.report-print-footer {
    display: none;
}

/* Botões de período rápido dos relatórios. */
.quick-period-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 8px 0 16px;
}

.quick-period-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--cor-dourada);
    border-radius: 6px;
    background: var(--cor-dourada);
    color: #222222;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.quick-period-button:hover,
.quick-period-button:focus-visible {
    background: var(--cor-dourada-hover);
    border-color: var(--cor-dourada-hover);
    color: #222222;
    text-decoration: none;
}

.quick-period-button.is-active {
    background: #292929;
    border-color: #292929;
    color: #ffffff;
}

.quick-period-button.is-active:hover {
    background: #454545;
    border-color: #454545;
}

/* Filtros: alinhamento consistente sem estourar a largura da página. */
.manual-date-filter,
.sales-report-filter {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    align-items: end;
    gap: 14px 16px;
    margin: 12px 0 0;
}

.date-filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.date-filter-field label {
    font-weight: 600;
    color: #353228;
}

.date-filter-field input,
.date-filter-field select,
.manual-date-filter input,
.manual-date-filter select {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid #cfcfcf;
    border-radius: 5px;
    background: #ffffff;
    color: #333333;
}

.manual-date-filter > button,
.sales-report-filter > button {
    min-height: 40px;
    justify-self: start;
    padding: 8px 18px;
    border: 1px solid var(--cor-dourada);
    border-radius: 6px;
    background: var(--cor-dourada);
    color: #222222;
    font-weight: 600;
}

.manual-date-filter > button:hover,
.sales-report-filter > button:hover {
    background: var(--cor-dourada-hover);
    border-color: var(--cor-dourada-hover);
}

.active-report-filter {
    margin: 14px 0;
}

/* Área do relatório: botões no topo e conteúdo centralizado. */
.sales-report-page,
.movement-page,
.reports-hub {
    min-width: 0;
}

.report-screen-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
}

.sales-report-heading,
.movement-page-heading {
    min-width: 0;
}

.sales-report-page .client-table-wrap,
.movement-page .client-table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

.sales-report-table,
.sales-report-page table,
.movement-page table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}

.sales-report-page th,
.sales-report-page td,
.movement-page th,
.movement-page td {
    overflow-wrap: anywhere;
}

/* Impressão: regras isoladas para relatórios, sem alterar a tela normal. */
@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    html,
    body {
        width: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        display: block !important;
        background: #ffffff !important;
        color: #111111 !important;
        font-size: 9pt !important;
        line-height: 1.3 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .site-header,
    body > nav,
    nav,
    .site-footer,
    .no-print,
    .report-screen-actions,
    .sales-report-heading,
    .movement-page-heading,
    .sales-report-pagination,
    .movement-report-filters,
    .quick-period-buttons,
    .manual-date-filter {
        display: none !important;
    }

    main {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    main::before {
        display: none !important;
        background: none !important;
    }

    main > * {
        position: static !important;
        z-index: auto !important;
    }

    .sales-report-page,
    .movement-page,
    .reports-hub {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .report-print-header {
        display: flex !important;
        align-items: center;
        gap: 8mm;
        margin: 0 0 4mm !important;
        padding: 0 0 4mm !important;
        border-bottom: 1px solid #999999;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-print-header img {
        display: block !important;
        width: 28mm !important;
        height: 18mm !important;
        max-width: 28mm !important;
        object-fit: contain;
    }

    .report-print-header h1 {
        margin: 0 0 1mm !important;
        font-size: 13pt !important;
    }

    .report-print-header h2 {
        margin: 0 0 1mm !important;
        font-size: 11pt !important;
    }

    .report-print-header p {
        margin: 0 !important;
        font-size: 8pt !important;
    }

    .report-print-filters,
    .report-print-summary {
        display: block !important;
        margin: 0 0 3mm !important;
        padding: 0 0 2mm !important;
        font-size: 8pt !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .client-table-wrap,
    .dashboard-table-wrap {
        width: 100% !important;
        max-width: none !important;
        overflow: visible !important;
    }

    .sales-report-page table,
    .sales-report-table,
    .movement-page table,
    main > table {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: auto !important;
        border-collapse: collapse !important;
        font-size: 8pt !important;
    }

    .sales-report-page th,
    .sales-report-page td,
    .sales-report-table th,
    .sales-report-table td,
    .movement-page th,
    .movement-page td,
    main > table th,
    main > table td {
        padding: 3px 5px !important;
        border: 1px solid #999999 !important;
        background: #ffffff !important;
        color: #111111 !important;
        text-align: left !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: normal !important;
    }

    thead {
        display: table-header-group !important;
    }

    tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-print-footer {
        display: flex !important;
        justify-content: space-between;
        gap: 4mm;
        margin-top: 5mm !important;
        padding-top: 2mm !important;
        border-top: 1px solid #999999;
        font-size: 7.5pt !important;
        break-inside: avoid;
    }

    a {
        color: #111111 !important;
        text-decoration: none !important;
    }
}

@media (max-width: 600px) {
    .manual-date-filter,
    .sales-report-filter {
        grid-template-columns: minmax(0, 1fr);
    }

    .manual-date-filter > button,
    .sales-report-filter > button {
        justify-self: start;
    }

    .quick-period-buttons {
        align-items: stretch;
    }

    .quick-period-button {
        flex: 1 1 auto;
        text-align: center;
    }

    .report-screen-actions {
        justify-content: flex-start;
    }
}

/* ==========================================================
   ESTOQUE — controles de seleção e impressão de etiquetas
   ========================================================== */

/* Os dois botões cinza e o botão dourado ficam alinhados
   na mesma linha em telas com espaço suficiente. */
#bulk-label-selection .bulk-label-selection-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    margin: 16px 0;
}

#bulk-label-selection .bulk-label-selection-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    margin: 0;
}

#bulk-label-selection .bulk-label-selection-controls .client-button {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin: 0;
    padding: 0 16px;
    box-sizing: border-box;
    white-space: nowrap;
}

#bulk-label-selection .bulk-label-selection-controls [data-print-selected] {
    align-self: center;
}

#bulk-label-selection .bulk-label-selection-controls [data-print-selected]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Em telas estreitas, permitir quebra organizada sem sobreposição. */
@media (max-width: 700px) {
    #bulk-label-selection .bulk-label-selection-controls {
        flex-wrap: wrap;
    }

    #bulk-label-selection .bulk-label-selection-actions {
        flex-wrap: wrap;
    }

    #bulk-label-selection .bulk-label-selection-controls .client-button {
        max-width: 100%;
        white-space: normal;
    }
}

/* ---------- Consulta de Produtos (visual) ---------- */
/* Container for each form */
.consulta-codigo form,
.busca-nome form {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-top: 8px;
}

/* Input fields */
.consulta-codigo input[type="text"],
.busca-nome input[type="text"] {
    flex: 1 1 auto;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--cor-borda);
    border-radius: 6px;
    background: #ffffff;
    color: #222222;
    font-size: 1rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.consulta-codigo input[type="text"]:focus,
.busca-nome input[type="text"]:focus {
    border-color: var(--cor-dourada);
    outline: none;
    box-shadow: 0 0 0 3px rgba(197, 162, 59, 0.2);
}

/* Buttons – reuse golden theme */
.consulta-codigo button,
.busca-nome button {
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid var(--cor-dourada);
    border-radius: 6px;
    background: var(--cor-dourada);
    color: #222222;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.consulta-codigo button:hover,
.busca-nome button:hover {
    background: var(--cor-dourada-hover);
}

.consulta-codigo button:focus,
.busca-nome button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(197, 162, 59, 0.4);
}

/* Title spacing */
.consulta-codigo h3,
.busca-nome h3 {
    margin: 0 0 4px 0;
    color: var(--cor-texto);
    font-size: 1.2rem;
}

/* Ensure forms stack on narrow screens */
@media (max-width: 480px) {
    .consulta-codigo form,
    .busca-nome form {
        flex-direction: column;
    }
    .consulta-codigo button,
    .busca-nome button {
        width: 100%;
    }
}

/* Grupo do Filtro de Categoria */
.category-filter-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: 0;
}

.category-filter-form label {
    font-weight: 600;
    color: #333333;
    font-size: 0.95rem;
}

.category-filter-form .product-stock-filter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.category-filter-form .product-stock-filter input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--cor-dourada);
}

.category-filter-form select {
    min-height: 38px;
    padding: 6px 12px;
    border: 1px solid #cccccc;
    border-radius: 6px;
    background-color: #ffffff;
    font-size: 0.92rem;
    color: #222222;
    outline: none;
    transition: border-color 0.2s ease;
}

.category-filter-form select:focus {
    border-color: var(--cor-dourada);
}

/* Subtle gold accent on cards */
.dashboard-card {
    border-top-color: var(--cor-dourada);
}
/* Icons for cards (using pseudo‑elements) */
.dashboard-card::before {
    content: "";
    display: block;
    height: 24px;
    margin-bottom: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.75;
}



/* Monospace for Código column */
.dashboard-table td:nth-child(2) {
    font-family: "Courier New", monospace;
}
/* Better observação readability */
.dashboard-table td:nth-child(6) {
    white-space: pre-wrap;
    word-break: break-word;
}
/* ---------- Responsive tweaks for dashboard ---------- */

/* Quick actions container */
.quick-actions-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

/* Adjust dashboard cards grid for tablets and mobile */
@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .dashboard-cards {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}
/* Agenda de eventos */
.event-calendar-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.event-calendar-heading h3{margin:0;text-transform:capitalize}
.event-calendar{width:100%;table-layout:fixed;border-collapse:collapse}
.event-calendar th,.event-calendar td{border:1px solid #dedede;padding:8px;vertical-align:top}
.event-calendar th{background:#f2f2f2;text-align:center}
.event-calendar-day{height:100px;background:rgba(255,255,255,.86)}
.event-calendar-day.is-empty{background:#f8f8f8}
.event-calendar-item{margin-top:6px;padding:5px;border-left:3px solid hsl(var(--event-hue, 43deg) 68% 43%);background:hsl(var(--event-hue, 43deg) 95% 93%);font-size:.78rem;overflow-wrap:anywhere}
.event-agenda-row{border:1px solid #dedede;border-radius:8px;margin:12px 0;padding:12px}
#event-agenda-forms .event-agenda-row .event-agenda-fields{display:flex;flex-direction:column;align-items:stretch;gap:14px}
.event-delete-field{display:flex;align-items:center;gap:8px}
.inline-form{display:inline-block;margin-left:5px}
.sale-event-field{margin:12px 0}
@media(max-width:760px){.event-calendar th,.event-calendar td{padding:4px;font-size:.78rem}.event-calendar-day{height:76px}.event-calendar-item{font-size:.68rem;padding:3px}.event-calendar-heading h3{font-size:1rem}}

/* A identificação da venda aparece impressa; o título e os botões da tela não. */
.sale-print-meta {
    display: none;
}

.sale-event-edit-form {
    display: grid;
    gap: 8px;
    max-width: 680px;
    margin: 14px 0 20px;
}

.sale-event-edit-form > label {
    font-weight: 600;
}

.sale-event-edit-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sale-event-edit-form small {
    color: #666666;
}

@media (max-width: 600px) {
    .sale-event-edit-controls {
        align-items: stretch;
        flex-direction: column;
    }
}

@media print {
    .report-print-filters:empty {
        display: none !important;
    }

    .event-calendar-page {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .event-calendar-page .client-detail-card {
        margin: 0 0 5mm !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        box-shadow: none !important;
    }

    .event-calendar-page .client-table-wrap {
        width: 100% !important;
        overflow: visible !important;
    }

    .event-calendar {
        font-size: 7.5pt !important;
    }

    .event-calendar th,
    .event-calendar td {
        padding: 2mm !important;
        border: 1px solid #999999 !important;
    }

    .event-calendar-day {
        height: 18mm !important;
    }

    .event-calendar-item {
        margin-top: 1mm !important;
        padding: 1mm !important;
        font-size: 6.5pt !important;
        color: #111111 !important;
    }

    .sales-report-page .client-detail-card {
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        box-shadow: none !important;
    }

    .sales-report-page .sale-print-meta {
        display: block !important;
        margin: 0 0 3mm !important;
        font-size: 9pt !important;
    }

    .sales-report-page .client-detail-card > p {
        margin: 0 0 2mm !important;
    }

    .sales-report-page .client-detail-card h3 {
        margin: 3mm 0 2mm !important;
        font-size: 10pt !important;
    }

    .sales-report-page .sales-report-summary {
        margin-top: 4mm !important;
        padding-top: 3mm !important;
        font-size: 9pt !important;
    }

    .sales-report-page .sales-report-summary p {
        margin: 0 0 2mm !important;
    }
}

/* Mantém a tabela do carrinho dentro da largura da tela de venda. */
.sale-cart-card .client-table-wrap {
    overflow-x: hidden;
}

.sale-cart-card .sale-cart-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.sale-cart-table th,
.sale-cart-table td {
    padding: 9px 8px;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.sale-cart-table th {
    line-height: 1.3;
}

.sale-cart-table td:nth-child(4) {
    text-align: center;
}

.sale-cart-table th:nth-child(1) { width: 33%; }
.sale-cart-table th:nth-child(2) { width: 8%; }
.sale-cart-table th:nth-child(3) { width: 10%; }
.sale-cart-table th:nth-child(4) { width: 7%; }
.sale-cart-table th:nth-child(5) { width: 14%; }
.sale-cart-table th:nth-child(6) { width: 10%; }
.sale-cart-table th:nth-child(7) { width: 10%; }
.sale-cart-table th:nth-child(8) { width: 8%; }

.sale-cart-table td:nth-child(6),
.sale-cart-table td:nth-child(7) {
    white-space: nowrap;
}

.sale-cart-table .sale-quantity-form {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    margin: 0;
}

.sale-cart-table .sale-quantity-form input {
    flex: 0 0 76px;
    width: 76px;
    min-width: 0;
    height: 38px;
    padding: 6px 8px;
}

.sale-cart-table .client-button {
    padding: 8px 10px;
}

.sale-cart-table .sale-remove-button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 7px;
    border: 1px solid #d9a1a1;
    border-radius: 6px;
    background: #fff1f1;
    color: #a32323;
}

.sale-cart-table .sale-update-button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 7px;
    border: 1px solid #c49f36;
    border-radius: 6px;
    background: #fff8e2;
    color: #8a6810;
}

.sale-cart-table .sale-update-button:hover,
.sale-cart-table .sale-update-button:focus-visible {
    border-color: #b58d22;
    background: #c7a337;
    color: #ffffff;
}

.sale-cart-table .sale-update-button svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.sale-cart-table .sale-remove-button:hover,
.sale-cart-table .sale-remove-button:focus-visible {
    border-color: #a91c1c;
    background: #a91c1c;
    color: #ffffff;
}

.sale-cart-table td:nth-child(8) form {
    display: flex;
    justify-content: center;
    margin: 0;
}

.sale-cart-table .sale-remove-button svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

@media (max-width: 760px) {
    .sale-cart-table th,
    .sale-cart-table td {
        padding: 6px 4px;
        font-size: 0.82rem;
    }

    .sale-cart-table td:nth-child(6),
    .sale-cart-table td:nth-child(7) {
        white-space: normal;
    }

    .sale-cart-table .sale-quantity-form .client-button {
        align-self: flex-start;
    }
}

/* O carrinho vira uma grade compacta em janelas estreitas, sem rolagem lateral. */
@media (max-width: 1100px) {
    .sale-cart-card .client-table-wrap {
        overflow-x: hidden !important;
    }

    .sale-cart-card .sale-cart-table,
    .sale-cart-card .sale-cart-table tbody {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
    }

    .sale-cart-card .sale-cart-table thead {
        display: none;
    }

    .sale-cart-card .sale-cart-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        margin-bottom: 10px;
        border: 1px solid #dedede;
        border-radius: 6px;
        overflow: hidden;
    }

    .sale-cart-card .sale-cart-table tbody td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8px;
        min-width: 0;
        padding: 8px;
        border: 0;
        border-bottom: 1px solid #eeeeee;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .sale-cart-card .sale-cart-table tbody td::before {
        flex: 0 0 auto;
        color: #625f58;
        font-size: 0.78rem;
        font-weight: 600;
        content: attr(data-label);
    }

    .sale-cart-card .sale-cart-table tbody td:first-child {
        grid-column: 1 / -1;
        display: block;
        font-weight: 600;
    }

    .sale-cart-card .sale-cart-table tbody td:first-child::before {
        display: block;
        margin-bottom: 3px;
    }

    .sale-cart-card .sale-cart-table .sale-quantity-form {
        justify-content: flex-end;
        min-width: 0;
    }

    .sale-cart-card .sale-cart-table .sale-quantity-form input {
        width: 58px;
    }

    .sale-cart-card .sale-cart-table .client-button {
        padding: 7px 9px;
    }
}

@media (max-width: 520px) {
    .sale-cart-card .sale-cart-table tbody tr {
        grid-template-columns: minmax(0, 1fr);
    }

    .sale-cart-card .sale-cart-table tbody td:first-child {
        grid-column: auto;
    }
}

/* Histórico de movimentações: usa a largura da tela e evita quebrar rótulos. */
.movement-page {
    width: 100%;
    max-width: none;
}

.movement-page .movement-history-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.movement-page .movement-history-table th,
.movement-page .movement-history-table td {
    overflow-wrap: normal;
    word-break: normal;
    vertical-align: top;
}

.movement-page .movement-history-table th:nth-child(1) { width: 12%; }
.movement-page .movement-history-table th:nth-child(2) { width: 8%; }
.movement-page .movement-history-table th:nth-child(3) { width: 24%; }
.movement-page .movement-history-table th:nth-child(4) { width: 11%; }
.movement-page .movement-history-table th:nth-child(5) { width: 8%; }
.movement-page .movement-history-table th:nth-child(6) { width: 7%; }
.movement-page .movement-history-table th:nth-child(7) { width: 11%; }
.movement-page .movement-history-table th:nth-child(8) { width: 19%; }

.movement-page .movement-history-table th:nth-child(1),
.movement-page .movement-history-table th:nth-child(2),
.movement-page .movement-history-table th:nth-child(5),
.movement-page .movement-history-table th:nth-child(6) {
    white-space: nowrap;
}

.movement-page .movement-history-table td:nth-child(1),
.movement-page .movement-history-table td:nth-child(2),
.movement-page .movement-history-table td:nth-child(5),
.movement-page .movement-history-table td:nth-child(6) {
    white-space: nowrap;
}

.movement-page .movement-history-table td:nth-child(3),
.movement-page .movement-history-table td:nth-child(8) {
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    .movement-page .client-table-wrap {
        overflow-x: auto;
    }

    .movement-page .movement-history-table {
        min-width: 900px;
    }
}
