/* Planilhas — site público e painel */

.sheet-section {
    padding: var(--space-6) 0;
}

.sheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

.sheet-empty {
    text-align: center;
    color: var(--color-gray-600);
    padding: var(--space-5);
}

.download-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.download-item {
    display: grid;
    gap: var(--space-4);
    align-items: center;
    padding: var(--space-5) var(--space-6);
    background: #fff;
    border: 1px solid var(--color-gray-100);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.download-item__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--color-gray-50);
    color: var(--color-primary-dark);
}

.download-item__title {
    margin: 0 0 var(--space-2);
    font-family: var(--font-display);
    font-size: var(--text-xl);
    color: var(--color-primary-dark);
}

.download-item__meta {
    margin: 0 0 var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-gray-500);
}

.download-item__sep {
    margin: 0 var(--space-2);
    opacity: 0.6;
}

.download-item__desc {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-gray-600);
    line-height: 1.55;
}

.download-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: var(--text-sm);
    font-weight: 700;
    text-decoration: none;
    border: 2px solid transparent;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.download-btn:hover {
    transform: translateY(-1px);
}

.download-btn--pdf {
    background: #c62828;
    color: #fff;
    box-shadow: 0 4px 14px rgba(198, 40, 40, 0.25);
}

.download-btn--xls {
    background: var(--color-accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(3, 190, 98, 0.25);
}

.download-btn--doc {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 104, 179, 0.25);
}

.download-btn--neutral {
    background: #fff;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.download-btn--disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.2);
}

.sheet-card__actions--downloads,
.sheet-detail__actions--downloads {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.pub-topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pub-topic-tags label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--color-gray-200);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    cursor: pointer;
}

.pub-topic-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    margin-right: 6px;
    margin-bottom: 6px;
}

.tool-embed__html {
    width: 100%;
    min-height: 420px;
}

/* Ferramentas HTML (calculadoras etc.) — altura conforme conteúdo, sem crop */
.powerbi-embed.tool-embed--widget,
.tool-embed.tool-embed--widget {
    aspect-ratio: auto;
    min-height: 0;
    height: auto;
    overflow: visible;
    background: transparent;
    box-shadow: none;
    padding: var(--space-4) var(--space-3);
}

.tool-embed--widget .tool-embed__html {
    min-height: 0;
}

.tool-embed--widget img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 540px) {
    .powerbi-embed.tool-embed--widget,
    .tool-embed.tool-embed--widget {
        padding: var(--space-3) var(--space-2);
    }
}

.indicator-card__interval {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--color-gray-500);
}

.indicators__grid--cards {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

@media (min-width: 768px) {
    .download-item {
        grid-template-columns: auto 1fr auto;
    }

    .download-item__actions {
        justify-content: flex-end;
        min-width: 220px;
    }
}

.sheet-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--color-gray-100);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    height: 100%;
}

/* display:flex acima sobrescreve o UA stylesheet de [hidden]; necessário para filtros do catálogo */
.sheet-card[hidden],
[data-catalog-item][hidden] {
    display: none !important;
}

.sheet-card__image-link {
    display: block;
    flex-shrink: 0;
    text-decoration: none;
}

.sheet-card__image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--color-gray-50, #f8fafc);
}

.sheet-card__image img,
.sheet-card__image-media {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
}

.sheet-card__image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sheet-card-tone-a, #e2e8f0) 0%, var(--sheet-card-tone-b, #cbd5e1) 100%);
}

.sheet-card__image-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    color: rgba(15, 23, 42, 0.45);
}

