.acp-market,
.acp-market * {
    box-sizing: border-box;
}

.acp-market {
    --acp-columns: 5;
    --acp-brand: var(--acp-primary, #3f7f4c);
    --acp-accent: var(--acp-accent, #b08a38);
    --acp-ink: #304239;
    --acp-title: #235332;
    --acp-muted: #66766d;
    --acp-line: #dce8df;
    --acp-surface: #ffffff;
    position: relative;
    isolation: isolate;
    width: 100%;
    overflow: hidden;
    border: 1px solid #dce8df;
    border-radius: 17px;
    background: linear-gradient(180deg, #fcfefc 0%, #f4f8f5 100%);
    color: var(--acp-ink);
    font-family: inherit;
    box-shadow: 0 9px 30px rgba(49, 93, 59, .07);
}

.acp-market.acp-theme-dark,
.acp-market.acp-theme-light {
    color: var(--acp-ink);
}

.acp-shell {
    position: relative;
    z-index: 2;
    padding: clamp(18px, 2.2vw, 28px);
}

.acp-grid-pattern,
.acp-glow,
.acp-card-shine {
    display: none;
}

.acp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 22px;
    margin-bottom: 17px;
}

.acp-heading-copy {
    max-width: 790px;
}

.acp-live-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    color: #3a7a48;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.acp-live-label i {
    position: relative;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4b9c5d;
    box-shadow: 0 0 0 4px rgba(75, 156, 93, .13);
}

.acp-live-label i::after {
    content: "";
    position: absolute;
    inset: -5px;
    border: 1px solid rgba(75, 156, 93, .42);
    border-radius: inherit;
    animation: acp-live-pulse 1.8s ease-out infinite;
}

.acp-header h2 {
    margin: 0;
    color: var(--acp-title);
    font-family: inherit;
    font-size: clamp(24px, 2.7vw, 34px);
    line-height: 1.08;
    letter-spacing: -.035em;
    font-weight: 850;
}

.acp-header p {
    margin: 8px 0 0;
    max-width: 760px;
    color: var(--acp-muted);
    font-size: 14px;
    line-height: 1.5;
}

.acp-header-meta {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
}

.acp-updated {
    min-width: 135px;
    padding: 8px 11px;
    border: 1px solid var(--acp-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .94);
}

.acp-updated span,
.acp-updated strong {
    display: block;
}

.acp-updated span {
    margin-bottom: 2px;
    color: #819087;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.acp-updated strong {
    color: #405148;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.acp-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid #b8d2bf;
    border-radius: 10px;
    background: #ffffff;
    color: #327342;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 850;
    transition: transform .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
}

.acp-refresh:hover {
    background: #3f834d;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(51, 116, 66, .18);
}

.acp-refresh svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.acp-refresh.is-loading svg {
    animation: acp-spin .72s linear infinite;
}

.acp-refresh.has-error {
    border-color: #e2a8a8;
    background: #fff4f4;
    color: #b54747;
}

.acp-filters {
    display: flex;
    gap: 7px;
    margin-bottom: 14px;
    overflow-x: auto;
    padding: 2px 0;
    scrollbar-width: none;
}

.acp-filters::-webkit-scrollbar {
    display: none;
}

.acp-filters button {
    flex: 0 0 auto;
    min-height: 33px;
    padding: 0 13px;
    border: 1px solid var(--acp-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .9);
    color: #596a60;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.acp-filters button:hover {
    transform: translateY(-1px);
}

.acp-filters button:hover,
.acp-filters button.is-active {
    border-color: #9fc8a8;
    background: #e7f4e9;
    color: #28693a;
    box-shadow: 0 3px 10px rgba(45, 109, 59, .08);
}

.acp-cards {
    display: block;
    min-width: 0;
    perspective: 900px;
}

.acp-available-grid {
    display: grid;
    grid-template-columns: repeat(var(--acp-columns), minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
}

.acp-available-grid[hidden],
.acp-unavailable-section[hidden],
.acp-card[hidden] {
    display: none !important;
}

.acp-card {
    --acp-trend: #78917f;
    --acp-trend-soft: #eef4ef;
    position: relative;
    min-width: 0;
    overflow: hidden;
    padding: 15px 14px 13px;
    border: 1px solid #dce7de;
    border-radius: 13px;
    background: #ffffff;
    box-shadow: 0 4px 14px rgba(45, 77, 52, .055);
    transition: transform .24s ease, border-color .24s ease, box-shadow .24s ease;
}

/* Estado inicial é aplicado apenas quando o JavaScript está disponível. */
.acp-market.acp-js .acp-card {
    opacity: 0;
    transform: translateY(34px) rotateX(9deg) scale(.94);
    transform-origin: center bottom;
}

.acp-market.acp-js .acp-card.is-visible {
    animation: acp-card-spring .78s cubic-bezier(.16, 1, .3, 1) both;
}

.acp-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--acp-trend), color-mix(in srgb, var(--acp-trend) 42%, #ffffff));
    transform: scaleX(0);
    transform-origin: left center;
}

.acp-card.is-visible::before {
    animation: acp-accent-sweep .82s .16s cubic-bezier(.16, 1, .3, 1) forwards;
}

.acp-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(110deg, transparent 15%, rgba(255,255,255,0) 34%, rgba(118, 184, 132, .18) 48%, rgba(255,255,255,0) 62%, transparent 82%);
    transform: translateX(-125%);
    pointer-events: none;
}

