:root {
    --background: #0c0c0d;
    --surface: #171719;
    --surface-soft: #202023;
    --gold: #d4ad55;
    --gold-light: #f2d78b;
    --text: #f5f5f5;
    --muted: #a6a6aa;
    --border: #303034;
    --success: #4fc47b;
    --danger: #ff6b6b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: var(--gold-light);
    text-decoration: none;
}

.topbar {
    min-height: 72px;
    padding: 16px 5%;
    background: #101011;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;
}

.brand span {
    color: var(--gold);
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.nav a,
.nav-logout {
    color: var(--muted);
    font-size: 14px;
    background: none;
    border: 0;
    cursor: pointer;
}

.nav a:hover,
.nav-logout:hover {
    color: var(--gold-light);
}

.nav form {
    margin: 0;
}

.container {
    width: min(1180px, 92%);
    margin: 34px auto 80px;
}

.page-header,
.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.page-header {
    margin-bottom: 24px;
}

h1,
h2,
p {
    margin-top: 0;
}

.page-header p,
.panel p,
small {
    color: var(--muted);
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.card,
.panel,
.success-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.card {
    padding: 22px;
}

.card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.card strong {
    font-size: 26px;
}

.card.highlight {
    border-color: var(--gold);
}

.card.highlight strong {
    color: var(--gold-light);
}

.panel {
    padding: 24px;
}

.grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.product-list {
    display: flex;
    flex-direction: column;
}

.product-row {
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.product-row:last-child {
    border-bottom: 0;
}

.product-row small {
    display: block;
    margin-top: 4px;
}

.quantity {
    color: var(--gold-light);
    font-weight: 700;
}

.button,
.filter-button {
    border: 1px solid var(--gold);
    background: transparent;
    color: var(--gold-light);
    border-radius: 8px;
    padding: 11px 16px;
    cursor: pointer;
    display: inline-block;
}

.button.primary {
    background: var(--gold);
    color: #111;
    font-weight: 800;
}

.button.small {
    padding: 7px 11px;
    font-size: 13px;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filters input {
    width: auto;
}

.form-panel {
    max-width: 720px;
}

.form-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 15px;
}

input[type="checkbox"] {
    width: auto;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.warning {
    border-left: 3px solid var(--gold);
    background: rgba(212, 173, 85, 0.08);
    padding: 13px;
    color: var(--gold-light);
}

.message {
    margin-bottom: 18px;
    padding: 14px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.message.success {
    border-left: 4px solid var(--success);
}

.message.error,
.field-error {
    color: var(--danger);
}

.table-responsive {
    overflow-x: auto;
}

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

th,
td {
    padding: 13px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

th {
    color: var(--gold-light);
    font-size: 13px;
}

.badge {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 20px;
    background: var(--surface-soft);
    font-size: 12px;
}

.badge.success {
    color: var(--success);
}

.success-panel {
    max-width: 760px;
    margin: auto;
    padding: 34px;
    text-align: center;
}

.success-label {
    color: var(--success);
    font-weight: 700;
}

.code-box {
    margin: 25px 0;
    padding: 22px;
    background: #090909;
    border: 1px dashed var(--gold);
    border-radius: 10px;
    color: var(--gold-light);
    font-size: 24px;
    font-weight: 800;
    word-break: break-all;
}

.sale-summary {
    margin: 26px 0;
    padding: 18px;
    background: var(--surface-soft);
    border-radius: 10px;
    text-align: left;
}

.actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.immutable-data {
    margin-bottom: 22px;
    padding: 16px;
    background: var(--surface-soft);
    border-radius: 10px;
}

.immutable-data p:last-child {
    margin-bottom: 0;
}

.empty {
    color: var(--muted);
    padding: 20px 0;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(440px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 34px;
}

.login-brand {
    margin-bottom: 28px;
}

.secondary-link {
    display: block;
    margin-top: 18px;
    text-align: center;
}

.whatsapp {
    position: fixed;
    right: 22px;
    bottom: 22px;
    padding: 14px 18px;
    border-radius: 30px;
    background: #25d366;
    color: #08150c;
    font-weight: 800;
}

@media (max-width: 820px) {
    .topbar,
    .page-header,
    .panel-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .cards,
    .grid-two {
        grid-template-columns: 1fr;
    }

    .nav {
        gap: 12px;
    }
}

.code-message {
    width: 100%;
    min-height: 260px;
    margin: 24px 0 16px;
    padding: 20px;
    resize: vertical;
    background: #090909;
    border: 1px dashed var(--gold);
    border-radius: 10px;
    color: var(--gold-light);
    font-family: Consolas, Monaco, monospace;
    font-size: 17px;
    line-height: 1.6;
}

.copy-feedback {
    margin-top: 12px;
    color: var(--success);
    font-weight: 700;
}

.search-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.search-field {
    flex: 1 1 420px;
}

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

.confirmation-summary {
    margin-bottom: 20px;
    padding: 20px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.confirmation-summary p:last-child {
    margin-bottom: 0;
}

.confirmation-form {
    margin-top: 22px;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.compact-field {
    max-width: 140px;
}

.quantity-input {
    width: 120px;
    min-height: 52px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
}

.money-field {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.money-prefix {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: 0 14px;
    background: #29292d;
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: 8px 0 0 8px;
    color: var(--gold-light);
    font-size: 17px;
    font-weight: 800;
}

.money-field .money-input {
    border-radius: 0 8px 8px 0;
    font-size: 17px;
    font-weight: 700;
}

@media (max-width: 820px) {
    .container {
        width: min(100% - 28px, 720px);
        margin-top: 24px;
    }

    .panel {
        padding: 20px 16px;
    }

    .form-panel {
        width: 100%;
        max-width: none;
    }

    .form-card {
        gap: 18px;
    }

    .compact-field {
        max-width: 110px;
    }

    .quantity-input {
        width: 100px;
        min-height: 48px;
    }

    .money-prefix {
        min-width: 52px;
    }

    .button.primary {
        width: 100%;
        min-height: 52px;
        text-align: center;
        font-size: 16px;
    }
}

/* Campo de quantidade compacto no revendedor e no operacional */
.form-field.compact-field {
    width: 120px;
    max-width: 120px;
    flex: 0 0 120px;
}

.form-field.compact-field input.quantity-input {
    width: 100% !important;
    max-width: 120px !important;
    min-width: 0 !important;
    text-align: center;
}

@media (max-width: 820px) {
    .form-field.compact-field {
        width: 96px;
        max-width: 96px;
        flex-basis: 96px;
    }

    .form-field.compact-field input.quantity-input {
        width: 96px !important;
        max-width: 96px !important;
    }
}

/* Correção definitiva do campo Quantidade */
#id_quantidade {
    display: block !important;
    width: 120px !important;
    max-width: 120px !important;
    min-width: 120px !important;
    text-align: center !important;
    font-size: 18px;
    font-weight: 700;
}

.form-field:has(#id_quantidade) {
    width: 120px !important;
    max-width: 120px !important;
    align-self: flex-start;
}

@media (max-width: 820px) {
    #id_quantidade {
        width: 96px !important;
        max-width: 96px !important;
        min-width: 96px !important;
    }

    .form-field:has(#id_quantidade) {
        width: 96px !important;
        max-width: 96px !important;
    }
}


/* =========================================================
   MOBILE FIRST — PAINEL OPERACIONAL
   ========================================================= */

@media (max-width: 820px) {
    body {
        overflow-x: hidden;
    }

    .topbar {
        min-height: auto;
        padding: 14px 16px;
        gap: 14px;
    }

    .brand {
        width: 100%;
        font-size: 20px;
        text-align: center;
    }

    .nav {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .nav a,
    .nav form,
    .nav-logout {
        width: 100%;
    }

    .nav a,
    .nav-logout {
        min-height: 44px;
        padding: 11px 8px;
        border: 1px solid var(--border);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 14px;
    }

    .nav a:active,
    .nav-logout:active {
        border-color: var(--gold);
        color: var(--gold-light);
    }

    .container {
        width: calc(100% - 24px);
        margin: 22px auto 54px;
    }

    .page-header {
        margin-bottom: 18px;
    }

    .page-header h1 {
        margin-bottom: 8px;
        font-size: 28px;
        line-height: 1.15;
    }

    .page-header p {
        margin-bottom: 0;
        font-size: 15px;
        line-height: 1.45;
    }

    .cards {
        margin-top: 18px;
        gap: 14px;
    }

    .card,
    .panel {
        padding: 18px 16px;
        border-radius: 12px;
    }

    .card strong {
        font-size: 24px;
        line-height: 1.15;
    }

    .card p {
        line-height: 1.4;
    }

    .card .button,
    .actions .button,
    .actions button {
        width: 100%;
        min-height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 16px;
    }

    form p {
        margin-bottom: 18px;
    }

    form label {
        display: block;
        margin-bottom: 7px;
        font-weight: 700;
    }

    input,
    select,
    textarea {
        min-height: 50px;
        padding: 13px 12px;
        font-size: 16px;
    }

    textarea {
        min-height: 120px;
    }

    input[type="file"] {
        min-height: auto;
        padding: 12px;
        line-height: 1.4;
    }

    form .helptext,
    form small {
        display: block;
        margin-top: 7px;
        line-height: 1.4;
    }

    .actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .button.primary,
    .button {
        width: 100%;
    }

    .success-panel {
        width: 100%;
        padding: 24px 16px;
    }

    .code-box {
        padding: 16px;
        font-size: 18px;
    }

    .code-message {
        min-height: 220px;
        padding: 15px;
        font-size: 15px;
    }

    .search-form {
        align-items: stretch;
        flex-direction: column;
    }

    .search-field {
        flex: 1 1 auto;
        width: 100%;
    }

    .filters {
        flex-direction: column;
    }

    .filters input,
    .filters select,
    .filter-button {
        width: 100%;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        border: 1px solid var(--border);
        border-radius: 10px;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 680px;
    }

    th,
    td {
        padding: 11px 10px;
        font-size: 13px;
    }

    .whatsapp {
        right: 14px;
        bottom: 14px;
        padding: 12px 15px;
    }
}

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

    .container {
        width: calc(100% - 20px);
    }

    .page-header h1 {
        font-size: 25px;
    }

    .card strong {
        font-size: 22px;
    }
}


/* =========================================================
   MENU OPERACIONAL RECOLHÍVEL NO CELULAR
   ========================================================= */

.mobile-menu {
    display: none;
}

@media (max-width: 820px) {
    .topbar {
        min-height: 68px;
        padding: 12px 14px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 12px;
    }

    .brand {
        width: auto;
        text-align: left;
        font-size: 19px;
        white-space: nowrap;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-menu {
        display: block;
        position: relative;
    }

    .mobile-menu summary {
        min-height: 44px;
        padding: 10px 14px;
        border: 1px solid var(--gold);
        border-radius: 9px;
        color: var(--gold-light);
        cursor: pointer;
        list-style: none;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        font-size: 15px;
        font-weight: 700;
        user-select: none;
    }

    .mobile-menu summary::-webkit-details-marker {
        display: none;
    }

    .menu-icon {
        font-size: 20px;
        line-height: 1;
    }

    .mobile-menu[open] summary {
        background: var(--gold);
        color: #111;
    }

    .mobile-nav {
        position: absolute;
        z-index: 1000;
        top: calc(100% + 9px);
        right: 0;
        width: min(280px, calc(100vw - 28px));
        padding: 10px;
        background: #101011;
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: 0 14px 35px rgba(0, 0, 0, 0.45);
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .mobile-nav a,
    .mobile-nav form,
    .mobile-nav .nav-logout {
        width: 100%;
    }

    .mobile-nav a,
    .mobile-nav .nav-logout {
        min-height: 48px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--surface);
        color: var(--text);
        display: flex;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
        font-size: 15px;
    }

    .mobile-nav a:active,
    .mobile-nav .nav-logout:active {
        border-color: var(--gold);
        color: var(--gold-light);
    }

    .mobile-nav .nav-logout {
        cursor: pointer;
        font-family: inherit;
    }
}

@media (max-width: 360px) {
    .brand {
        font-size: 17px;
    }

    .mobile-menu summary {
        padding: 9px 11px;
        font-size: 14px;
    }
}


/* Correção final do menu mobile */
@media (max-width: 820px) {
    .topbar {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        flex-direction: initial !important;
        align-items: center !important;
        justify-content: initial !important;
    }

    .brand {
        width: auto !important;
        text-align: left !important;
    }

    .desktop-nav {
        display: none !important;
    }

    .mobile-menu {
        display: block !important;
        position: relative !important;
    }

    .mobile-menu:not([open]) .mobile-nav {
        display: none !important;
    }

    .mobile-menu[open] .mobile-nav {
        display: flex !important;
    }

    .mobile-menu summary {
        border: 1px solid var(--gold) !important;
        border-radius: 9px !important;
        padding: 10px 14px !important;
        list-style: none !important;
        color: var(--gold-light) !important;
        background: transparent !important;
    }

    .mobile-menu summary::marker {
        content: "";
    }

    .mobile-menu summary::-webkit-details-marker {
        display: none !important;
    }
}


/* Histórico de abastecimentos */
.history-stock-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stock-history-details {
    margin: 18px 0;
}

.stock-history-details p {
    margin-bottom: 9px;
    overflow-wrap: anywhere;
}

@media (max-width: 820px) {
    .history-stock-cards {
        grid-template-columns: 1fr;
    }

    .history-stock-cards .card {
        width: 100%;
    }

    .stock-history-details {
        margin: 16px 0;
    }
}


/* Resumo compacto do estoque central */
.stock-balance-list {
    margin: 18px 0 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.stock-balance-row {
    min-height: 54px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.stock-balance-row:last-child {
    border-bottom: 0;
}

.stock-balance-row strong {
    min-width: 0;
    font-size: 15px;
    overflow-wrap: anywhere;
}

.stock-balance-row span {
    flex: 0 0 auto;
    color: var(--muted);
    white-space: nowrap;
}

.stock-balance-row span b {
    color: var(--gold-light);
}

/* Mensal: 1 a 15 | Anual: 1 a 5 */
.stock-balance-row.stock-low {
    background: rgba(212, 173, 85, 0.12);
    border-left: 4px solid var(--gold);
}

.stock-balance-row.stock-low strong,
.stock-balance-row.stock-low span,
.stock-balance-row.stock-low span b {
    color: var(--gold-light);
}

/* Qualquer produto zerado */
.stock-balance-row.stock-zero {
    background: rgba(255, 107, 107, 0.12);
    border-left: 4px solid var(--danger);
}

.stock-balance-row.stock-zero strong,
.stock-balance-row.stock-zero span,
.stock-balance-row.stock-zero span b {
    color: var(--danger);
}

@media (max-width: 420px) {
    .stock-balance-row {
        min-height: 50px;
        padding: 12px 14px;
        gap: 10px;
    }

    .stock-balance-row strong,
    .stock-balance-row span {
        font-size: 14px;
    }
}


/* =========================================================
   HOME OPERACIONAL COM PRODUTOS EXPANSÍVEIS
   ========================================================= */

.operational-home-header {
    margin-bottom: 20px;
}

.stock-product-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 20px 0 60px;
}

.stock-product-item {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 13px;
    overflow: hidden;
}

.stock-product-item summary {
    position: relative;
    min-height: 68px;
    padding: 16px 52px 16px 18px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.stock-product-item summary::-webkit-details-marker {
    display: none;
}

.stock-product-item summary::marker {
    content: "";
}

.stock-product-item summary::after {
    content: "+";
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold-light);
    font-size: 27px;
    line-height: 1;
    font-weight: 400;
}

.stock-product-item[open] summary::after {
    content: "−";
}

.stock-product-item[open] summary {
    border-bottom: 1px solid var(--border);
}

.stock-product-name {
    min-width: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.stock-product-balance {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 15px;
    white-space: nowrap;
}

.stock-product-balance b {
    color: var(--gold-light);
    font-size: 17px;
}

.stock-product-actions {
    padding: 16px 18px 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
}

.stock-product-actions .button {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Saldo baixo */
.stock-product-item.stock-low {
    border-color: var(--gold);
    background: rgba(212, 173, 85, 0.08);
}

.stock-product-item.stock-low .stock-product-name,
.stock-product-item.stock-low .stock-product-balance,
.stock-product-item.stock-low .stock-product-balance b {
    color: var(--gold-light);
}

/* Estoque zerado */
.stock-product-item.stock-zero {
    border-color: var(--danger);
    background: rgba(255, 107, 107, 0.08);
}

.stock-product-item.stock-zero .stock-product-name,
.stock-product-item.stock-zero .stock-product-balance,
.stock-product-item.stock-zero .stock-product-balance b,
.stock-product-item.stock-zero summary::after {
    color: var(--danger);
}

@media (max-width: 820px) {
    .stock-product-list {
        gap: 15px;
        margin-top: 18px;
    }

    .stock-product-item summary {
        min-height: 72px;
        padding: 16px 48px 16px 16px;
        gap: 12px;
    }

    .stock-product-name {
        font-size: 15px;
    }

    .stock-product-balance {
        font-size: 14px;
    }

    .stock-product-balance b {
        font-size: 16px;
    }

    .stock-product-actions {
        grid-template-columns: 1fr;
        padding: 14px 16px 17px;
        gap: 10px;
    }

    .stock-product-actions .button {
        min-height: 51px;
        font-size: 16px;
    }
}

@media (max-width: 380px) {
    .stock-product-item summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .stock-product-balance {
        align-self: flex-start;
    }
}


/* =========================================================
   HOME COM CARDS COMPACTOS E PAINEL DE AÇÕES
   ========================================================= */

.home-stock-grid {
    display: grid;
    grid-template-columns: repeat(
        2,
        minmax(0, 1fr)
    );
    gap: 16px;
    margin: 20px 0 60px;
}

.home-stock-card {
    appearance: none;
    width: 100%;
    min-height: 80px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 13px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    text-align: left;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.home-stock-card:hover,
.home-stock-card:focus-visible {
    border-color: var(--gold);
    outline: none;
}

.home-stock-card:active {
    transform: scale(0.99);
}

.home-stock-name {
    min-width: 0;
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.home-stock-info {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.home-stock-label {
    color: var(--muted);
    font-size: 13px;
}

.home-stock-info strong {
    color: var(--gold-light);
    font-size: 19px;
}

.home-stock-arrow {
    margin-left: 4px;
    color: var(--gold-light);
    font-size: 27px;
    line-height: 1;
}

/* Estoque baixo */
.home-stock-card.stock-low {
    background: rgba(212, 173, 85, 0.09);
    border-color: var(--gold);
}

.home-stock-card.stock-low .home-stock-name,
.home-stock-card.stock-low .home-stock-label,
.home-stock-card.stock-low .home-stock-info strong,
.home-stock-card.stock-low .home-stock-arrow {
    color: var(--gold-light);
}

/* Estoque zerado */
.home-stock-card.stock-zero {
    background: rgba(255, 107, 107, 0.09);
    border-color: var(--danger);
}

.home-stock-card.stock-zero .home-stock-name,
.home-stock-card.stock-zero .home-stock-label,
.home-stock-card.stock-zero .home-stock-info strong,
.home-stock-card.stock-zero .home-stock-arrow {
    color: var(--danger);
}


/* Painel de ações */
.product-action-dialog {
    width: min(520px, calc(100% - 28px));
    max-width: 520px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
}

.product-action-dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(2px);
}

.product-action-sheet {
    position: relative;
    padding: 27px 24px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.55);
}

.product-action-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 31px;
    line-height: 1;
}

.product-action-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.product-action-sheet h2 {
    max-width: calc(100% - 42px);
    margin-bottom: 9px;
    font-size: 25px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.product-action-balance {
    margin-bottom: 22px;
    color: var(--muted);
}

.product-action-balance strong {
    color: var(--gold-light);
    font-size: 20px;
}

.product-action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 11px;
}

.product-action-buttons .button,
.product-action-cancel {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 16px;
}

.product-action-cancel {
    margin-top: 11px;
}


/* Prioridade mobile */
@media (max-width: 820px) {
    .home-stock-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 18px;
    }

    .home-stock-card {
        min-height: 82px;
        padding: 16px;
        gap: 12px;
    }

    .home-stock-name {
        font-size: 15px;
    }

    .home-stock-info strong {
        font-size: 18px;
    }

    .product-action-dialog[open] {
        width: 100%;
        max-width: none;
        margin: auto 0 0;
    }

    .product-action-sheet {
        padding:
            25px
            18px
            calc(20px + env(safe-area-inset-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 22px 22px 0 0;
        animation: productSheetUp 0.2s ease-out;
    }

    .product-action-sheet h2 {
        font-size: 23px;
    }
}

@media (max-width: 390px) {
    .home-stock-card {
        align-items: flex-start;
    }

    .home-stock-info {
        grid-template-columns: auto auto;
    }

    .home-stock-label {
        display: none;
    }
}

@keyframes productSheetUp {
    from {
        transform: translateY(35px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* Busca instantânea de produtos na home */
.home-product-search {
    margin: 18px 0;
}

.home-product-search label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.home-product-search input {
    min-height: 52px;
}

.home-product-no-results {
    margin: 24px 0;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--muted);
    text-align: center;
}


/* Ações destrutivas confirmadas */
.button.danger {
    background: #8f2525;
    border-color: #b63a3a;
    color: #ffffff;
}

.button.danger:hover,
.button.danger:focus-visible {
    background: #a72d2d;
    border-color: #d14a4a;
    color: #ffffff;
}

/* INICIO RECUPERACAO DE SENHA */
.field-error { margin-top: -8px; color: #b42318; font-size: .9rem; line-height: 1.35; }
.verification-code-input { text-align: center; font-size: 1.65rem; font-weight: 700; letter-spacing: .42rem; }
.auth-success-icon { display: flex; align-items: center; justify-content: center; width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 50%; background: #e7f6ec; color: #187a3f; font-size: 2rem; font-weight: 700; }
.auth-main-link { display: block; margin-top: 20px; text-align: center; text-decoration: none; }
/* FIM RECUPERACAO DE SENHA */

/* INICIO NUMERO REVENDEDOR */
.revendedor-number-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 24px;
    padding: 16px 20px;
    border: 1px solid #d9ad4a;
    border-radius: 14px;
    background:
        linear-gradient(
            135deg,
            rgba(217, 173, 74, 0.14),
            rgba(217, 173, 74, 0.03)
        );
}

.revendedor-number-info {
    display: grid;
    gap: 4px;
}

.revendedor-number-info span {
    color: #d7d7dc;
    font-size: 0.92rem;
}

.revendedor-number-info strong {
    color: #e2b955;
    font-size: 2rem;
    line-height: 1;
    letter-spacing: 0.08em;
}

.revendedor-number-info small {
    color: #b9b9c0;
    margin-top: 4px;
}

.revendedor-number-copy {
    white-space: nowrap;
}

@media (max-width: 700px) {
    .revendedor-number-banner {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .revendedor-number-copy {
        width: 100%;
    }
}
/* FIM NUMERO REVENDEDOR */

/* INICIO FILTROS DASHBOARD MOBILE */
@media (max-width: 820px) {
    .filters {
        display: grid !important;
        grid-template-columns:
            repeat(6, minmax(0, 1fr)) !important;
        gap: 10px !important;
        width: 100%;
        margin-bottom: 20px;
    }

    .filters > * {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        box-sizing: border-box;
    }

    .filters > :nth-child(1),
    .filters > :nth-child(2),
    .filters > :nth-child(3) {
        grid-column: span 2;
    }

    .filters > :nth-child(4),
    .filters > :nth-child(5) {
        grid-column: span 3;
        min-height: 52px;
    }

    .filters > :nth-child(6) {
        grid-column: 1 / -1;
        min-height: 52px;
    }

    .filters .filter-button {
        min-height: 52px;
        padding: 10px 8px;
        text-align: center;
    }

    .filters input[type="date"] {
        padding: 10px 12px;
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .filters {
        gap: 8px !important;
    }

    .filters .filter-button {
        font-size: 14px;
        padding-left: 5px;
        padding-right: 5px;
    }
}
/* FIM FILTROS DASHBOARD MOBILE */

/* =========================================================
   LOJA ONLINE E PIX
   ========================================================= */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.shop-page-header p {
    max-width: 760px;
}

.shop-summary-bar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.shop-summary-bar > div {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.shop-summary-bar span,
.shop-summary-bar strong {
    display: block;
}

.shop-summary-bar span {
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
}

.shop-summary-bar strong {
    color: var(--gold-light);
}

.shop-warning {
    margin-bottom: 20px;
}

.shop-warning p {
    margin: 8px 0 14px;
}

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

.shop-product-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface);
}

.shop-product-card.is-unavailable {
    opacity: 0.68;
}

.shop-product-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.shop-product-head h2 {
    margin: 4px 0 10px;
    font-size: 21px;
}

.shop-product-head small,
.shop-description {
    color: var(--muted);
}

.shop-stock {
    min-width: 92px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface-soft);
    text-align: center;
}

.shop-stock span,
.shop-stock strong {
    display: block;
}

.shop-stock span {
    color: var(--muted);
    font-size: 11px;
}

.shop-stock strong {
    margin-top: 4px;
    color: var(--gold-light);
    font-size: 24px;
}

.shop-description {
    margin: 16px 0 0;
}

.shop-price-table {
    margin: 18px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.shop-price-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}

.shop-price-row:last-child {
    border-bottom: 0;
}

.shop-price-row strong {
    color: var(--gold-light);
}

.shop-price-row small {
    grid-column: 1 / -1;
    color: var(--success);
}

.shop-price-head {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.shop-buy-form {
    margin-top: auto;
}

.shop-buy-form label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

.shop-buy-line {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
}

.shop-buy-line input {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
}

.button:disabled,
button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.shop-buy-form > small {
    display: block;
    margin-top: 8px;
}

.shop-orders-list {
    display: grid;
    gap: 12px;
}

.shop-order-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    color: var(--text);
}

.shop-order-card:hover {
    border-color: var(--gold);
}

.shop-order-card > div:first-child,
.shop-order-meta {
    display: grid;
    gap: 5px;
}

.shop-order-card small,
.shop-order-card span {
    color: var(--muted);
}

.shop-order-meta {
    justify-items: end;
    text-align: right;
}

.order-status {
    display: inline-flex;
    width: fit-content;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text) !important;
    font-size: 12px;
    font-weight: 700;
}

.status-pago,
.status-entregue {
    border-color: rgba(79, 196, 123, 0.55);
    color: var(--success) !important;
}

.status-aguardando_pagamento,
.status-em_analise,
.status-reembolso_pendente {
    border-color: rgba(212, 173, 85, 0.7);
    color: var(--gold-light) !important;
}

.status-expirado,
.status-cancelado,
.status-reembolsado {
    color: var(--muted) !important;
}

.status-contestado {
    border-color: rgba(255, 107, 107, 0.65);
    color: var(--danger) !important;
}

.shop-order-summary {
    margin-bottom: 20px;
}

.pix-panel {
    border-color: var(--gold);
}

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

.pix-title p {
    margin-bottom: 0;
}

.pix-countdown {
    min-width: 112px;
    padding: 12px 16px;
    border: 1px solid var(--gold);
    border-radius: 10px;
    color: var(--gold-light);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-align: center;
}

.pix-content {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
    gap: 24px;
    align-items: center;
}

.pix-qrcode {
    display: block;
    width: 100%;
    max-width: 260px;
    aspect-ratio: 1;
    padding: 10px;
    border-radius: 12px;
    background: #fff;
    object-fit: contain;
}

.pix-copy-area {
    display: grid;
    gap: 10px;
}

.pix-copy-area textarea {
    min-height: 118px;
    resize: vertical;
    overflow-wrap: anywhere;
}

.shop-success-panel {
    max-width: none;
}

@media (max-width: 820px) {
    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .header-actions .button {
        width: 100%;
        text-align: center;
    }

    .shop-summary-bar {
        grid-template-columns: 1fr;
    }

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

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

    .shop-order-meta {
        justify-items: start;
        text-align: left;
    }

    .pix-title {
        align-items: stretch;
        flex-direction: column;
    }

    .pix-countdown {
        width: 100%;
    }

    .pix-content {
        grid-template-columns: 1fr;
    }

    .pix-qrcode {
        margin: 0 auto;
    }
}

@media (max-width: 420px) {
    .header-actions,
    .shop-buy-line {
        grid-template-columns: 1fr;
    }

    .shop-product-head {
        flex-direction: column;
    }

    .shop-stock {
        width: 100%;
    }
}
/* FIM LOJA ONLINE E PIX */

.shop-price-preview {
    display: grid;
    gap: 3px;
    margin: 12px 0 4px;
    padding: 12px 14px;
    border-radius: 9px;
    background: var(--surface-soft);
}
.shop-price-preview span { color: var(--muted); font-size: 12px; }
.shop-price-preview strong { color: var(--gold-light); font-size: 20px; }
.shop-price-preview small { color: var(--success); }

/* INICIO CORRECOES LOJA ONLINE 1.1 */
.shop-product-card:only-child {
    grid-column: 1 / -1;
}

.shop-product-limits {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 9px;
}

.shop-product-limits small {
    color: var(--muted);
}

.shop-price-preview small:not(:empty) {
    color: var(--success);
}
/* FIM CORRECOES LOJA ONLINE 1.1 */

/* INICIO CORRECOES LOJA ONLINE 1.2 */
.shop-stock {
    min-width: 132px;
}

.shop-stock strong {
    font-size: 16px;
    line-height: 1.25;
}

.shop-stock.is-available strong {
    color: var(--success);
}

.shop-stock.is-unavailable strong {
    color: var(--danger);
}
/* FIM CORRECOES LOJA ONLINE 1.2 */
