
/* ═══════════════════════════════════════════════════════════════════════════
   WEB VITALS — CSS exclusivo para Lighthouse + CruX + Badges
═══════════════════════════════════════════════════════════════════════════ */

/* Anel Lighthouse: permite animar o preenchimento (PageSpeed-style) */
@property --ring-p {
    syntax: '<number>';
    inherits: false;
    initial-value: 0;
}

#tab-vitals button.wv-strategy-btn,
#tab-vitals button.wv-chip,
#tab-lighthouse-badges button.wv-strategy-btn,
#tab-lighthouse-badges button.wv-chip {
    font-family: var(--font-body, system-ui, -apple-system, sans-serif);
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    margin: 0;
}

/* ── Start / Empty State ─────────────────────────────────────────────── */
.wv-start-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
    text-align: center;
}

.wv-start-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.wv-start-text {
    color: var(--text-secondary);
    font-size: 0.92rem;
    max-width: 400px;
    margin: 0;
    line-height: 1.6;
}

.wv-start-btn {
    padding: 14px 32px;
    font-size: 0.95rem;
}

/* ── Metrics Grid ────────────────────────────────────────────────────── */
.wv-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* Resumo Lighthouse: empilhado (largura = grelha Infraestrutura); PSI em 3 caixas + laboratório por baixo */
.wv-resumo-split {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: stretch;
    margin-top: 4px;
}

.wv-resumo-panel {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 16px 20px;
}

.wv-resumo-panel-title {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 8px;
}

.wv-resumo-panel-lede {
    margin: 0 0 16px;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.wv-resumo-panel-lede code {
    font-size: 0.78em;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--bg-surface);
    border: 1px solid var(--border-soft, var(--border));
}

/* Três caixas PSI (resumo Lighthouse — mesmo max-width que o resto do painel) */
.wv-lh-categories-stack {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.wv-lh-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 12px 16px;
    min-width: 0;
}

.wv-lh-box--wide {
    width: 100%;
    box-sizing: border-box;
}

.wv-lh-box-title {
    margin: 0 0 4px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 6px;
}

.wv-lh-box-title--lg {
    font-size: 0.95rem;
}