.acp-card.is-complete::after {
    animation: acp-card-shimmer .9s ease-out both;
}

.acp-card:hover {
    border-color: #b9d1be;
    box-shadow: 0 12px 28px rgba(44, 83, 53, .12);
    transform: translateY(-4px);
}

.acp-card.trend-up {
    --acp-trend: #379250;
    --acp-trend-soft: #e9f7ec;
}

.acp-card.trend-down {
    --acp-trend: #cf5656;
    --acp-trend-soft: #fff0f0;
}

.acp-card.trend-neutral {
    --acp-trend: #7f9485;
    --acp-trend-soft: #f0f4f1;
}

.acp-card.is-hidden {
    display: none;
}

.acp-card-top,
.acp-card-bottom,
.acp-card-copy,
.acp-chart {
    position: relative;
    z-index: 2;
}

.acp-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.acp-icon-wrap {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid color-mix(in srgb, var(--acp-trend) 26%, #dce8df);
    border-radius: 11px;
    background: var(--acp-trend-soft);
    color: var(--acp-trend);
}

.acp-card.is-visible .acp-icon-wrap {
    animation: acp-icon-pop .72s .18s cubic-bezier(.16, 1, .3, 1) both;
}

.acp-icon-wrap svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.acp-source {
    overflow: hidden;
    max-width: 70%;
    color: #74847a;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .045em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.acp-card-copy {
    margin-top: 11px;
}

.acp-card h3 {
    margin: 0;
    color: #304239;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: -.012em;
    font-weight: 850;
}

.acp-location {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
    color: #6d7d73;
    font-size: 11px;
    font-weight: 700;
}

.acp-location svg {
    width: 11px;
    height: 11px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
}

.acp-price-block {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 11px;
}

.acp-price-block strong {
    position: relative;
    display: inline-block;
    color: #1f5a30;
    font-size: clamp(24px, 2vw, 30px);
    line-height: 1;
    letter-spacing: -.045em;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.acp-price-block strong.is-counting {
    color: var(--acp-trend);
    text-shadow: 0 0 18px color-mix(in srgb, var(--acp-trend) 24%, transparent);
}

.acp-price-block strong.has-counted {
    animation: acp-number-finish .58s ease-out;
}

.acp-price-block span {
    max-width: 116px;
    color: #687970;
    font-size: 11px;
    line-height: 1.25;
    font-weight: 700;
}

.acp-chart {
    height: 38px;
    margin: 10px -2px 5px;
    color: var(--acp-trend);
    opacity: .82;
}

.acp-chart svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.acp-chart polyline {
    stroke-dasharray: 420;
    stroke-dashoffset: 420;
}

.acp-card.is-visible .acp-chart polyline {
    animation: acp-line-draw 1.15s .34s cubic-bezier(.4, 0, .2, 1) forwards;
}

.acp-chart polygon {
    opacity: 0;
}

.acp-card.is-visible .acp-chart polygon {
    animation: acp-area-fade .72s .82s ease forwards;
}

.acp-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-top: 9px;
    border-top: 1px solid #edf2ee;
}

.acp-variation {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 29px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.acp-variation b {
    font-size: 14px;
    line-height: 1;
}

.acp-variation [data-acp-variation-number].is-counting {
    display: inline-block;
    min-width: 45px;
}

.acp-variation.is-up {
    border-color: #bee0c6;
    background: #e9f7ec;
    color: #24733a;
}

.acp-variation.is-down {
    border-color: #edc7c7;
    background: #fff0f0;
    color: #b74848;
}

.acp-variation.is-neutral {
    border-color: #dce4de;
    background: #f0f4f1;
    color: #647269;
}

.acp-card.is-visible .acp-variation.is-up,
.acp-card.is-visible .acp-variation.is-down {
    animation: acp-variation-pop .65s .68s cubic-bezier(.16, 1, .3, 1) both;
}

.acp-date {
    overflow: hidden;
    color: #697970;
    font-size: 10px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* Produtos selecionados ainda sem registro na Conab. */
.acp-unavailable-section {
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--acp-line);
}

.acp-unavailable-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.acp-unavailable-heading > div {
    min-width: 0;
}

.acp-unavailable-heading strong,
.acp-unavailable-heading span {
    display: block;
}

.acp-unavailable-heading strong {
    color: #405148;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 850;
}

.acp-unavailable-heading > div > span {
    margin-top: 2px;
    color: #7a887f;
    font-size: 10px;
    line-height: 1.4;
    font-weight: 650;
}

.acp-unavailable-count {
    display: grid !important;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border: 1px solid #d8e2da;
    border-radius: 999px;
    background: #f0f4f1;
    color: #647269 !important;
    font-size: 11px !important;
    font-weight: 850 !important;
}

.acp-unavailable-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 9px;
    align-items: stretch;
}

.acp-card.is-unavailable {
    --acp-trend: #84958a;
    --acp-trend-soft: #f0f4f1;
    min-height: 0;
    padding: 11px;
    border-style: dashed;
    border-radius: 11px;
    background: linear-gradient(180deg, #ffffff 0%, #f8faf8 100%);
    box-shadow: 0 3px 10px rgba(45, 77, 52, .04);
}

.acp-card.is-unavailable:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(44, 83, 53, .08);
}

.acp-unavailable-card-top {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
}

.acp-card.is-unavailable .acp-icon-wrap {
    width: 31px;
    height: 31px;
    flex-basis: 31px;
    border-radius: 9px;
}

.acp-card.is-unavailable .acp-icon-wrap svg {
    width: 16px;
    height: 16px;
}

.acp-unavailable-name {
    min-width: 0;
}

.acp-card.is-unavailable h3 {
    overflow: hidden;
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acp-card.is-unavailable .acp-location {
    display: flex;
    overflow: hidden;
    max-width: 100%;
    margin-top: 3px;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acp-unavailable-message {
    position: relative;
    z-index: 2;
    min-height: 0;
    margin-top: 9px;
    padding: 9px;
    border: 1px solid #e0e8e2;
    border-radius: 9px;
    background: #f3f7f4;
}

.acp-unavailable-message strong,
.acp-unavailable-message span {
    display: block;
}

.acp-unavailable-message strong {
    color: #46564d;
    font-size: 10px;
    line-height: 1.3;
    font-weight: 850;
}

.acp-unavailable-message span {
    margin-top: 3px;
    color: #7a877f;
    font-size: 9px;
    line-height: 1.35;
    font-weight: 650;
}

.acp-card.is-unavailable::after {
    display: none;
}

.acp-footer-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--acp-line);
    color: #67786e;
    font-size: 10px;
    line-height: 1.5;
}

.acp-footer-note svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.acp-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 210px;
    padding: 28px;
    border: 1px dashed #cddccf;
    border-radius: 13px;
    background: #ffffff;
    text-align: center;
}

