/* ═════════════════════════════════════════════════════════════
   Consolidado Ventas — High-End Dashboard Styles
   ═════════════════════════════════════════════════════════════ */

/* ── KPI Summary Cards ── */
.cv-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.cv-kpi-card {
    position: relative;
    padding: 18px 20px;
    border-radius: 0.75rem;
    overflow: hidden;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cv-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.cv-kpi-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.7;
    z-index: 0;
    border-radius: inherit;
}

.cv-kpi-1::before {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(6, 78, 59, 0.35) 50%, rgba(15, 23, 42, 0.5) 100%);
}

.cv-kpi-2::before {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(49, 46, 129, 0.35) 50%, rgba(15, 23, 42, 0.5) 100%);
}

.cv-kpi-3::before {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(120, 53, 15, 0.35) 50%, rgba(15, 23, 42, 0.5) 100%);
}

.cv-kpi-label {
    position: relative;
    z-index: 1;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 6px;
}

.cv-kpi-value {
    position: relative;
    z-index: 1;
    font-size: 1.6rem;
    font-weight: 800;
    color: #f1f5f9;
    line-height: 1.1;
    font-family: 'Inter', 'JetBrains Mono', system-ui, sans-serif;
}

.cv-kpi-sub {
    position: relative;
    z-index: 1;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 4px;
}

.cv-kpi-bottom {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
}

.cv-kpi-delta {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1.1;
    transition: opacity 0.3s ease;
}

.cv-kpi-delta.up {
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
}

.cv-kpi-delta.down {
    color: #f87171;
    background: rgba(248, 113, 113, 0.15);
}

.cv-kpi-delta.flat {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
}

/* ── Compact Toolbar ── */
.cv-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.65);
    border: 1px solid rgba(51, 65, 85, 0.3);
    border-radius: 0.5rem;
    position: relative;
    z-index: 10;
    overflow: visible;
}

/* ── Table container ── */
.cv-table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 72vh;
    border: 1px solid rgba(51, 65, 85, 0.25);
    border-radius: 0.6rem;
    background: rgba(15, 23, 42, 0.4);
}

.cv-table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

/* ── Table header ── */
.cv-th {
    padding: 10px 12px;
    text-align: left;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: #1e293b;
    z-index: 2;
    border-bottom: 2px solid rgba(51, 65, 85, 0.4);
}

.cv-th-sort {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease;
}

.cv-th-sort:hover {
    color: #e2e8f0;
}

/* ── Table cells ── */
.cv-td {
    padding: 8px 12px;
    color: #cbd5e1;
    white-space: nowrap;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.15);
    transition: background 0.15s ease;
}

.cv-td-num {
    color: #475569;
    font-size: 0.72rem;
    text-align: center;
    width: 35px;
    font-weight: 500;
}

.cv-td-sku {
    font-weight: 600;
    color: #93c5fd;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
}

.cv-td-prod {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e2e8f0;
}

.cv-td-plats {
    white-space: nowrap;
}

.cv-td-abc {
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.cv-td-num-r {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: #94a3b8;
}

.cv-td-ddp {
    text-align: center;
    font-weight: 700;
    color: #fbbf24;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
}

/* ── Row zebra striping ── */
#cv-tbody tr.cv-row-main:nth-child(even) .cv-td {
    background: rgba(30, 41, 59, 0.25);
}

/* ── Row hover ── */
.cv-row-main {
    cursor: pointer;
    transition: background 0.15s ease;
}

#cv-tbody tr.cv-row-main:hover .cv-td {
    background: rgba(99, 102, 241, 0.07);
}