.wv-lh-box-lede {
    margin: 0 0 12px;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.wv-lh-box-lede code {
    font-size: 0.72rem;
}

.wv-lh-box-body--center {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.wv-lh-box-body--cats {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.wv-lh-box-body--cats .wv-resumo-psi__cats {
    width: 100%;
}

.wv-lh-box-body--device {
    display: flex;
    justify-content: center;
}

.wv-resumo-psi__avg {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
}

.wv-resumo-psi__cats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 22px;
    min-width: 0;
}

.wv-resumo-psi__device {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 4px 2px 0;
    min-width: 0;
}

.wv-device-art {
    color: var(--accent, #A8D8C8);
    width: 100%;
    max-width: 168px;
    padding: 18px 14px 20px;
    border-radius: var(--r-lg);
    background: linear-gradient(160deg, rgba(168, 216, 200, 0.14), rgba(168, 216, 200, 0.03));
    border: 1px solid rgba(168, 216, 200, 0.22);
    box-shadow: 0 10px 28px var(--accent-glow);
}

.wv-device-svg {
    width: 100%;
    height: auto;
    max-height: 220px;
    display: block;
    margin: 0 auto;
}

.wv-lh-categories-stack[data-strategy='mobile'] .wv-device-svg--desktop,
.wv-lh-categories-stack[data-strategy='desktop'] .wv-device-svg--phone {
    display: none;
}

.wv-device-caption {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    text-align: center;
    max-width: 11rem;
    line-height: 1.35;
}

@media (max-width: 960px) {
    .wv-lh-categories-stack {
        grid-template-columns: 1fr;
    }

    .wv-resumo-psi__cats {
        max-width: 100%;
    }

    .wv-device-art {
        max-width: 200px;
    }
}

.wv-metrics-grid--loading .wv-metric-card {
    position: relative;
    overflow: hidden;
}

.wv-metrics-grid--loading .wv-metric-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(168, 216, 200, 0.10) 50%,
        transparent 60%
    );
    background-size: 200% 100%;
    animation: wvCardShimmer 1.35s ease-in-out infinite;
    pointer-events: none;
}

@keyframes wvCardShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Skeleton dos anéis (à espera do Google) */
.wv-ring-skel {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: conic-gradient(from -90deg, var(--border) 0deg, rgba(168, 216, 200, 0.18) 120deg, var(--border) 240deg);
    animation: wvRingSpin 2.2s linear infinite;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.wv-ring-skel--lg {
    width: 124px;
    height: 124px;
}

.wv-ring-skel-inner {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

.wv-ring-skel--lg .wv-ring-skel-inner {
    width: 90px;
    height: 90px;
    font-size: 0.8rem;
}

@keyframes wvRingSpin {
    to { transform: rotate(360deg); }
}

.wv-ring-skel-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.wv-ring-skel-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    max-width: 120px;
}

@media (max-width: 768px) {
    .wv-metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .wv-metrics-grid { grid-template-columns: 1fr; }
}

.wv-metric-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px 16px;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    transition: border-color 0.25s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.wv-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

/* Ícones */
.wv-metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
}

.wv-icon-fcp  { background: var(--accent-2-glow); color: var(--accent-2); }
.wv-icon-lcp  { background: var(--accent-soft); color: var(--accent); }
.wv-icon-tbt  { background: rgba(239, 68, 68, 0.08);  color: #ef4444; }
.wv-icon-cls  { background: rgba(245, 158, 11, 0.1);  color: #f59e0b; }
.wv-icon-spi  { background: rgba(34, 197, 94, 0.1);   color: #22c55e; }
.wv-icon-score { background: var(--accent); color: var(--text-on-accent); }
.wv-icon-ttfb { background: rgba(6, 182, 212, 0.1);   color: #06b6d4; }

.wv-metric-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

.wv-metric-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

/* Score card especial */
.wv-score-card {
    background: var(--accent-soft);
    border-color: var(--accent-glow);
}

.wv-score-value {
    font-size: 1.8rem;
}

/* Loading animation */
.wv-metric-value.val-loader {
    color: var(--text-muted);
    animation: wvPulse 0.8s ease-in-out infinite alternate;
}

@keyframes wvPulse {
    from { opacity: 1; }
    to   { opacity: 0.3; }
}

/* Error state */
.vitals-grid--error {
    opacity: 0.4;
    pointer-events: none;
}

/* ── Error Card ──────────────────────────────────────────────────────── */
.vitals-error-card {
    background: rgba(239, 68, 68, 0.04);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--r-lg);
    padding: 24px;
    margin-bottom: 20px;
}

[data-theme="dark"] .vitals-error-card {
    background: rgba(239, 68, 68, 0.06);
}

.wv-error-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.wv-error-icon {
    flex-shrink: 0;
    color: #ef4444;
}

.wv-error-body {
    flex: 1;
}

.wv-error-body strong {
    display: block;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.wv-error-body p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.wv-error-body code {
    display: block;
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-height: 70px;
    overflow-y: auto;
    word-break: break-word;
    white-space: pre-wrap;
}


.wv-error-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.wv-retry-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.wv-retry-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.15);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.2);
}

/* ── Badges Section ──────────────────────────────────────────────────── */
.wv-badges-section {
    margin-top: 24px;
}

.wv-badges-hint {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0 0 16px;
}

.wv-badges-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wv-badge-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 10px 14px;
    transition: border-color 0.2s var(--ease);
}

.wv-badge-row:hover {
    border-color: var(--accent-2);
}

.wv-badge-img {
    height: 20px;
    flex-shrink: 0;
}

.wv-badge-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    cursor: text;
}

#tab-vitals .wv-badge-input:-webkit-autofill,
#tab-lighthouse-badges .wv-badge-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px var(--bg-raised) inset;
    box-shadow: 0 0 0 30px var(--bg-raised) inset;
}

/* Copiar badge: mesmo padrão .code-copy-icon-btn (app.css) */
#tab-vitals .wv-badge-row .code-copy-icon-btn.wv-badge-copy,
#tab-lighthouse-badges .wv-badge-row .code-copy-icon-btn.wv-badge-copy {
    flex-shrink: 0;
}