.acp-empty-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 10px;
    border-radius: 14px;
    background: #edf6ef;
    color: #4d8659;
}

.acp-empty-icon svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

.acp-empty strong {
    color: #334039;
    font-size: 15px;
}

.acp-empty span {
    margin-top: 5px;
    color: #727f76;
    font-size: 11px;
}

@keyframes acp-card-spring {
    0% {
        opacity: 0;
        transform: translateY(34px) rotateX(9deg) scale(.94);
    }
    65% {
        opacity: 1;
        transform: translateY(-5px) rotateX(0) scale(1.015);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0) scale(1);
    }
}

@keyframes acp-accent-sweep {
    0% { transform: scaleX(0); }
    100% { transform: scaleX(1); }
}

@keyframes acp-card-shimmer {
    0% { transform: translateX(-125%); }
    100% { transform: translateX(125%); }
}

@keyframes acp-icon-pop {
    0% { opacity: 0; transform: scale(.25) rotate(-24deg); }
    70% { opacity: 1; transform: scale(1.12) rotate(4deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes acp-line-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes acp-area-fade {
    to { opacity: 1; }
}

@keyframes acp-number-finish {
    0% { transform: scale(1); }
    45% { transform: scale(1.09); }
    100% { transform: scale(1); }
}

@keyframes acp-variation-pop {
    0% { opacity: 0; transform: translateX(-9px) scale(.8); }
    70% { opacity: 1; transform: translateX(2px) scale(1.06); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes acp-live-pulse {
    0% { transform: scale(.55); opacity: .8; }
    70%, 100% { transform: scale(1.8); opacity: 0; }
}

@keyframes acp-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1300px) {
    .acp-available-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .acp-unavailable-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
    .acp-available-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .acp-unavailable-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .acp-shell { padding: 16px; }
    .acp-header { display: block; }
    .acp-header-meta { justify-content: space-between; margin-top: 14px; }
    .acp-available-grid,
    .acp-unavailable-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .acp-header p { font-size: 13px; }
}

@media (max-width: 470px) {
    .acp-market { border-radius: 12px; }
    .acp-refresh span { display: none; }
    .acp-refresh { width: 42px; padding: 0; }
    .acp-available-grid,
    .acp-unavailable-grid { grid-template-columns: 1fr; }
    .acp-card { padding: 16px; }
    .acp-card h3 { font-size: 17px; }
    .acp-price-block strong { font-size: 30px; }
    .acp-variation { font-size: 13px; }
    .acp-date { font-size: 11px; }
}

@supports not (color: color-mix(in srgb, red, blue)) {
    .acp-card::before { background: var(--acp-trend); }
    .acp-icon-wrap { border-color: #d4e2d7; }
    .acp-price-block strong.is-counting { text-shadow: none; }
}

/* Mesmo com “reduzir movimento”, mantém uma entrada curta em vez de ocultar tudo. */
@media (prefers-reduced-motion: reduce) {
    .acp-market.acp-js .acp-card.is-visible {
        animation-duration: .32s;
    }

    .acp-card.is-visible::before,
    .acp-card.is-visible .acp-icon-wrap,
    .acp-card.is-visible .acp-chart polyline,
    .acp-card.is-visible .acp-chart polygon,
    .acp-card.is-visible .acp-variation {
        animation-duration: .35s;
        animation-delay: .05s;
    }
}