/* ── Platform badges ── */
.cv-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 22px;
    border-radius: 5px;
    font-size: 0.62rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.cv-plat-amazon {
    background: rgba(255, 153, 0, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(255, 153, 0, 0.2);
}

.cv-plat-ml {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.cv-plat-shopify {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.cv-plat-liverpool {
    background: rgba(232, 121, 249, 0.15);
    color: #e879f9;
    border: 1px solid rgba(232, 121, 249, 0.2);
}

.cv-plat-tiktok {
    background: rgba(255, 71, 87, 0.15);
    color: #ff4757;
    border: 1px solid rgba(255, 71, 87, 0.2);
}

/* ── Sparkline cell ── */
.cv-td-spark {
    padding: 4px 8px !important;
    width: 100px;
}

.cv-sparkline-wrap {
    width: 90px;
    height: 28px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(51, 65, 85, 0.2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cv-sparkline-wrap svg {
    width: 100%;
    height: 100%;
}

/* ── Detail expansion ── */
.cv-detail-cell {
    padding: 0 !important;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.cv-detail-container {
    margin: 0;
    padding: 14px 20px 16px;
    background: rgba(15, 23, 42, 0.7);
    border-left: 3px solid rgba(99, 102, 241, 0.4);
}

.cv-detail-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #818cf8;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cv-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
}

.cv-detail-table thead tr {
    background: rgba(30, 41, 59, 0.6);
}

.cv-detail-table th {
    padding: 6px 10px;
    color: #64748b;
    font-weight: 600;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: right;
    white-space: nowrap;
}

.cv-detail-table th:first-child {
    text-align: left;
}

.cv-detail-table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.15);
    color: #94a3b8;
}

.cv-det-val {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
}

.cv-det-ddp {
    color: #fbbf24 !important;
    font-weight: 700;
}

/* ── Platform badge (detail view) ── */
.cv-plat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.02em;
    border: 1px solid;
    transition: filter 0.15s ease;
}

.cv-plat-link {
    text-decoration: none;
    display: inline-block;
}

.cv-plat-link:hover .cv-plat-badge {
    filter: brightness(1.3);
}

.cv-plat-cell {
    text-align: left !important;
    vertical-align: middle;
}

.cv-listings-row {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.cv-listing-chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.62rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid;
    opacity: 0.7;
    transition: opacity 0.15s ease, filter 0.15s ease;
}

.cv-listing-chip:hover {
    opacity: 1;
    filter: brightness(1.3);
}

/* ── Detail button ── */
.cv-detail-btn {
    margin-left: 12px;
    padding: 3px 10px;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cv-detail-btn:hover {
    background: rgba(99, 102, 241, 0.25);
}

/* ── SVG icon alignment ── */
.cv-detail-title svg,
.cv-plat-badge svg,
.cv-listing-chip svg,
.cv-detail-btn svg {
    vertical-align: middle;
    flex-shrink: 0;
}

/* ── Sync spinner animation ── */
@keyframes cv-spin {
    to { transform: rotate(360deg); }
}
.cv-spin {
    animation: cv-spin 0.8s linear infinite;
}

/* Dynamic/date-filtered column markers are styled inline via JS */


/* ════════════════════════════════════════════════════════════════
   CV-FIL-007 — Filtros del Consolidado (migración inline → CSS).
   Foco en el dropdown de filtros y el de exportación. Resto de la
   sección (KPIs, tabla) sigue cubierto por HAL-VNT-010 (Mejora #7).
   ════════════════════════════════════════════════════════════════ */

/* Botones de la toolbar */
.cv-filters-toggle-btn,
.cv-export-toggle-btn,
.cv-sync-btn {
    padding: 5px 14px;
    border-radius: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.cv-filters-toggle-btn {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}
.cv-export-toggle-btn {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}
.cv-sync-btn {
    padding: 4px 12px;
    font-size: 0.75rem;
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.25);
}
.cv-toolbar-caret { font-size: 0.55rem; opacity: 0.5; }

/* Search input */
.cv-search-input {
    padding: 6px 12px;
    background: #0f172a;
    color: #f1f5f9;
    border: 1px solid rgba(51, 65, 85, 0.45);
    border-radius: 0.4rem;
    font-size: 0.8rem;
    width: 240px;
    outline: none;
}

/* Badge de filtros activos en el botón */
.cv-active-filter-badge {
    background: #6366f1;
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 700;
}

/* Dropdown contenedor */
.cv-filter-dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #1e293b;
    border-radius: 0.6rem;
    padding: 16px;
    z-index: 200;
    min-width: 340px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}
.cv-filter-dropdown-panel--filters {
    border: 1px solid rgba(99, 102, 241, 0.3);
}
.cv-filter-dropdown-panel--export {
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 6px;
    min-width: 180px;
}

/* Secciones del dropdown de filtros */
.cv-filter-section { margin-bottom: 14px; }
.cv-filter-section-title {
    font-size: 0.72rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.cv-filter-section-suffix {
    color: #a5b4fc;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}
.cv-filter-row { display: flex; gap: 12px; flex-wrap: wrap; }
.cv-filter-divider {
    height: 1px;
    background: rgba(51, 65, 85, 0.4);
    margin-bottom: 14px;
}

/* Checkbox labels con color por categoría */
.cv-filter-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}
.cv-filter-label--amz       { color: #f59e0b; }
.cv-filter-label--amz       input { accent-color: #f59e0b; }
.cv-filter-label--ml        { color: #60a5fa; }
.cv-filter-label--ml        input { accent-color: #60a5fa; }
.cv-filter-label--shp       { color: #4ade80; }
.cv-filter-label--shp       input { accent-color: #4ade80; }
.cv-filter-label--liv       { color: #e879f9; }
.cv-filter-label--liv       input { accent-color: #e879f9; }
.cv-filter-label--tt        { color: #ff4757; }
.cv-filter-label--tt        input { accent-color: #ff4757; }
.cv-filter-label--saludvida { color: #c084fc; }
.cv-filter-label--saludvida input { accent-color: #a855f7; }
.cv-filter-label--otras     { color: #94a3b8; }
.cv-filter-label--otras     input { accent-color: #94a3b8; }

/* Presets de período (chips) */
.cv-period-chips {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.cv-period-preset {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cv-period-preset.active {
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.5);
}

/* Inputs de fecha personalizada */
.cv-period-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}
.cv-period-input-group { flex: 1; }
.cv-period-date-label {
    display: block;
    font-size: 0.68rem;
    color: #64748b;
    margin-bottom: 3px;
}
.cv-period-date-input {
    width: 100%;
    padding: 5px 8px;
    background: #0f172a;
    color: #e2e8f0;
    border: 1px solid rgba(51, 65, 85, 0.45);
    border-radius: 0.4rem;
    font-size: 0.78rem;
    outline: none;
    color-scheme: dark;
}
.cv-period-arrow {
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 14px;
}

/* Footer con Limpiar / Aplicar */
.cv-filter-footer {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    align-items: center;
}
.cv-btn-apply,
.cv-btn-clear {
    padding: 4px 12px;
    border-radius: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}
.cv-btn-apply {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.cv-btn-clear {
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Opciones del dropdown de exportación */
.cv-export-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    color: #e2e8f0;
    border: none;
    border-radius: 0.35rem;
    font-size: 0.8rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
}
.cv-export-option:hover { background: rgba(51, 65, 85, 0.5); }

/* CV-FIL-AMZ-07: filas del detail drawer fuera del filtro de plataforma */
.cv-detail-row-dimmed { opacity: 0.42; }
.cv-detail-row-dimmed:hover { opacity: 1; transition: opacity 0.15s ease; }

/* ═══════════════════════════════════════════════════════════════════
   Detalle centrado de producto y rentabilidad
   ═══════════════════════════════════════════════════════════════════ */
body.pd-modal-open { overflow: hidden; }

.pd-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(7px);
    opacity: 0;
    transition: opacity 180ms ease;
}
.pd-modal-overlay.is-open {
    display: flex;
    opacity: 1;
}
.pd-modal-overlay.is-closing {
    display: flex;
    opacity: 0;
}

.pd-modal {
    width: min(92vw, 1480px);
    height: 90vh;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
    color: #e2e8f0;
    background: linear-gradient(145deg, #0b1120 0%, #111a2f 58%, #121b2d 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 18px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(148, 163, 184, 0.05);
    transform: translateY(14px) scale(0.985);
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.pd-modal-overlay.is-open .pd-modal { transform: translateY(0) scale(1); }

.pd-modal-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 42px;
    align-items: center;
    gap: 22px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.55);
    background: rgba(11, 17, 32, 0.94);
}
.pd-modal-identity { min-width: 0; }
.pd-modal-sku {
    color: #f8fafc;
    font-size: 1.18rem;
    font-weight: 760;
    letter-spacing: -0.01em;
}
.pd-modal-name {
    margin-top: 3px;
    overflow: hidden;
    color: #94a3b8;
    font-size: 0.84rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pd-platform-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.pd-platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    color: var(--pd-platform-color, #94a3b8);
    background: color-mix(in srgb, var(--pd-platform-color, #94a3b8) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--pd-platform-color, #94a3b8) 32%, transparent);
    border-radius: 999px;
    font-size: 0.71rem;
    font-weight: 700;
}

.pd-modal-period { text-align: right; }
.pd-period-caption {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: 0.68rem;
}
.pd-period-chips { display: flex; gap: 4px; }
.pd-period-chip {
    padding: 4px 10px;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.pd-period-chip:hover,
.pd-period-chip.active {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(129, 140, 248, 0.58);
}

.pd-modal-close {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    color: #94a3b8;
    background: rgba(51, 65, 85, 0.24);
    border: 1px solid rgba(71, 85, 105, 0.42);
    border-radius: 10px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.pd-modal-close:hover { color: #f8fafc; background: rgba(71, 85, 105, 0.48); }

.pd-detail-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 22px 0;
    overflow-x: auto;
    background: rgba(11, 17, 32, 0.88);
    border-bottom: 1px solid rgba(51, 65, 85, 0.45);
}
.pd-detail-tab {
    flex: 0 0 auto;
    padding: 9px 15px 10px;
    color: #64748b;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}
.pd-detail-tab:hover { color: #cbd5e1; }
.pd-detail-tab.active {
    color: #a5b4fc;
    border-bottom-color: #818cf8;
}

.pd-modal-body {
    min-height: 0;
    padding: 20px 22px 26px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(99, 102, 241, 0.5) rgba(15, 23, 42, 0.4);
}
.pd-detail-pane[hidden] { display: none !important; }
.pd-detail-pane { animation: pdPaneIn 150ms ease; }
@keyframes pdPaneIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.pd-block-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 78px;
    margin-bottom: 14px;
    padding: 16px;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed rgba(71, 85, 105, 0.52);
    border-radius: 12px;
    font-size: 0.8rem;
}
.pd-block-state.is-error {
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.12);
    border-color: rgba(248, 113, 113, 0.34);
}
.pd-block-state.is-empty { color: #64748b; }
.pd-state-spinner {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    border: 2px solid rgba(129, 140, 248, 0.22);
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: pdSpin 0.72s linear infinite;
}
@keyframes pdSpin { to { transform: rotate(360deg); } }

.pd-alert {
    margin-bottom: 14px;
    padding: 10px 13px;
    border-radius: 10px;
    font-size: 0.76rem;
    line-height: 1.45;
}
.pd-alert-warning {
    color: #fcd34d;
    background: rgba(146, 64, 14, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.32);
}
.pd-alert-info {
    color: #bae6fd;
    background: rgba(3, 105, 161, 0.13);
    border: 1px solid rgba(56, 189, 248, 0.28);
}

.pd-summary-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(51, 65, 85, 0.4);
    border-radius: 11px;
}
.pd-summary-toolbar-label {
    display: block;
    color: #e2e8f0;
    font-size: 0.76rem;
    font-weight: 720;
}
.pd-summary-filter-caption {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 0.64rem;
}
.pd-summary-platform-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}
.pd-summary-platform-chip {
    padding: 5px 10px;
    color: var(--pd-platform-color, #94a3b8);
    background: color-mix(in srgb, var(--pd-platform-color, #94a3b8) 7%, transparent);
    border: 1px solid color-mix(in srgb, var(--pd-platform-color, #94a3b8) 23%, transparent);
    border-radius: 999px;
    font-size: 0.67rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.pd-summary-platform-chip:hover { transform: translateY(-1px); }
.pd-summary-platform-chip.active {
    color: #f8fafc;
    background: color-mix(in srgb, var(--pd-platform-color, #818cf8) 24%, transparent);
    border-color: color-mix(in srgb, var(--pd-platform-color, #818cf8) 62%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--pd-platform-color, #818cf8) 14%, transparent);
}

.pd-profit-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(128px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.pd-profit-card,
.pd-sales-metrics > div {
    min-width: 0;
    padding: 13px 14px;
    background: rgba(30, 41, 59, 0.58);
    border: 1px solid rgba(71, 85, 105, 0.38);
    border-radius: 12px;
}
.pd-profit-card-action {
    position: relative;
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
    transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.pd-profit-card-action:hover,
.pd-profit-card-action[aria-expanded="true"] {
    background: rgba(49, 46, 129, 0.24);
    border-color: rgba(129, 140, 248, 0.48);
    transform: translateY(-1px);
}
.pd-profit-card-action:focus-visible {
    outline: 2px solid #818cf8;
    outline-offset: 2px;
}
.pd-card-action-hint {
    position: absolute;
    right: 11px;
    top: 9px;
    color: #818cf8;
    font-size: 0.85rem;
    transition: transform 140ms ease;
}
.pd-profit-card-action[aria-expanded="true"] .pd-card-action-hint { transform: rotate(180deg); }
.pd-profit-card.is-positive { border-color: rgba(74, 222, 128, 0.28); }
.pd-profit-card.is-negative { border-color: rgba(248, 113, 113, 0.34); }
.pd-profit-card-label {
    min-height: 30px;
    color: #64748b;
    font-size: 0.69rem;
    line-height: 1.25;
}
.pd-profit-card-value {
    margin-top: 5px;
    color: #f8fafc;
    font-size: 1.08rem;
    font-weight: 760;
    white-space: nowrap;
}
.pd-profit-card.is-positive .pd-profit-card-value { color: #4ade80; }
.pd-profit-card.is-negative .pd-profit-card-value { color: #f87171; }
.pd-profit-card-sub {
    margin-top: 4px;
    color: #64748b;
    font-size: 0.64rem;
}

.pd-platform-expense-breakdown {
    margin: -2px 0 14px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(129, 140, 248, 0.32);
    border-radius: 12px;
    animation: pdPaneIn 150ms ease;
}
.pd-platform-expense-breakdown[hidden] { display: none; }
.pd-expense-breakdown-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 11px;
}
.pd-expense-breakdown-header h3 { margin: 0; color: #e2e8f0; font-size: 0.78rem; }
.pd-expense-breakdown-header p { margin: 3px 0 0; color: #64748b; font-size: 0.64rem; }
.pd-expense-components {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 7px;
}
.pd-expense-component {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    color: #94a3b8;
    background: rgba(30, 41, 59, 0.54);
    border-radius: 8px;
    font-size: 0.65rem;
}
.pd-expense-component strong { color: #e2e8f0; font-size: 0.7rem; }
.pd-expense-component.is-estimated { background: rgba(146, 64, 14, 0.11); }
.pd-expense-component.is-estimated strong { color: #fcd34d; }
.pd-expense-total {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 9px;
    padding-top: 9px;
    color: #94a3b8;
    border-top: 1px solid rgba(51, 65, 85, 0.42);
    font-size: 0.68rem;
}
.pd-expense-total strong { color: #f8fafc; font-size: 0.82rem; }

.pd-profit-bridge {
    display: grid;
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    align-items: stretch;
    gap: 8px;
    margin-bottom: 16px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.56);
    border: 1px solid rgba(51, 65, 85, 0.46);
    border-radius: 12px;
}
.pd-bridge-step {
    position: relative;
    min-width: 0;
    padding: 10px;
    background: rgba(30, 41, 59, 0.55);
    border-radius: 9px;
    text-align: center;
}
.pd-bridge-step:not(:last-child)::after {
    content: '→';
    position: absolute;
    top: 50%;
    right: -9px;
    z-index: 1;
    color: #475569;
    transform: translate(50%, -50%);
}
.pd-bridge-label { color: #64748b; font-size: 0.63rem; }
.pd-bridge-value { margin-top: 5px; color: #e2e8f0; font-size: 0.84rem; font-weight: 720; }
.pd-bridge-step.is-cost .pd-bridge-value { color: #fbbf24; }
.pd-bridge-step.is-result .pd-bridge-value { color: #4ade80; }
.pd-bridge-step.is-result.is-negative .pd-bridge-value { color: #f87171; }

.pd-notes {
    margin: 0 0 14px;
    padding: 11px 14px 11px 30px;
    color: #94a3b8;
    background: rgba(30, 41, 59, 0.35);
    border-radius: 10px;
    font-size: 0.71rem;
    line-height: 1.45;
}
.pd-notes li + li { margin-top: 4px; }

.pd-methodology-details {
    margin-top: 12px;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.36);
    border: 1px solid rgba(51, 65, 85, 0.38);
    border-radius: 10px;
}
.pd-methodology-details > summary {
    padding: 9px 12px;
    color: #818cf8;
    font-size: 0.69rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}
.pd-methodology-details[open] > summary {
    border-bottom: 1px solid rgba(51, 65, 85, 0.38);
}
.pd-methodology-details .pd-profit-bridge {
    margin: 12px 12px 8px;
}
.pd-methodology-details .pd-notes {
    margin: 0 12px 12px;
}

.pd-sales-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}
.pd-sales-metrics > div { text-align: center; }
.pd-sales-trend { min-height: 20px; margin: 0 0 14px; font-size: 0.8rem; }

.pd-panel {
    padding: 15px;
    background: rgba(15, 23, 42, 0.48);
    border: 1px solid rgba(51, 65, 85, 0.45);
    border-radius: 12px;
}
.pd-panel + .pd-panel { margin-top: 14px; }
.pd-panel-toolbar,
.pd-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.pd-panel h3 { margin: 0; color: #e2e8f0; font-size: 0.86rem; }
.pd-panel-heading p { margin: 3px 0 0; color: #64748b; font-size: 0.68rem; }
.pd-chart-tabs {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: rgba(2, 6, 23, 0.48);
    border-radius: 8px;
}
.pd-chart-tabs button {
    padding: 5px 14px;
    color: #64748b;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}
.pd-chart-tabs button.active {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.34);
}
.pd-chart-wrap { position: relative; height: 280px; }
.pd-chart-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #64748b;
    font-size: 0.78rem;
    text-align: center;
}

.pd-rent-table-slot,
.pd-table-scroll { width: 100%; overflow-x: auto; }
.pd-rent-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
    color: #cbd5e1;
    font-size: 0.7rem;
}
.pd-rent-table th,
.pd-rent-table td {
    padding: 9px 10px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.36);
    text-align: right;
    white-space: nowrap;
}
.pd-rent-table th {
    color: #64748b;
    background: rgba(15, 23, 42, 0.74);
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}
.pd-rent-table th:first-child,
.pd-rent-table td:first-child { text-align: left; }
.pd-rent-table tbody tr:hover { background: rgba(51, 65, 85, 0.17); }
.pd-value-positive { color: #4ade80; }
.pd-value-negative { color: #f87171; }
.pd-value-muted { color: #64748b; }

.pd-quality-badge,
.pd-cost-status,
.pd-allocation-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 999px;
    color: #cbd5e1;
    background: rgba(100, 116, 139, 0.12);
    font-size: 0.61rem;
    font-weight: 700;
}
.pd-quality-badge.is-real,
.pd-cost-status.is-real { color: #86efac; border-color: rgba(74, 222, 128, 0.3); background: rgba(34, 197, 94, 0.1); }
.pd-quality-badge.is-estimated,
.pd-cost-status.is-estimated,
.pd-allocation-badge.is-estimated { color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.1); }
.pd-quality-badge.is-neutral { color: #cbd5e1; border-color: rgba(148, 163, 184, 0.24); background: rgba(100, 116, 139, 0.12); }
.pd-quality-badge.is-missing { color: #fca5a5; border-color: rgba(248, 113, 113, 0.3); background: rgba(127, 29, 29, 0.14); }
.pd-rent-table td .pd-quality-badge { margin-top: 5px; }
.pd-allocation-badge.is-direct { color: #93c5fd; border-color: rgba(96, 165, 250, 0.3); background: rgba(59, 130, 246, 0.1); }
.pd-allocation-badge.is-mapped { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.3); background: rgba(139, 92, 246, 0.1); }

.pd-ad-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}
.pd-ad-card {
    padding: 14px;
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(71, 85, 105, 0.38);
    border-radius: 12px;
}
.pd-ad-card-label { color: #64748b; font-size: 0.68rem; }
.pd-ad-card-value { margin-top: 6px; color: #f8fafc; font-size: 1rem; font-weight: 740; }
.pd-ad-card-sub { margin-top: 4px; color: #64748b; font-size: 0.62rem; }

.pd-commercial-panel { margin-top: 16px; }
.pd-commercial-panel #pd-breakdown { overflow-x: auto; }
.pd-commercial-panel #pd-breakdown > h3 { display: none; }

.pd-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    min-height: 46px;
    padding: 9px 22px;
    background: rgba(11, 17, 32, 0.94);
    border-top: 1px solid rgba(51, 65, 85, 0.5);
}
.pd-modal-footer a { color: #818cf8; font-size: 0.73rem; text-decoration: none; }
.pd-modal-footer a:hover { color: #c7d2fe; }
.pd-modal-footer a[hidden] { display: none; }

@media (max-width: 1100px) {
    .pd-modal-overlay { padding: 2vh 2vw; }
    .pd-modal { width: 96vw; height: 94vh; }
    .pd-profit-metrics { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
    .pd-profit-bridge { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
    .pd-bridge-step:nth-child(4)::after { display: none; }
    .pd-ad-summary { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
    .pd-summary-toolbar { align-items: flex-start; flex-direction: column; }
    .pd-summary-platform-filter { justify-content: flex-start; }
    .pd-expense-components { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
}

@media (max-width: 720px) {
    .pd-modal-overlay { padding: 0; }
    .pd-modal { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
    .pd-modal-header { grid-template-columns: minmax(0, 1fr) 38px; gap: 12px; padding: 14px 14px 12px; }
    .pd-modal-period { grid-column: 1 / -1; grid-row: 2; text-align: left; }
    .pd-modal-close { grid-column: 2; grid-row: 1; }
    .pd-detail-tabs { padding-inline: 12px; }
    .pd-modal-body { padding: 14px 12px 20px; }
    .pd-profit-metrics,
    .pd-sales-metrics,
    .pd-ad-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pd-profit-bridge { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pd-bridge-step:nth-child(even)::after { display: none; }
    .pd-summary-platform-chip { padding-inline: 8px; }
    .pd-expense-components { grid-template-columns: 1fr; }
    .pd-expense-breakdown-header { flex-direction: column; }
    .pd-chart-wrap { height: 230px; }
    .pd-modal-footer { justify-content: space-between; padding-inline: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .pd-modal-overlay,
    .pd-modal,
    .pd-detail-pane { transition: none; animation: none; }
}