#tab-vitals .wv-badge-row .code-copy-icon-btn.wv-badge-copy.is-copied,
#tab-vitals .wv-badge-row .code-copy-icon-btn.wv-badge-copy.wv-badge-copied,
#tab-lighthouse-badges .wv-badge-row .code-copy-icon-btn.wv-badge-copy.is-copied,
#tab-lighthouse-badges .wv-badge-row .code-copy-icon-btn.wv-badge-copy.wv-badge-copied {
    color: #22c55e;
}

/* ── CruX Section ────────────────────────────────────────────────────── */
.wv-crux-section {
    margin-top: 24px;
}

.wv-crux-hint {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.5;
}

/* ── Score Dinâmico ──────────────────────────────────────────────────── */
.wv-score-excellent { color: var(--accent) !important; }
.wv-score-fair      { color: var(--warning) !important; }
.wv-score-poor      { color: var(--error) !important; }

.wv-score-excellent-card {
    background: var(--accent-soft);
    border-color: rgba(168, 216, 200, 0.2);
}

.wv-score-fair-card {
    background: var(--warning-soft);
    border-color: rgba(251, 191, 36, 0.2);
}

.wv-score-poor-card {
    background: var(--error-soft);
    border-color: rgba(248, 113, 113, 0.2);
}

.wv-score-excellent-icon { background: var(--accent-soft); color: var(--accent); }
.wv-score-fair-icon      { background: var(--warning-soft); color: var(--warning); }
.wv-score-poor-icon      { background: var(--error-soft); color: var(--error); }

.wv-opp-item--roi {
    border-color: var(--accent-glow);
    background: linear-gradient(180deg, var(--bg-surface), var(--bg-raised));
}

.wv-roi-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: var(--r-sm);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wv-compare-body,
.wv-history-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wv-compare-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 16px;
}

.wv-compare-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 18px;
}

.wv-compare-card h3 {
    margin: 0 0 12px;
    color: var(--text-primary);
    font-size: 1rem;
}

.wv-compare-hero {
    margin: 0 0 8px;
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 800;
}

.wv-compare-copy {
    margin: 0 0 10px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.wv-compare-mini {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.wv-compare-mini span {
    display: block;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    background: var(--bg-raised);
}

.wv-compare-mini strong {
    color: var(--text-primary);
}

.wv-delta-good {
    color: var(--accent) !important;
    font-weight: 800;
}

.wv-delta-bad {
    color: var(--error) !important;
    font-weight: 800;
}

.wv-history-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.wv-history-stat {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-surface);
}

.wv-history-stat span,
.wv-history-stat strong,
.wv-history-stat small {
    display: block;
}

.wv-history-stat span {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wv-history-stat strong {
    margin-top: 6px;
    color: var(--text-primary);
    font-size: 2rem;
    line-height: 1;
}

.wv-history-stat small {
    margin-top: 6px;
    color: var(--text-secondary);
}

.wv-history-note {
    padding: 12px 14px;
    border: 1px solid var(--accent-glow);
    border-radius: var(--r-sm);
    background: var(--accent-soft);
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.86rem;
}

@media (max-width: 900px) {
    .wv-compare-grid,
    .wv-history-stats {
        grid-template-columns: 1fr;
    }
}

/* ── Toolbar: estratégia + chips de vista ─────────────────────────── */
.wv-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 20px;
    padding: 16px 18px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

/* Barra de progresso enquanto o PageSpeed/Lighthouse responde */
.wv-toolbar-progress {
    display: none;
    height: 3px;
    margin-top: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--border);
}

.wv-toolbar-progress:not([hidden]) {
    display: block;
    position: relative;
}

.wv-toolbar-progress:not([hidden])::before {
    content: '';
    display: block;
    height: 100%;
    width: 42%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #818cf8, var(--accent));
    animation: wvToolbarProgSlide 1.05s ease-in-out infinite;
    will-change: transform;
}

@keyframes wvToolbarProgSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(340%); }
}

.wv-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 0;
}

.wv-toolbar-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex: 1 1 200px;
    line-height: 1.45;
}