.sheet-card__image--green { --sheet-card-tone-a: #d9f2e4; --sheet-card-tone-b: #9fd4b8; }
.sheet-card__image--blue { --sheet-card-tone-a: #dbeafe; --sheet-card-tone-b: #93c5fd; }
.sheet-card__image--amber { --sheet-card-tone-a: #fef3c7; --sheet-card-tone-b: #fcd34d; }
.sheet-card__image--purple { --sheet-card-tone-a: #ede9fe; --sheet-card-tone-b: #c4b5fd; }
.sheet-card__image--teal { --sheet-card-tone-a: #ccfbf1; --sheet-card-tone-b: #5eead4; }
.sheet-card__image--orange { --sheet-card-tone-a: #ffedd5; --sheet-card-tone-b: #fdba74; }
.sheet-card__image--pink { --sheet-card-tone-a: #fce7f3; --sheet-card-tone-b: #f9a8d4; }
.sheet-card__image--indigo { --sheet-card-tone-a: #e0e7ff; --sheet-card-tone-b: #a5b4fc; }
.sheet-card__image--slate { --sheet-card-tone-a: #f1f5f9; --sheet-card-tone-b: #cbd5e1; }

.sheet-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: var(--space-4);
    gap: 8px;
}

.sheet-card__badge {
    display: inline-block;
    align-self: flex-start;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: 4px;
}

.sheet-card__badge--free {
    background: #e8f5e9;
    color: #2e7d32;
}

.sheet-card__badge--paid {
    background: #fff3e0;
    color: #e65100;
}

.sheet-card__cat {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-gray-500);
    margin-bottom: 4px;
}

.sheet-card__price {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-primary-dark);
}

.sheet-card__title {
    margin: 0;
    font-size: var(--text-base);
    font-family: var(--font-display);
    line-height: 1.3;
}

.sheet-card__title a {
    color: var(--color-gray-800);
    text-decoration: none;
}

.sheet-card__title a:hover {
    color: var(--color-primary);
}

.sheet-card__desc {
    margin: 0;
    flex: 1;
    font-size: var(--text-sm);
    color: var(--color-gray-600);
    line-height: 1.5;
}

.sheet-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.sheet-detail__price {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--color-primary);
    margin: 0 0 var(--space-2);
}

.sheet-detail__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.sheet-detail__cover {
    margin: var(--space-4) auto;
    max-width: 720px;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.sheet-detail__cover img {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(56vh, 480px);
    object-fit: contain;
    object-position: center;
    border-radius: var(--radius-md);
}

.sheet-detail__body {
    max-width: none;
    line-height: 1.75;
}

.sheet-detail__about {
    padding: var(--space-10) 0;
}

.sheet-detail__about-inner {
    margin-inline: auto;
}

.sheet-detail__about-title {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    font-weight: 800;
    color: var(--color-primary-dark);
    margin: 0 0 var(--space-5);
    text-align: left;
}

.sheet-detail__prose {
    text-align: left;
    color: var(--color-gray-700);
}

.sheet-detail__prose :is(h2, h3, h4) {
    text-align: left !important;
    font-family: var(--font-display);
    color: var(--color-primary-dark);
    margin: var(--space-6) 0 var(--space-3);
}

.sheet-detail__prose :is(h2, h3, h4):first-child {
    display: none;
}

.sheet-detail__prose p,
.sheet-detail__prose li,
.sheet-detail__prose ul,
.sheet-detail__prose ol {
    text-align: left !important;
}

.sheet-detail__prose p {
    margin: 0 0 var(--space-4);
}

.sheet-detail__prose ul,
.sheet-detail__prose ol {
    margin: 0 0 var(--space-4);
    padding-left: 1.25rem;
}

.sheet-detail__embed-section {
    padding-top: var(--space-8);
    padding-bottom: var(--space-6);
}

.sheet-detail__back {
    padding-top: var(--space-6);
    padding-bottom: var(--space-8);
}

.sheet-detail__intro {
    padding-top: var(--space-8);
    padding-bottom: var(--space-6);
}

.sheet-card__badge--embed {
    background: #e3f2fd;
    color: #1565c0;
}

.sheet-detail__embed-title {
    font-size: var(--text-xl);
    font-weight: 800;
    margin: 0 0 var(--space-2);
}

.sheet-detail__embed-hint {
    color: var(--color-text-muted, #666);
    margin: 0 0 var(--space-4);
    max-width: 720px;
}

.sheet-detail__embed-gate {
    max-width: 640px;
    padding: var(--space-5);
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border, #e0e0e0);
}

.powerbi-embed {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    min-height: 420px;
    background: #f5f5f5;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.powerbi-embed--detail {
    max-width: none;
    aspect-ratio: auto;
    min-height: min(78vh, 920px);
    height: min(78vh, 920px);
}

.container--wide {
    max-width: var(--container-wide, 1320px);
}

.powerbi-embed__frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.sheet-section__cta {
    text-align: center;
    margin-top: var(--space-5);
}

/* Painel */
.sheet-tag--free {
    background: #e8f5e9;
    color: #2e7d32;
}

.sheet-tag--paid {
    background: #fff3e0;
    color: #e65100;
}

.sheet-adm__stats {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .sheet-adm__stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.sheet-paid-fields {
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: var(--radius-sm);
}

.sheet-paid-fields[hidden] {
    display: none !important;
}

.usr-stat--ok .usr-stat__value {
    color: #2e7d32;
}

.dash-state-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-4, 1rem);
    margin-top: var(--space-4, 1rem);
}

.dash-state-buttons__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: var(--space-5, 1.25rem) var(--space-4, 1rem);
    border: 2px solid var(--color-primary, #0068b3);
    border-radius: 12px;
    background: #fff;
    color: var(--color-primary, #0068b3);
    text-align: center;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.dash-state-buttons__btn:hover {
    background: var(--color-primary, #0068b3);
    color: #fff;
    transform: translateY(-2px);
}

.dash-state-buttons__uf {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.dash-state-buttons__name {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
    opacity: 0.9;
}

.dash-state-buttons__btn:hover .dash-state-buttons__name {
    opacity: 1;
}