.wv-strategy-group {
    display: inline-flex;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.wv-strategy-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.wv-strategy-btn + .wv-strategy-btn {
    border-left: 1px solid var(--border);
}

.wv-strategy-btn:hover {
    color: var(--text-primary);
    background: var(--accent-soft);
}

.wv-strategy-btn.active {
    background: var(--accent);
    color: var(--text-on-accent);
}

.wv-start-strategy {
    display: inline-flex;
    gap: 0;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 4px;
}

.wv-start-strategy .wv-strategy-btn {
    padding: 10px 20px;
}

.wv-view-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: none;
    width: 100%;
    box-sizing: border-box;
}

.wv-chip {
    padding: 7px 14px;
    border-radius: var(--r-md, 8px);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}

.wv-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.wv-chip.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.wv-view-panel {
    margin-bottom: 8px;
}

.wv-panel-lede {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0 0 14px;
    line-height: 1.5;
}

/* ── Quatro scores (anéis) ─────────────────────────────────────────── */
.wv-rings-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px 36px;
    padding: 12px 8px 24px;
}

.wv-ring-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.wv-ring {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    /* --ring-p: 0–100 (score); preenchimento proporcional + faixa «restante» */
    background: conic-gradient(
        from -90deg,
        var(--ring-fill, var(--accent)) 0deg,
        var(--ring-fill, var(--accent)) calc(var(--ring-p, 0) * 3.6deg),
        var(--ring-track, rgba(0, 0, 0, 0.08)) 0deg
    );
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
    transition: --ring-p 1.12s cubic-bezier(0.22, 1, 0.36, 1);
}

.wv-ring--avg {
    width: 124px;
    height: 124px;
}

.wv-ring--avg .wv-ring-inner {
    width: 90px;
    height: 90px;
}

.wv-ring--avg .wv-ring-num {
    font-size: 1.65rem;
}

.wv-ring--na {
    background: var(--border);
}

.wv-ring-inner {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-sm);
}

.wv-ring-num {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
}

.wv-ring-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    max-width: 120px;
    line-height: 1.3;
}

/* ── Filmstrip ─────────────────────────────────────────────────────── */
.wv-filmstrip {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    padding: 8px 4px 16px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.wv-filmstrip-thumb {
    flex: 0 0 auto;
    width: 120px;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    scroll-snap-align: start;
    background: var(--bg-surface);
}

.wv-empty-msg {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
    padding: 12px 0;
}

/* ── Auditorias aprovadas ──────────────────────────────────────────── */
.wv-passed-details {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 0 14px 12px;
    background: var(--bg-raised);
}

.wv-passed-details summary {
    cursor: pointer;
    padding: 14px 0;
    font-weight: 700;
    color: var(--text-primary);
    list-style: none;
}

.wv-passed-details summary::-webkit-details-marker {
    display: none;
}

.wv-passed-list {
    margin: 0;
    padding: 0 0 0 1.1rem;
    max-height: 320px;
    overflow-y: auto;
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

.wv-passed-list li {
    margin-bottom: 6px;
}

/* ── Oportunidades ─────────────────────────────────────────────────── */
.wv-opp-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wv-opp-item {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-raised);
}

.wv-opp-item strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.wv-opp-extra {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    margin-left: 0;
}

.wv-opp-desc {
    margin: 8px 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.wv-opp-table-wrap {
    margin-top: 12px;
    overflow-x: auto;
    border-radius: var(--r-md);
    border: 1px solid var(--border-soft);
    background: var(--bg-surface);
}

.wv-opp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.wv-opp-table th,
.wv-opp-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: top;
    color: var(--text-secondary);
}

.wv-opp-table th {
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-raised);
}


.wv-opp-table tr:last-child td {
    border-bottom: none;
}

.wv-opp-table a {
    color: var(--accent);
    word-break: break-all;
}

.wv-opp-cell-pre {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
}

/* ── Vista LCP + CO₂ ─────────────────────────────────────────────────── */
.wv-lcp-breakdown {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wv-lcp-card {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-raised);
}

.wv-lcp-card.wv-lcp-warn {
    border-color: rgba(217, 119, 6, 0.45);
    background: var(--warning-soft);
}

.wv-lcp-subtitle {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.wv-lcp-meta {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.wv-lcp-meta code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    word-break: break-all;
}

.wv-lcp-snippet {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    background: var(--bg-code);
    color: var(--text-code);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    overflow-x: auto;
    max-height: 140px;
    overflow-y: auto;
}

.wv-co2-block {
    margin-top: 8px;
}

.wv-co2-inner {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--bg-raised);
}

.wv-co2-line {
    margin: 6px 0 0;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.wv-co2-disclaimer {
    margin: 10px 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
}

/* ── Terceiros ────────────────────────────────────────────────────────── */
.wv-third-party-body {
    overflow-x: auto;
}

/* ── CruX: INP histograma + long tasks ─────────────────────────────────── */
.wv-inp-extras {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.wv-inp-extras-title {
    margin: 16px 0 6px 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.wv-inp-extras-title:first-child {
    margin-top: 0;
}

.wv-inp-extras-hint {
    margin: 0 0 10px 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.wv-inp-dist-row {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 16px;
    border-radius: var(--r-sm);
    overflow: hidden;
    border: 1px solid var(--border-soft);
}

.wv-inp-seg {
    min-width: 4px;
    height: 100%;
    transition: opacity var(--dur) var(--ease);
}

.wv-inp-legend {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Cartão branco — Long tasks (alinhado ao estilo SSL / cartões da infra) */
.wv-long-tasks-card {
    margin-top: 22px;
    padding: 18px 20px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}

.wv-long-tasks-card > .wv-inp-extras-title {
    margin-top: 0;
    margin-bottom: 6px;
}

.wv-long-tasks-card > .wv-inp-extras-hint {
    margin-top: 0;
    margin-bottom: 0;
}

.wv-long-tasks-wrap {
    margin-top: 14px;
    overflow-x: auto;
}

.wv-long-tasks-wrap > .wv-empty-msg:only-child {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--r-md);
    border: 1px dashed var(--border);
    background: var(--bg-body);
}

.wv-long-tasks-footnote {
    margin-top: 12px;
    margin-bottom: 0;
}

/* ── Layout expandido: todas as vistas visíveis (após relatório pronto) ─── */
.vitals-wrapper.wv--stacked .wv-view-panels.wv--stacked {
    display: flex;
    flex-direction: column;
    gap: 28px;
    margin-top: 8px;
}

.vitals-wrapper.wv--stacked .wv-view-panels.wv--stacked .wv-view-panel {
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 18px 22px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.vitals-wrapper.wv--stacked .wv-view-panels.wv--stacked .wv-panel-lede {
    margin-top: 0;
}

/* ── Core Web Vitals — faixas estilo PageSpeed (cards + barra tricolor) ─ */
.df-cwv-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 0 0 18px;
}

.df-cwv-strip--compact {
    gap: 10px;
    margin: 0;
}

.df-cwv-strip--compact .df-cwv-card {
    padding: 12px 12px 14px;
}

.df-cwv-strip--compact .df-cwv-card__title {
    font-size: 0.78rem;
}

.df-cwv-strip--compact .df-cwv-card__lede {
    font-size: 0.72rem;
    min-height: 2.6em;
}

.df-cwv-strip--loading {
    pointer-events: none;
    opacity: 0.72;
}

.df-cwv-card {
    position: relative;
    box-sizing: border-box;
    padding: 14px 14px 16px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    min-width: 0;
}

.df-cwv-card__head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.df-cwv-status {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    margin-top: 1px;
    background: var(--text-muted);
    opacity: 0.35;
    position: relative;
}

.df-cwv-status--good {
    background: #22c55e;
    opacity: 1;
    box-shadow: 0 0 0 2px color-mix(in srgb, #22c55e 35%, transparent);
}

.df-cwv-status--good::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.df-cwv-status--warn {
    background: #f59e0b;
    opacity: 1;
    box-shadow: 0 0 0 2px color-mix(in srgb, #f59e0b 30%, transparent);
}

.df-cwv-status--warn::after {
    content: '!';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #1a1a1a;
}

.df-cwv-status--bad {
    background: #ef4444;
    opacity: 1;
    box-shadow: 0 0 0 2px color-mix(in srgb, #ef4444 30%, transparent);
}

.df-cwv-status--bad::after {
    content: '×';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.df-cwv-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 8px;
}

.df-cwv-card__title {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
}

.df-cwv-card__pill {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft, var(--border));
    color: var(--text-muted);
    white-space: nowrap;
}

.df-cwv-info {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    font-style: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    cursor: help;
}

.df-cwv-card__lede {
    margin: 0 0 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
    min-height: 3em;
}

.df-cwv-card__lede a {
    color: var(--accent, #60a5fa);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Micro-sparkline (histograma delicado, inspirado em grelhas tipo CrUX / dashboard) */
.df-cwv-sparkline {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 3px;
    height: 24px;
    margin: 0 0 8px;
    padding: 0 1px;
    box-sizing: border-box;
}

.df-cwv-strip--compact .df-cwv-sparkline {
    height: 20px;
    gap: 2px;
    margin-bottom: 6px;
}

.df-cwv-sparkline__bar {
    flex: 1;
    min-width: 2px;
    max-width: 10px;
    border-radius: 99px;
    align-self: stretch;
    min-height: 4px;
    height: 22%;
    background: rgba(148, 163, 184, 0.4);
    transition: height 0.22s ease, opacity 0.18s ease, filter 0.18s ease;
}

.df-cwv-card[data-cwv-rating="good"] .df-cwv-sparkline__bar {
    background: linear-gradient(180deg, #86efac 0%, #22c55e 96%);
    filter: saturate(1.05);
}

.df-cwv-card[data-cwv-rating="warn"] .df-cwv-sparkline__bar {
    background: linear-gradient(180deg, #fcd34d 0%, #d97706 96%);
    filter: saturate(1.02);
}

.df-cwv-card[data-cwv-rating="bad"] .df-cwv-sparkline__bar {
    background: linear-gradient(180deg, #fca5a5 0%, #dc2626 96%);
}

.df-cwv-card[data-cwv-rating="na"] .df-cwv-sparkline__bar {
    background: rgba(148, 163, 184, 0.38);
}

.df-cwv-card[data-cwv-rating="good"] .df-cwv-card__value {
    color: #86efac;
}

.df-cwv-card[data-cwv-rating="warn"] .df-cwv-card__value {
    color: #fcd34d;
}

.df-cwv-card[data-cwv-rating="bad"] .df-cwv-card__value {
    color: #fca5a5;
}

.df-cwv-gauge-wrap {
    position: relative;
    margin: 6px 0 4px;
    padding-top: 10px;
}

.df-cwv-gauge {
    position: relative;
    height: 10px;
    border-radius: 5px;
    overflow: visible;
    background: linear-gradient(
        90deg,
        #22c55e 0%,
        #22c55e 33%,
        #f59e0b 33%,
        #f59e0b 66%,
        #ef4444 66%,
        #ef4444 100%
    );
    opacity: 0.9;
}

.df-cwv-gauge__marker {
    position: absolute;
    top: 50%;
    margin-top: -4px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 9px solid var(--text-primary);
    transform: translate(-50%, -100%);
    left: 0;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.df-cwv-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.df-cwv-card__value {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.1;
}

.df-cwv-detail {
    margin-top: 12px;
    padding: 10px 11px;
    border-radius: var(--r-sm);
    background: var(--bg-raised);
    border: 1px solid var(--border-soft, var(--border));
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.df-cwv-detail-title {
    display: block;
    margin-bottom: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
}

.df-cwv-detail-line {
    margin: 6px 0 0;
}

.df-cwv-detail-line span {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.df-cwv-detail-line code {
    font-size: 0.72rem;
    word-break: break-word;
}

.df-cwv-detail-pre {
    margin: 4px 0 0;
    padding: 8px;
    border-radius: 6px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    font-size: 0.68rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 120px;
    overflow: auto;
}

.wv-metrics-grid--rest {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#tab-vitals .wv-lh-lab-panel .wv-metrics-grid--rest {
    margin-top: 0;
}

.df-overview-card--cwv-banner {
    width: 100%;
    grid-column: 1 / -1;
}

.df-overview-stack--cwv {
    margin-top: 10px;
}

.df-overview-row--cwv {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.df-cwv-banner-head {
    margin-bottom: 12px;
}

.df-cwv-banner-head h2 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.df-cwv-banner-note {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
}

@media (max-width: 960px) {
    .df-cwv-strip {
        grid-template-columns: 1fr;
    }

    .wv-metrics-grid--rest {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .wv-metrics-grid--rest {
        grid-template-columns: 1fr;
    }
}
